Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit f185503

Browse files
committed
Update samples
1 parent 3be03d7 commit f185503

File tree

462 files changed

+19608
-24192
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

462 files changed

+19608
-24192
lines changed

samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/api_client.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -816,16 +816,13 @@ def _content_type_is_json(cls, content_type: str) -> bool:
816816
return True
817817
return False
818818

819-
Response_T = typing.TypeVar("Response_T", bound=ApiResponse)
820-
821-
class OpenApiResponse(JSONDetector, typing.Generic[Response_T]):
822-
response_cls: typing.Type[Response_T]
823819

820+
class OpenApiResponse(JSONDetector):
824821
__filename_content_disposition_pattern = re.compile('filename="(.+?)"')
825822

826823
def __init__(
827824
self,
828-
response_cls: typing.Type[Response_T] = ApiResponse,
825+
response_cls: typing.Type[ApiResponse] = ApiResponse,
829826
content: typing.Optional[typing.Dict[str, MediaType]] = None,
830827
headers: typing.Optional[typing.List[HeaderParameter]] = None,
831828
):
@@ -910,7 +907,7 @@ def __deserialize_multipart_form_data(
910907
for part in msg.get_payload()
911908
}
912909

913-
def deserialize(self, response: urllib3.HTTPResponse, configuration: Configuration) -> Response_T:
910+
def deserialize(self, response: urllib3.HTTPResponse, configuration: Configuration) -> ApiResponse:
914911
content_type = response.getheader('content-type')
915912
deserialized_body = unset
916913
streamed = response.supports_chunked_reads()

samples/openapi3/client/3_0_3_unit_test/python/unit_test_api/paths/request_body_post_additionalproperties_allows_a_schema_which_should_validate_request_body/post.py

Lines changed: 48 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,21 @@ class BaseApi(api_client.Api):
6161

6262
@typing.overload
6363
def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg(
64-
self: api_client.Api,
65-
body: typing.Union[SchemaForRequestBodyApplicationJson, ],
64+
self,
65+
body: typing.Union[SchemaForRequestBodyApplicationJson,],
6666
content_type: str = 'application/json',
6767
stream: bool = False,
6868
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
6969
skip_deserialization: typing_extensions.Literal[False] = False,
7070
) -> typing.Union[
71-
api_client.ApiResponse,
71+
ApiResponseFor200,
7272
]:
7373
...
7474

