diff --git a/modules/openapi-generator/src/main/resources/python/api.mustache b/modules/openapi-generator/src/main/resources/python/api.mustache index 1dcbb860786..7cbea8a8bd0 100644 --- a/modules/openapi-generator/src/main/resources/python/api.mustache +++ b/modules/openapi-generator/src/main/resources/python/api.mustache @@ -253,6 +253,23 @@ class {{classname}}(object): {{/hasConsumes}} # Authentication setting auth_settings = [{{#authMethods}}'{{name}}'{{#hasMore}}, {{/hasMore}}{{/authMethods}}] # noqa: E501 + + {{#returnType}} + {{#responses}} + {{#-first}} + response_types_map = { + {{/-first}} + {{^isWildcard}} + {{code}}: {{#dataType}}"{{dataType}}"{{/dataType}}{{^dataType}}None{{/dataType}}, + {{/isWildcard}} + {{#-last}} + } + {{/-last}} + {{/responses}} + {{/returnType}} + {{^returnType}} + response_types_map = {} + {{/returnType}} return self.api_client.call_api( '{{{path}}}', '{{httpMethod}}', @@ -262,7 +279,7 @@ class {{classname}}(object): body=body_params, post_params=form_params, files=local_var_files, - response_type={{#returnType}}'{{returnType}}'{{/returnType}}{{^returnType}}None{{/returnType}}, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/modules/openapi-generator/src/main/resources/python/api_client.mustache b/modules/openapi-generator/src/main/resources/python/api_client.mustache index 7eb04b6943d..a3e6eba30dc 100644 --- a/modules/openapi-generator/src/main/resources/python/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_client.mustache @@ -130,7 +130,7 @@ class ApiClient(object): {{#asyncio}}async {{/asyncio}}def __call_api( self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None, post_params=None, - files=None, response_type=None, auth_settings=None, + files=None, response_types_map=None, auth_settings=None, _return_http_data_only=None, collection_formats=None, _preload_content=True, _request_timeout=None, _host=None, _request_auth=None): @@ -213,6 +213,8 @@ class ApiClient(object): {{#tornado}} raise tornado.gen.Return(return_data) {{/tornado}} + + response_type = response_types_map.get(response_data.status, None) if six.PY3 and response_type not in ["file", "bytes"]: match = None @@ -222,6 +224,7 @@ class ApiClient(object): response_data.data = response_data.data.decode(encoding) # deserialize response data + if response_type: return_data = self.deserialize(response_data, response_type) else: @@ -348,10 +351,10 @@ class ApiClient(object): def call_api(self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None, post_params=None, files=None, - response_type=None, auth_settings=None, async_req=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None, - _request_auth=None): + response_types_map=None, auth_settings=None, + async_req=None, _return_http_data_only=None, + collection_formats=None,_preload_content=True, + _request_timeout=None, _host=None, _request_auth=None): """Makes the HTTP request (synchronous) and returns deserialized data. To make an async_req request, set the async_req parameter. @@ -396,7 +399,7 @@ class ApiClient(object): return self.__call_api(resource_path, method, path_params, query_params, header_params, body, post_params, files, - response_type, auth_settings, + response_types_map, auth_settings, _return_http_data_only, collection_formats, _preload_content, _request_timeout, _host, _request_auth) @@ -406,7 +409,7 @@ class ApiClient(object): query_params, header_params, body, post_params, files, - response_type, + response_types_map, auth_settings, _return_http_data_only, collection_formats, diff --git a/samples/client/petstore/python-asyncio/petstore_api/api/another_fake_api.py b/samples/client/petstore/python-asyncio/petstore_api/api/another_fake_api.py index 562b9faa58f..6fdd4523647 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api/another_fake_api.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api/another_fake_api.py @@ -153,6 +153,10 @@ class AnotherFakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "Client", + } return self.api_client.call_api( '/another-fake/dummy', 'PATCH', @@ -162,7 +166,7 @@ class AnotherFakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Client', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/client/petstore/python-asyncio/petstore_api/api/fake_api.py b/samples/client/petstore/python-asyncio/petstore_api/api/fake_api.py index b171fe8b3d7..252a82c0ef4 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api/fake_api.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api/fake_api.py @@ -149,6 +149,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/create_xml_item', 'POST', @@ -158,7 +160,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -276,6 +278,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "bool", + } return self.api_client.call_api( '/fake/outer/boolean', 'POST', @@ -285,7 +291,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='bool', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -403,6 +409,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "OuterComposite", + } return self.api_client.call_api( '/fake/outer/composite', 'POST', @@ -412,7 +422,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='OuterComposite', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -530,6 +540,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "float", + } return self.api_client.call_api( '/fake/outer/number', 'POST', @@ -539,7 +553,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='float', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -657,6 +671,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "str", + } return self.api_client.call_api( '/fake/outer/string', 'POST', @@ -666,7 +684,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='str', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -788,6 +806,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/body-with-file-schema', 'PUT', @@ -797,7 +817,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -928,6 +948,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/body-with-query-params', 'PUT', @@ -937,7 +959,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1063,6 +1085,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "Client", + } return self.api_client.call_api( '/fake', 'PATCH', @@ -1072,7 +1098,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Client', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1325,6 +1351,8 @@ class FakeApi(object): # Authentication setting auth_settings = ['http_basic_test'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake', 'POST', @@ -1334,7 +1362,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1504,6 +1532,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake', 'GET', @@ -1513,7 +1543,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1674,6 +1704,8 @@ class FakeApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake', 'DELETE', @@ -1683,7 +1715,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1803,6 +1835,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/inline-additionalProperties', 'POST', @@ -1812,7 +1846,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1943,6 +1977,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/jsonFormData', 'GET', @@ -1952,7 +1988,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -2119,6 +2155,8 @@ class FakeApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/test-query-paramters', 'PUT', @@ -2128,7 +2166,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/client/petstore/python-asyncio/petstore_api/api/fake_classname_tags_123_api.py b/samples/client/petstore/python-asyncio/petstore_api/api/fake_classname_tags_123_api.py index 5cd44526149..f87835d7a61 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api/fake_classname_tags_123_api.py @@ -153,6 +153,10 @@ class FakeClassnameTags123Api(object): # Authentication setting auth_settings = ['api_key_query'] # noqa: E501 + + response_types_map = { + 200: "Client", + } return self.api_client.call_api( '/fake_classname_test', 'PATCH', @@ -162,7 +166,7 @@ class FakeClassnameTags123Api(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Client', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/client/petstore/python-asyncio/petstore_api/api/pet_api.py b/samples/client/petstore/python-asyncio/petstore_api/api/pet_api.py index 3119e2d60c4..5baedc8e6d2 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api/pet_api.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api/pet_api.py @@ -147,6 +147,8 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/pet', 'POST', @@ -156,7 +158,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -279,6 +281,8 @@ class PetApi(object): body_params = None # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/pet/{petId}', 'DELETE', @@ -288,7 +292,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -411,6 +415,11 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = { + 200: "list[Pet]", + 400: None, + } return self.api_client.call_api( '/pet/findByStatus', 'GET', @@ -420,7 +429,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='list[Pet]', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -543,6 +552,11 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = { + 200: "list[Pet]", + 400: None, + } return self.api_client.call_api( '/pet/findByTags', 'GET', @@ -552,7 +566,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='list[Pet]', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -674,6 +688,12 @@ class PetApi(object): # Authentication setting auth_settings = ['api_key'] # noqa: E501 + + response_types_map = { + 200: "Pet", + 400: None, + 404: None, + } return self.api_client.call_api( '/pet/{petId}', 'GET', @@ -683,7 +703,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Pet', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -803,6 +823,8 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/pet', 'PUT', @@ -812,7 +834,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -946,6 +968,8 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/pet/{petId}', 'POST', @@ -955,7 +979,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1093,6 +1117,10 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = { + 200: "ApiResponse", + } return self.api_client.call_api( '/pet/{petId}/uploadImage', 'POST', @@ -1102,7 +1130,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='ApiResponse', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1244,6 +1272,10 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = { + 200: "ApiResponse", + } return self.api_client.call_api( '/fake/{petId}/uploadImageWithRequiredFile', 'POST', @@ -1253,7 +1285,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='ApiResponse', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/client/petstore/python-asyncio/petstore_api/api/store_api.py b/samples/client/petstore/python-asyncio/petstore_api/api/store_api.py index d2d4c323334..734d8e17dc9 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api/store_api.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api/store_api.py @@ -145,6 +145,8 @@ class StoreApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/store/order/{order_id}', 'DELETE', @@ -154,7 +156,7 @@ class StoreApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -265,6 +267,10 @@ class StoreApi(object): # Authentication setting auth_settings = ['api_key'] # noqa: E501 + + response_types_map = { + 200: "dict(str, int)", + } return self.api_client.call_api( '/store/inventory', 'GET', @@ -274,7 +280,7 @@ class StoreApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='dict(str, int)', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -400,6 +406,12 @@ class StoreApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "Order", + 400: None, + 404: None, + } return self.api_client.call_api( '/store/order/{order_id}', 'GET', @@ -409,7 +421,7 @@ class StoreApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Order', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -529,6 +541,11 @@ class StoreApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "Order", + 400: None, + } return self.api_client.call_api( '/store/order', 'POST', @@ -538,7 +555,7 @@ class StoreApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Order', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/client/petstore/python-asyncio/petstore_api/api/user_api.py b/samples/client/petstore/python-asyncio/petstore_api/api/user_api.py index 9504f2834a6..9f8be84771a 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api/user_api.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api/user_api.py @@ -145,6 +145,8 @@ class UserApi(object): body_params = local_var_params['body'] # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user', 'POST', @@ -154,7 +156,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -270,6 +272,8 @@ class UserApi(object): body_params = local_var_params['body'] # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/createWithArray', 'POST', @@ -279,7 +283,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -395,6 +399,8 @@ class UserApi(object): body_params = local_var_params['body'] # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/createWithList', 'POST', @@ -404,7 +410,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -522,6 +528,8 @@ class UserApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/{username}', 'DELETE', @@ -531,7 +539,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -651,6 +659,12 @@ class UserApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "User", + 400: None, + 404: None, + } return self.api_client.call_api( '/user/{username}', 'GET', @@ -660,7 +674,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='User', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -791,6 +805,11 @@ class UserApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "str", + 400: None, + } return self.api_client.call_api( '/user/login', 'GET', @@ -800,7 +819,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='str', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -905,6 +924,8 @@ class UserApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/logout', 'GET', @@ -914,7 +935,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1043,6 +1064,8 @@ class UserApi(object): body_params = local_var_params['body'] # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/{username}', 'PUT', @@ -1052,7 +1075,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/client/petstore/python-asyncio/petstore_api/api_client.py b/samples/client/petstore/python-asyncio/petstore_api/api_client.py index cc78cbda542..eb20aa8e88d 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api_client.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api_client.py @@ -121,7 +121,7 @@ class ApiClient(object): async def __call_api( self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None, post_params=None, - files=None, response_type=None, auth_settings=None, + files=None, response_types_map=None, auth_settings=None, _return_http_data_only=None, collection_formats=None, _preload_content=True, _request_timeout=None, _host=None, _request_auth=None): @@ -199,6 +199,8 @@ class ApiClient(object): if not _preload_content: return return_data + + response_type = response_types_map.get(response_data.status, None) if six.PY3 and response_type not in ["file", "bytes"]: match = None @@ -208,6 +210,7 @@ class ApiClient(object): response_data.data = response_data.data.decode(encoding) # deserialize response data + if response_type: return_data = self.deserialize(response_data, response_type) else: @@ -325,10 +328,10 @@ class ApiClient(object): def call_api(self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None, post_params=None, files=None, - response_type=None, auth_settings=None, async_req=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None, - _request_auth=None): + response_types_map=None, auth_settings=None, + async_req=None, _return_http_data_only=None, + collection_formats=None,_preload_content=True, + _request_timeout=None, _host=None, _request_auth=None): """Makes the HTTP request (synchronous) and returns deserialized data. To make an async_req request, set the async_req parameter. @@ -373,7 +376,7 @@ class ApiClient(object): return self.__call_api(resource_path, method, path_params, query_params, header_params, body, post_params, files, - response_type, auth_settings, + response_types_map, auth_settings, _return_http_data_only, collection_formats, _preload_content, _request_timeout, _host, _request_auth) @@ -383,7 +386,7 @@ class ApiClient(object): query_params, header_params, body, post_params, files, - response_type, + response_types_map, auth_settings, _return_http_data_only, collection_formats, diff --git a/samples/client/petstore/python-tornado/petstore_api/api/another_fake_api.py b/samples/client/petstore/python-tornado/petstore_api/api/another_fake_api.py index 562b9faa58f..6fdd4523647 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api/another_fake_api.py +++ b/samples/client/petstore/python-tornado/petstore_api/api/another_fake_api.py @@ -153,6 +153,10 @@ class AnotherFakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "Client", + } return self.api_client.call_api( '/another-fake/dummy', 'PATCH', @@ -162,7 +166,7 @@ class AnotherFakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Client', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/client/petstore/python-tornado/petstore_api/api/fake_api.py b/samples/client/petstore/python-tornado/petstore_api/api/fake_api.py index b171fe8b3d7..252a82c0ef4 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api/fake_api.py +++ b/samples/client/petstore/python-tornado/petstore_api/api/fake_api.py @@ -149,6 +149,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/create_xml_item', 'POST', @@ -158,7 +160,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -276,6 +278,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "bool", + } return self.api_client.call_api( '/fake/outer/boolean', 'POST', @@ -285,7 +291,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='bool', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -403,6 +409,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "OuterComposite", + } return self.api_client.call_api( '/fake/outer/composite', 'POST', @@ -412,7 +422,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='OuterComposite', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -530,6 +540,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "float", + } return self.api_client.call_api( '/fake/outer/number', 'POST', @@ -539,7 +553,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='float', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -657,6 +671,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "str", + } return self.api_client.call_api( '/fake/outer/string', 'POST', @@ -666,7 +684,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='str', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -788,6 +806,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/body-with-file-schema', 'PUT', @@ -797,7 +817,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -928,6 +948,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/body-with-query-params', 'PUT', @@ -937,7 +959,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1063,6 +1085,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "Client", + } return self.api_client.call_api( '/fake', 'PATCH', @@ -1072,7 +1098,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Client', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1325,6 +1351,8 @@ class FakeApi(object): # Authentication setting auth_settings = ['http_basic_test'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake', 'POST', @@ -1334,7 +1362,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1504,6 +1532,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake', 'GET', @@ -1513,7 +1543,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1674,6 +1704,8 @@ class FakeApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake', 'DELETE', @@ -1683,7 +1715,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1803,6 +1835,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/inline-additionalProperties', 'POST', @@ -1812,7 +1846,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1943,6 +1977,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/jsonFormData', 'GET', @@ -1952,7 +1988,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -2119,6 +2155,8 @@ class FakeApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/test-query-paramters', 'PUT', @@ -2128,7 +2166,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/client/petstore/python-tornado/petstore_api/api/fake_classname_tags_123_api.py b/samples/client/petstore/python-tornado/petstore_api/api/fake_classname_tags_123_api.py index 5cd44526149..f87835d7a61 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/client/petstore/python-tornado/petstore_api/api/fake_classname_tags_123_api.py @@ -153,6 +153,10 @@ class FakeClassnameTags123Api(object): # Authentication setting auth_settings = ['api_key_query'] # noqa: E501 + + response_types_map = { + 200: "Client", + } return self.api_client.call_api( '/fake_classname_test', 'PATCH', @@ -162,7 +166,7 @@ class FakeClassnameTags123Api(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Client', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/client/petstore/python-tornado/petstore_api/api/pet_api.py b/samples/client/petstore/python-tornado/petstore_api/api/pet_api.py index 3119e2d60c4..5baedc8e6d2 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api/pet_api.py +++ b/samples/client/petstore/python-tornado/petstore_api/api/pet_api.py @@ -147,6 +147,8 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/pet', 'POST', @@ -156,7 +158,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -279,6 +281,8 @@ class PetApi(object): body_params = None # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/pet/{petId}', 'DELETE', @@ -288,7 +292,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -411,6 +415,11 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = { + 200: "list[Pet]", + 400: None, + } return self.api_client.call_api( '/pet/findByStatus', 'GET', @@ -420,7 +429,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='list[Pet]', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -543,6 +552,11 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = { + 200: "list[Pet]", + 400: None, + } return self.api_client.call_api( '/pet/findByTags', 'GET', @@ -552,7 +566,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='list[Pet]', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -674,6 +688,12 @@ class PetApi(object): # Authentication setting auth_settings = ['api_key'] # noqa: E501 + + response_types_map = { + 200: "Pet", + 400: None, + 404: None, + } return self.api_client.call_api( '/pet/{petId}', 'GET', @@ -683,7 +703,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Pet', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -803,6 +823,8 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/pet', 'PUT', @@ -812,7 +834,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -946,6 +968,8 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/pet/{petId}', 'POST', @@ -955,7 +979,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1093,6 +1117,10 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = { + 200: "ApiResponse", + } return self.api_client.call_api( '/pet/{petId}/uploadImage', 'POST', @@ -1102,7 +1130,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='ApiResponse', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1244,6 +1272,10 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = { + 200: "ApiResponse", + } return self.api_client.call_api( '/fake/{petId}/uploadImageWithRequiredFile', 'POST', @@ -1253,7 +1285,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='ApiResponse', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/client/petstore/python-tornado/petstore_api/api/store_api.py b/samples/client/petstore/python-tornado/petstore_api/api/store_api.py index d2d4c323334..734d8e17dc9 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api/store_api.py +++ b/samples/client/petstore/python-tornado/petstore_api/api/store_api.py @@ -145,6 +145,8 @@ class StoreApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/store/order/{order_id}', 'DELETE', @@ -154,7 +156,7 @@ class StoreApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -265,6 +267,10 @@ class StoreApi(object): # Authentication setting auth_settings = ['api_key'] # noqa: E501 + + response_types_map = { + 200: "dict(str, int)", + } return self.api_client.call_api( '/store/inventory', 'GET', @@ -274,7 +280,7 @@ class StoreApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='dict(str, int)', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -400,6 +406,12 @@ class StoreApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "Order", + 400: None, + 404: None, + } return self.api_client.call_api( '/store/order/{order_id}', 'GET', @@ -409,7 +421,7 @@ class StoreApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Order', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -529,6 +541,11 @@ class StoreApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "Order", + 400: None, + } return self.api_client.call_api( '/store/order', 'POST', @@ -538,7 +555,7 @@ class StoreApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Order', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/client/petstore/python-tornado/petstore_api/api/user_api.py b/samples/client/petstore/python-tornado/petstore_api/api/user_api.py index 9504f2834a6..9f8be84771a 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api/user_api.py +++ b/samples/client/petstore/python-tornado/petstore_api/api/user_api.py @@ -145,6 +145,8 @@ class UserApi(object): body_params = local_var_params['body'] # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user', 'POST', @@ -154,7 +156,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -270,6 +272,8 @@ class UserApi(object): body_params = local_var_params['body'] # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/createWithArray', 'POST', @@ -279,7 +283,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -395,6 +399,8 @@ class UserApi(object): body_params = local_var_params['body'] # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/createWithList', 'POST', @@ -404,7 +410,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -522,6 +528,8 @@ class UserApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/{username}', 'DELETE', @@ -531,7 +539,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -651,6 +659,12 @@ class UserApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "User", + 400: None, + 404: None, + } return self.api_client.call_api( '/user/{username}', 'GET', @@ -660,7 +674,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='User', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -791,6 +805,11 @@ class UserApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "str", + 400: None, + } return self.api_client.call_api( '/user/login', 'GET', @@ -800,7 +819,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='str', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -905,6 +924,8 @@ class UserApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/logout', 'GET', @@ -914,7 +935,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1043,6 +1064,8 @@ class UserApi(object): body_params = local_var_params['body'] # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/{username}', 'PUT', @@ -1052,7 +1075,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/client/petstore/python-tornado/petstore_api/api_client.py b/samples/client/petstore/python-tornado/petstore_api/api_client.py index 7782745e509..4a309c6ae9e 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api_client.py +++ b/samples/client/petstore/python-tornado/petstore_api/api_client.py @@ -122,7 +122,7 @@ class ApiClient(object): def __call_api( self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None, post_params=None, - files=None, response_type=None, auth_settings=None, + files=None, response_types_map=None, auth_settings=None, _return_http_data_only=None, collection_formats=None, _preload_content=True, _request_timeout=None, _host=None, _request_auth=None): @@ -200,6 +200,8 @@ class ApiClient(object): if not _preload_content: raise tornado.gen.Return(return_data) + + response_type = response_types_map.get(response_data.status, None) if six.PY3 and response_type not in ["file", "bytes"]: match = None @@ -209,6 +211,7 @@ class ApiClient(object): response_data.data = response_data.data.decode(encoding) # deserialize response data + if response_type: return_data = self.deserialize(response_data, response_type) else: @@ -326,10 +329,10 @@ class ApiClient(object): def call_api(self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None, post_params=None, files=None, - response_type=None, auth_settings=None, async_req=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None, - _request_auth=None): + response_types_map=None, auth_settings=None, + async_req=None, _return_http_data_only=None, + collection_formats=None,_preload_content=True, + _request_timeout=None, _host=None, _request_auth=None): """Makes the HTTP request (synchronous) and returns deserialized data. To make an async_req request, set the async_req parameter. @@ -374,7 +377,7 @@ class ApiClient(object): return self.__call_api(resource_path, method, path_params, query_params, header_params, body, post_params, files, - response_type, auth_settings, + response_types_map, auth_settings, _return_http_data_only, collection_formats, _preload_content, _request_timeout, _host, _request_auth) @@ -384,7 +387,7 @@ class ApiClient(object): query_params, header_params, body, post_params, files, - response_type, + response_types_map, auth_settings, _return_http_data_only, collection_formats, diff --git a/samples/client/petstore/python/petstore_api/api/another_fake_api.py b/samples/client/petstore/python/petstore_api/api/another_fake_api.py index 562b9faa58f..6fdd4523647 100644 --- a/samples/client/petstore/python/petstore_api/api/another_fake_api.py +++ b/samples/client/petstore/python/petstore_api/api/another_fake_api.py @@ -153,6 +153,10 @@ class AnotherFakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "Client", + } return self.api_client.call_api( '/another-fake/dummy', 'PATCH', @@ -162,7 +166,7 @@ class AnotherFakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Client', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/client/petstore/python/petstore_api/api/fake_api.py b/samples/client/petstore/python/petstore_api/api/fake_api.py index b171fe8b3d7..252a82c0ef4 100644 --- a/samples/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/client/petstore/python/petstore_api/api/fake_api.py @@ -149,6 +149,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/create_xml_item', 'POST', @@ -158,7 +160,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -276,6 +278,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "bool", + } return self.api_client.call_api( '/fake/outer/boolean', 'POST', @@ -285,7 +291,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='bool', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -403,6 +409,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "OuterComposite", + } return self.api_client.call_api( '/fake/outer/composite', 'POST', @@ -412,7 +422,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='OuterComposite', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -530,6 +540,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "float", + } return self.api_client.call_api( '/fake/outer/number', 'POST', @@ -539,7 +553,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='float', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -657,6 +671,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "str", + } return self.api_client.call_api( '/fake/outer/string', 'POST', @@ -666,7 +684,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='str', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -788,6 +806,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/body-with-file-schema', 'PUT', @@ -797,7 +817,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -928,6 +948,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/body-with-query-params', 'PUT', @@ -937,7 +959,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1063,6 +1085,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "Client", + } return self.api_client.call_api( '/fake', 'PATCH', @@ -1072,7 +1098,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Client', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1325,6 +1351,8 @@ class FakeApi(object): # Authentication setting auth_settings = ['http_basic_test'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake', 'POST', @@ -1334,7 +1362,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1504,6 +1532,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake', 'GET', @@ -1513,7 +1543,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1674,6 +1704,8 @@ class FakeApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake', 'DELETE', @@ -1683,7 +1715,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1803,6 +1835,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/inline-additionalProperties', 'POST', @@ -1812,7 +1846,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1943,6 +1977,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/jsonFormData', 'GET', @@ -1952,7 +1988,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -2119,6 +2155,8 @@ class FakeApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/test-query-paramters', 'PUT', @@ -2128,7 +2166,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py b/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py index 5cd44526149..f87835d7a61 100644 --- a/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py @@ -153,6 +153,10 @@ class FakeClassnameTags123Api(object): # Authentication setting auth_settings = ['api_key_query'] # noqa: E501 + + response_types_map = { + 200: "Client", + } return self.api_client.call_api( '/fake_classname_test', 'PATCH', @@ -162,7 +166,7 @@ class FakeClassnameTags123Api(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Client', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/client/petstore/python/petstore_api/api/pet_api.py b/samples/client/petstore/python/petstore_api/api/pet_api.py index 3119e2d60c4..5baedc8e6d2 100644 --- a/samples/client/petstore/python/petstore_api/api/pet_api.py +++ b/samples/client/petstore/python/petstore_api/api/pet_api.py @@ -147,6 +147,8 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/pet', 'POST', @@ -156,7 +158,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -279,6 +281,8 @@ class PetApi(object): body_params = None # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/pet/{petId}', 'DELETE', @@ -288,7 +292,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -411,6 +415,11 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = { + 200: "list[Pet]", + 400: None, + } return self.api_client.call_api( '/pet/findByStatus', 'GET', @@ -420,7 +429,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='list[Pet]', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -543,6 +552,11 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = { + 200: "list[Pet]", + 400: None, + } return self.api_client.call_api( '/pet/findByTags', 'GET', @@ -552,7 +566,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='list[Pet]', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -674,6 +688,12 @@ class PetApi(object): # Authentication setting auth_settings = ['api_key'] # noqa: E501 + + response_types_map = { + 200: "Pet", + 400: None, + 404: None, + } return self.api_client.call_api( '/pet/{petId}', 'GET', @@ -683,7 +703,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Pet', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -803,6 +823,8 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/pet', 'PUT', @@ -812,7 +834,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -946,6 +968,8 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/pet/{petId}', 'POST', @@ -955,7 +979,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1093,6 +1117,10 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = { + 200: "ApiResponse", + } return self.api_client.call_api( '/pet/{petId}/uploadImage', 'POST', @@ -1102,7 +1130,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='ApiResponse', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1244,6 +1272,10 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = { + 200: "ApiResponse", + } return self.api_client.call_api( '/fake/{petId}/uploadImageWithRequiredFile', 'POST', @@ -1253,7 +1285,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='ApiResponse', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/client/petstore/python/petstore_api/api/store_api.py b/samples/client/petstore/python/petstore_api/api/store_api.py index d2d4c323334..734d8e17dc9 100644 --- a/samples/client/petstore/python/petstore_api/api/store_api.py +++ b/samples/client/petstore/python/petstore_api/api/store_api.py @@ -145,6 +145,8 @@ class StoreApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/store/order/{order_id}', 'DELETE', @@ -154,7 +156,7 @@ class StoreApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -265,6 +267,10 @@ class StoreApi(object): # Authentication setting auth_settings = ['api_key'] # noqa: E501 + + response_types_map = { + 200: "dict(str, int)", + } return self.api_client.call_api( '/store/inventory', 'GET', @@ -274,7 +280,7 @@ class StoreApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='dict(str, int)', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -400,6 +406,12 @@ class StoreApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "Order", + 400: None, + 404: None, + } return self.api_client.call_api( '/store/order/{order_id}', 'GET', @@ -409,7 +421,7 @@ class StoreApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Order', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -529,6 +541,11 @@ class StoreApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "Order", + 400: None, + } return self.api_client.call_api( '/store/order', 'POST', @@ -538,7 +555,7 @@ class StoreApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Order', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/client/petstore/python/petstore_api/api/user_api.py b/samples/client/petstore/python/petstore_api/api/user_api.py index 9504f2834a6..9f8be84771a 100644 --- a/samples/client/petstore/python/petstore_api/api/user_api.py +++ b/samples/client/petstore/python/petstore_api/api/user_api.py @@ -145,6 +145,8 @@ class UserApi(object): body_params = local_var_params['body'] # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user', 'POST', @@ -154,7 +156,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -270,6 +272,8 @@ class UserApi(object): body_params = local_var_params['body'] # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/createWithArray', 'POST', @@ -279,7 +283,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -395,6 +399,8 @@ class UserApi(object): body_params = local_var_params['body'] # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/createWithList', 'POST', @@ -404,7 +410,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -522,6 +528,8 @@ class UserApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/{username}', 'DELETE', @@ -531,7 +539,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -651,6 +659,12 @@ class UserApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "User", + 400: None, + 404: None, + } return self.api_client.call_api( '/user/{username}', 'GET', @@ -660,7 +674,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='User', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -791,6 +805,11 @@ class UserApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "str", + 400: None, + } return self.api_client.call_api( '/user/login', 'GET', @@ -800,7 +819,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='str', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -905,6 +924,8 @@ class UserApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/logout', 'GET', @@ -914,7 +935,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1043,6 +1064,8 @@ class UserApi(object): body_params = local_var_params['body'] # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/{username}', 'PUT', @@ -1052,7 +1075,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/client/petstore/python/petstore_api/api_client.py b/samples/client/petstore/python/petstore_api/api_client.py index 80dbae6b7b8..afaf1427d31 100644 --- a/samples/client/petstore/python/petstore_api/api_client.py +++ b/samples/client/petstore/python/petstore_api/api_client.py @@ -120,7 +120,7 @@ class ApiClient(object): def __call_api( self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None, post_params=None, - files=None, response_type=None, auth_settings=None, + files=None, response_types_map=None, auth_settings=None, _return_http_data_only=None, collection_formats=None, _preload_content=True, _request_timeout=None, _host=None, _request_auth=None): @@ -198,6 +198,8 @@ class ApiClient(object): if not _preload_content: return return_data + + response_type = response_types_map.get(response_data.status, None) if six.PY3 and response_type not in ["file", "bytes"]: match = None @@ -207,6 +209,7 @@ class ApiClient(object): response_data.data = response_data.data.decode(encoding) # deserialize response data + if response_type: return_data = self.deserialize(response_data, response_type) else: @@ -324,10 +327,10 @@ class ApiClient(object): def call_api(self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None, post_params=None, files=None, - response_type=None, auth_settings=None, async_req=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None, - _request_auth=None): + response_types_map=None, auth_settings=None, + async_req=None, _return_http_data_only=None, + collection_formats=None,_preload_content=True, + _request_timeout=None, _host=None, _request_auth=None): """Makes the HTTP request (synchronous) and returns deserialized data. To make an async_req request, set the async_req parameter. @@ -372,7 +375,7 @@ class ApiClient(object): return self.__call_api(resource_path, method, path_params, query_params, header_params, body, post_params, files, - response_type, auth_settings, + response_types_map, auth_settings, _return_http_data_only, collection_formats, _preload_content, _request_timeout, _host, _request_auth) @@ -382,7 +385,7 @@ class ApiClient(object): query_params, header_params, body, post_params, files, - response_type, + response_types_map, auth_settings, _return_http_data_only, collection_formats, diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py index ffb18035db5..af8d8fd0f25 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py @@ -153,6 +153,10 @@ class AnotherFakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "Client", + } return self.api_client.call_api( '/another-fake/dummy', 'PATCH', @@ -162,7 +166,7 @@ class AnotherFakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Client', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py index 73fa9805275..98554918aae 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py @@ -136,6 +136,9 @@ class DefaultApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + } return self.api_client.call_api( '/foo', 'GET', @@ -145,7 +148,7 @@ class DefaultApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='InlineResponseDefault', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py index b484f561d5f..a5038873bb4 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py @@ -136,6 +136,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "HealthCheckResult", + } return self.api_client.call_api( '/fake/health', 'GET', @@ -145,7 +149,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='HealthCheckResult', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -279,6 +283,8 @@ class FakeApi(object): # Authentication setting auth_settings = ['http_signature_test'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/http-signature-test', 'GET', @@ -288,7 +294,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -410,6 +416,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "bool", + } return self.api_client.call_api( '/fake/outer/boolean', 'POST', @@ -419,7 +429,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='bool', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -541,6 +551,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "OuterComposite", + } return self.api_client.call_api( '/fake/outer/composite', 'POST', @@ -550,7 +564,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='OuterComposite', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -672,6 +686,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "float", + } return self.api_client.call_api( '/fake/outer/number', 'POST', @@ -681,7 +699,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='float', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -803,6 +821,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "str", + } return self.api_client.call_api( '/fake/outer/string', 'POST', @@ -812,7 +834,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='str', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -934,6 +956,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/body-with-file-schema', 'PUT', @@ -943,7 +967,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1074,6 +1098,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/body-with-query-params', 'PUT', @@ -1083,7 +1109,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1209,6 +1235,10 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "Client", + } return self.api_client.call_api( '/fake', 'PATCH', @@ -1218,7 +1248,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Client', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1471,6 +1501,8 @@ class FakeApi(object): # Authentication setting auth_settings = ['http_basic_test'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake', 'POST', @@ -1480,7 +1512,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1650,6 +1682,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake', 'GET', @@ -1659,7 +1693,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1820,6 +1854,8 @@ class FakeApi(object): body_params = None # Authentication setting auth_settings = ['bearer_test'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake', 'DELETE', @@ -1829,7 +1865,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1949,6 +1985,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/inline-additionalProperties', 'POST', @@ -1958,7 +1996,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -2089,6 +2127,8 @@ class FakeApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/jsonFormData', 'GET', @@ -2098,7 +2138,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -2265,6 +2305,8 @@ class FakeApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/fake/test-query-paramters', 'PUT', @@ -2274,7 +2316,7 @@ class FakeApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py index 9295236c569..533f8b80d89 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py @@ -153,6 +153,10 @@ class FakeClassnameTags123Api(object): # Authentication setting auth_settings = ['api_key_query'] # noqa: E501 + + response_types_map = { + 200: "Client", + } return self.api_client.call_api( '/fake_classname_test', 'PATCH', @@ -162,7 +166,7 @@ class FakeClassnameTags123Api(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Client', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py index 468267e7872..6a9d01e4649 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py @@ -160,6 +160,8 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/pet', 'POST', @@ -169,7 +171,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -293,6 +295,8 @@ class PetApi(object): body_params = None # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/pet/{petId}', 'DELETE', @@ -302,7 +306,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -425,6 +429,11 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = { + 200: "list[Pet]", + 400: None, + } return self.api_client.call_api( '/pet/findByStatus', 'GET', @@ -434,7 +443,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='list[Pet]', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -557,6 +566,11 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = { + 200: "list[Pet]", + 400: None, + } return self.api_client.call_api( '/pet/findByTags', 'GET', @@ -566,7 +580,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='list[Pet]', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -688,6 +702,12 @@ class PetApi(object): # Authentication setting auth_settings = ['api_key'] # noqa: E501 + + response_types_map = { + 200: "Pet", + 400: None, + 404: None, + } return self.api_client.call_api( '/pet/{petId}', 'GET', @@ -697,7 +717,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Pet', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -830,6 +850,8 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/pet', 'PUT', @@ -839,7 +861,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -974,6 +996,8 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/pet/{petId}', 'POST', @@ -983,7 +1007,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1121,6 +1145,10 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = { + 200: "ApiResponse", + } return self.api_client.call_api( '/pet/{petId}/uploadImage', 'POST', @@ -1130,7 +1158,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='ApiResponse', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1272,6 +1300,10 @@ class PetApi(object): # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 + + response_types_map = { + 200: "ApiResponse", + } return self.api_client.call_api( '/fake/{petId}/uploadImageWithRequiredFile', 'POST', @@ -1281,7 +1313,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='ApiResponse', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py index ea01f1b53ff..2b22e137186 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py @@ -145,6 +145,8 @@ class StoreApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/store/order/{order_id}', 'DELETE', @@ -154,7 +156,7 @@ class StoreApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -265,6 +267,10 @@ class StoreApi(object): # Authentication setting auth_settings = ['api_key'] # noqa: E501 + + response_types_map = { + 200: "dict(str, int)", + } return self.api_client.call_api( '/store/inventory', 'GET', @@ -274,7 +280,7 @@ class StoreApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='dict(str, int)', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -400,6 +406,12 @@ class StoreApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "Order", + 400: None, + 404: None, + } return self.api_client.call_api( '/store/order/{order_id}', 'GET', @@ -409,7 +421,7 @@ class StoreApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Order', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -533,6 +545,11 @@ class StoreApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "Order", + 400: None, + } return self.api_client.call_api( '/store/order', 'POST', @@ -542,7 +559,7 @@ class StoreApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='Order', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py index d0c057dba19..a0a25e7bcbc 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py @@ -149,6 +149,8 @@ class UserApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user', 'POST', @@ -158,7 +160,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -278,6 +280,8 @@ class UserApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/createWithArray', 'POST', @@ -287,7 +291,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -407,6 +411,8 @@ class UserApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/createWithList', 'POST', @@ -416,7 +422,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -534,6 +540,8 @@ class UserApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/{username}', 'DELETE', @@ -543,7 +551,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -663,6 +671,12 @@ class UserApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "User", + 400: None, + 404: None, + } return self.api_client.call_api( '/user/{username}', 'GET', @@ -672,7 +686,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='User', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -803,6 +817,11 @@ class UserApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = { + 200: "str", + 400: None, + } return self.api_client.call_api( '/user/login', 'GET', @@ -812,7 +831,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type='str', # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -917,6 +936,8 @@ class UserApi(object): body_params = None # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/logout', 'GET', @@ -926,7 +947,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 @@ -1059,6 +1080,8 @@ class UserApi(object): # Authentication setting auth_settings = [] # noqa: E501 + + response_types_map = {} return self.api_client.call_api( '/user/{username}', 'PUT', @@ -1068,7 +1091,7 @@ class UserApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, # noqa: E501 + response_types_map=response_types_map, auth_settings=auth_settings, async_req=local_var_params.get('async_req'), _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 diff --git a/samples/openapi3/client/petstore/python/petstore_api/api_client.py b/samples/openapi3/client/petstore/python/petstore_api/api_client.py index 80dbae6b7b8..afaf1427d31 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_client.py @@ -120,7 +120,7 @@ class ApiClient(object): def __call_api( self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None, post_params=None, - files=None, response_type=None, auth_settings=None, + files=None, response_types_map=None, auth_settings=None, _return_http_data_only=None, collection_formats=None, _preload_content=True, _request_timeout=None, _host=None, _request_auth=None): @@ -198,6 +198,8 @@ class ApiClient(object): if not _preload_content: return return_data + + response_type = response_types_map.get(response_data.status, None) if six.PY3 and response_type not in ["file", "bytes"]: match = None @@ -207,6 +209,7 @@ class ApiClient(object): response_data.data = response_data.data.decode(encoding) # deserialize response data + if response_type: return_data = self.deserialize(response_data, response_type) else: @@ -324,10 +327,10 @@ class ApiClient(object): def call_api(self, resource_path, method, path_params=None, query_params=None, header_params=None, body=None, post_params=None, files=None, - response_type=None, auth_settings=None, async_req=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None, - _request_auth=None): + response_types_map=None, auth_settings=None, + async_req=None, _return_http_data_only=None, + collection_formats=None,_preload_content=True, + _request_timeout=None, _host=None, _request_auth=None): """Makes the HTTP request (synchronous) and returns deserialized data. To make an async_req request, set the async_req parameter. @@ -372,7 +375,7 @@ class ApiClient(object): return self.__call_api(resource_path, method, path_params, query_params, header_params, body, post_params, files, - response_type, auth_settings, + response_types_map, auth_settings, _return_http_data_only, collection_formats, _preload_content, _request_timeout, _host, _request_auth) @@ -382,7 +385,7 @@ class ApiClient(object): query_params, header_params, body, post_params, files, - response_type, + response_types_map, auth_settings, _return_http_data_only, collection_formats,