7575
@typing.overload
7676
def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg(
77-
self: api_client.Api,
78-
body: typing.Union[SchemaForRequestBodyApplicationJson, ],
77+
self,
78+
body: typing.Union[SchemaForRequestBodyApplicationJson,],
7979
content_type: str = 'application/json',
8080
stream: bool = False,
8181
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
@@ -85,29 +85,26 @@ def _post_additionalproperties_allows_a_schema_which_should_validate_request_bod
8585

8686
@typing.overload
8787
def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg(
88-
self: api_client.Api,
89-
body: typing.Union[SchemaForRequestBodyApplicationJson, ],
88+
self,
89+
body: typing.Union[SchemaForRequestBodyApplicationJson,],
9090
content_type: str = 'application/json',
9191
stream: bool = False,
9292
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
9393
skip_deserialization: bool = False,
9494
) -> typing.Union[
95-
api_client.ApiResponse,
96-
api_client.ApiResponseWithoutDeserialization
95+
ApiResponseFor200,
96+
api_client.ApiResponseWithoutDeserialization,
9797
]:
9898
...
9999

100100
def _post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg(
101-
self: api_client.Api,
102-
body: typing.Union[SchemaForRequestBodyApplicationJson, ],
103-
content_type: str = 'application/json',
104-
stream: bool = False,
105-
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
106-
skip_deserialization: bool = False,
107-
) -> typing.Union[
108-
api_client.ApiResponse,
109-
api_client.ApiResponseWithoutDeserialization
110-
]:
101+
self,
102+
body,
103+
content_type = 'application/json',
104+
stream = False,
105+
timeout = None,
106+
skip_deserialization = False,
107+
):
111108
"""
112109
:param skip_deserialization: If true then api_response.response will be set but
113110
api_response.body and api_response.headers will not be deserialized into schema
@@ -159,21 +156,21 @@ class PostAdditionalpropertiesAllowsASchemaWhichShouldValidateRequestBody(BaseAp
159156

160157
@typing.overload
161158
def post_additionalproperties_allows_a_schema_which_should_validate_request_body(
162-
self: BaseApi,
163-
body: typing.Union[SchemaForRequestBodyApplicationJson, ],
159+
self,
160+
body: typing.Union[SchemaForRequestBodyApplicationJson,],
164161
content_type: str = 'application/json',
165162
stream: bool = False,
166163
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
167164
skip_deserialization: typing_extensions.Literal[False] = False,
168165
) -> typing.Union[
169-
api_client.ApiResponse,
166+
ApiResponseFor200,
170167
]:
171168
...
172169

173170
@typing.overload
174171
def post_additionalproperties_allows_a_schema_which_should_validate_request_body(
175-
self: BaseApi,
176-
body: typing.Union[SchemaForRequestBodyApplicationJson, ],
172+
self,
173+
body: typing.Union[SchemaForRequestBodyApplicationJson,],
177174
content_type: str = 'application/json',
178175
stream: bool = False,
179176
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
@@ -183,29 +180,26 @@ def post_additionalproperties_allows_a_schema_which_should_validate_request_body
183180

184181
@typing.overload
185182
def post_additionalproperties_allows_a_schema_which_should_validate_request_body(
186-
self: BaseApi,
187-
body: typing.Union[SchemaForRequestBodyApplicationJson, ],
183+
self,
184+
body: typing.Union[SchemaForRequestBodyApplicationJson,],
188185
content_type: str = 'application/json',
189186
stream: bool = False,
190187
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
191188
skip_deserialization: bool = False,
192189
) -> typing.Union[
193-
api_client.ApiResponse,
194-
api_client.ApiResponseWithoutDeserialization
190+
ApiResponseFor200,
191+
api_client.ApiResponseWithoutDeserialization,
195192
]:
196193
...
197194

198195
def post_additionalproperties_allows_a_schema_which_should_validate_request_body(
199-
self: BaseApi,
200-
body: typing.Union[SchemaForRequestBodyApplicationJson, ],
201-
content_type: str = 'application/json',
202-
stream: bool = False,
203-
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
204-
skip_deserialization: bool = False,
205-
) -> typing.Union[
206-
api_client.ApiResponse,
207-
api_client.ApiResponseWithoutDeserialization
208-
]:
196+
self,
197+
body,
198+
content_type = 'application/json',
199+
stream = False,
200+
timeout = None,
201+
skip_deserialization = False,
202+
):
209203
return self._post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg(
210204
body=body,
211205
content_type=content_type,
@@ -220,21 +214,21 @@ class ApiForpost(BaseApi):
220214

221215
@typing.overload
222216
def post(
223-
self: BaseApi,
224-
body: typing.Union[SchemaForRequestBodyApplicationJson, ],
217+
self,
218+
body: typing.Union[SchemaForRequestBodyApplicationJson,],
225219
content_type: str = 'application/json',
226220
stream: bool = False,
227221
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
228222
skip_deserialization: typing_extensions.Literal[False] = False,
229223
) -> typing.Union[
230-
api_client.ApiResponse,
224+
ApiResponseFor200,
231225
]:
232226
...
233227

234228
@typing.overload
235229
def post(
236-
self: BaseApi,
237-
body: typing.Union[SchemaForRequestBodyApplicationJson, ],
230+
self,
231+
body: typing.Union[SchemaForRequestBodyApplicationJson,],
238232
content_type: str = 'application/json',
239233
stream: bool = False,
240234
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
@@ -244,29 +238,26 @@ def post(
244238

245239
@typing.overload
246240
def post(
247-
self: BaseApi,
248-
body: typing.Union[SchemaForRequestBodyApplicationJson, ],
241+
self,
242+
body: typing.Union[SchemaForRequestBodyApplicationJson,],
249243
content_type: str = 'application/json',
250244
stream: bool = False,
251245
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
252246
skip_deserialization: bool = False,
253247
) -> typing.Union[
254-
api_client.ApiResponse,
255-
api_client.ApiResponseWithoutDeserialization
248+
ApiResponseFor200,
249+
api_client.ApiResponseWithoutDeserialization,
256250
]:
257251
...
258252

259253
def post(
260-
self: BaseApi,
261-
body: typing.Union[SchemaForRequestBodyApplicationJson, ],
262-
content_type: str = 'application/json',
263-
stream: bool = False,
264-
timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
265-
skip_deserialization: bool = False,
266-
) -> typing.Union[
267-
api_client.ApiResponse,
268-
api_client.ApiResponseWithoutDeserialization
269-
]:
254+
self,
255+
body,
256+
content_type = 'application/json',
257+
stream = False,
258+
timeout = None,
259+
skip_deserialization = False,
260+
):
270261
return self._post_additionalproperties_allows_a_schema_which_should_validate_request_body_oapg(
271262
body=body,
272263
content_type=content_type,

0 commit comments

Comments
 (0)