From 41caec228af95e454f2fecf1ff858398ab077a51 Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 9 May 2023 10:22:16 -0700 Subject: [PATCH 1/2] Sample regen --- .../.openapi-generator/FILES | 7 -- .../src/openapi_client/__init__.py | 2 - .../src/openapi_client/api_client.py | 82 ++++++++++++++++++- .../src/openapi_client/apis/paths/pet.py | 2 - .../apis/paths/pet_find_by_status.py | 2 - .../apis/paths/pet_find_by_tags.py | 2 - .../openapi_client/apis/paths/pet_pet_id.py | 2 - .../apis/paths/pet_pet_id_upload_image.py | 2 - .../apis/paths/store_inventory.py | 2 - .../openapi_client/apis/paths/store_order.py | 2 - .../apis/paths/store_order_order_id.py | 2 - .../src/openapi_client/apis/paths/user.py | 2 - .../apis/paths/user_create_with_array.py | 2 - .../apis/paths/user_create_with_list.py | 2 - .../openapi_client/apis/paths/user_login.py | 2 - .../openapi_client/apis/paths/user_logout.py | 2 - .../apis/paths/user_username.py | 2 - .../src/openapi_client/apis/tags/pet_api.py | 2 - .../src/openapi_client/apis/tags/store_api.py | 2 - .../src/openapi_client/apis/tags/user_api.py | 2 - .../request_body_pet/__init__.py | 5 +- .../content/application_json/schema.py | 2 - .../content/application_xml/schema.py | 2 - .../request_body_user_array/__init__.py | 5 +- .../content/application_json/schema.py | 2 - .../components/schema/api_response.py | 2 - .../components/schema/category.py | 2 - .../openapi_client/components/schema/order.py | 2 - .../openapi_client/components/schema/pet.py | 2 - .../openapi_client/components/schema/tag.py | 2 - .../openapi_client/components/schema/user.py | 2 - .../security_scheme_api_key.py | 2 - .../security_scheme_petstore_auth.py | 2 - .../configurations/api_configuration.py | 2 - .../configurations/schema_configuration.py | 2 - .../src/openapi_client/exceptions.py | 2 - .../paths/pet/post/operation.py | 42 +++------- .../paths/pet/post/request_body/__init__.py | 2 - .../post/responses/response_200/__init__.py | 2 - .../content/application_json/schema.py | 2 - .../content/application_xml/schema.py | 2 - .../post/responses/response_405/__init__.py | 2 - .../security/security_requirement_object_0.py | 2 - .../openapi_client/paths/pet/put/operation.py | 42 +++------- .../paths/pet/put/request_body/__init__.py | 2 - .../put/responses/response_200/__init__.py | 2 - .../content/application_json/schema.py | 2 - .../content/application_xml/schema.py | 2 - .../put/responses/response_400/__init__.py | 2 - .../put/responses/response_404/__init__.py | 2 - .../put/responses/response_405/__init__.py | 2 - .../security/security_requirement_object_0.py | 2 - .../paths/pet_find_by_status/get/operation.py | 44 +++------- .../get/parameters/parameter_0/__init__.py | 2 - .../get/parameters/parameter_0/schema.py | 2 - .../get/responses/response_200/__init__.py | 2 - .../content/application_json/schema.py | 2 - .../content/application_xml/schema.py | 2 - .../get/responses/response_400/__init__.py | 2 - .../security/security_requirement_object_0.py | 2 - .../paths/pet_find_by_tags/get/operation.py | 44 +++------- .../get/parameters/parameter_0/__init__.py | 2 - .../get/parameters/parameter_0/schema.py | 2 - .../get/responses/response_200/__init__.py | 2 - .../content/application_json/schema.py | 2 - .../content/application_xml/schema.py | 2 - .../get/responses/response_400/__init__.py | 2 - .../security/security_requirement_object_0.py | 2 - .../paths/pet_pet_id/delete/operation.py | 54 ++++-------- .../delete/parameters/parameter_0/__init__.py | 2 - .../delete/parameters/parameter_0/schema.py | 2 - .../delete/parameters/parameter_1/__init__.py | 2 - .../delete/parameters/parameter_1/schema.py | 2 - .../delete/responses/response_400/__init__.py | 2 - .../security/security_requirement_object_0.py | 2 - .../paths/pet_pet_id/get/operation.py | 44 +++------- .../get/parameters/parameter_0/__init__.py | 2 - .../get/parameters/parameter_0/schema.py | 2 - .../get/responses/response_200/__init__.py | 2 - .../content/application_json/schema.py | 2 - .../content/application_xml/schema.py | 2 - .../get/responses/response_400/__init__.py | 2 - .../get/responses/response_404/__init__.py | 2 - .../security/security_requirement_object_0.py | 2 - .../paths/pet_pet_id/post/operation.py | 56 ++++--------- .../post/parameters/parameter_0/__init__.py | 2 - .../post/parameters/parameter_0/schema.py | 2 - .../pet_pet_id/post/request_body/__init__.py | 5 +- .../schema.py | 2 - .../post/responses/response_405/__init__.py | 2 - .../security/security_requirement_object_0.py | 2 - .../pet_pet_id_upload_image/post/operation.py | 59 ++++--------- .../post/parameters/parameter_0/__init__.py | 2 - .../post/parameters/parameter_0/schema.py | 2 - .../post/request_body/__init__.py | 5 +- .../content/multipart_form_data/schema.py | 2 - .../post/responses/response_200/__init__.py | 2 - .../content/application_json/schema.py | 2 - .../security/security_requirement_object_0.py | 2 - .../paths/store_inventory/get/operation.py | 23 +----- .../get/responses/response_200/__init__.py | 2 - .../content/application_json/schema.py | 2 - .../security/security_requirement_object_0.py | 2 - .../paths/store_order/post/operation.py | 42 +++------- .../store_order/post/request_body/__init__.py | 5 +- .../content/application_json/schema.py | 2 - .../post/responses/response_200/__init__.py | 2 - .../content/application_json/schema.py | 2 - .../content/application_xml/schema.py | 2 - .../post/responses/response_400/__init__.py | 2 - .../store_order_order_id/delete/operation.py | 37 ++------- .../delete/parameters/parameter_0/__init__.py | 2 - .../delete/parameters/parameter_0/schema.py | 2 - .../delete/responses/response_400/__init__.py | 2 - .../delete/responses/response_404/__init__.py | 2 - .../store_order_order_id/get/operation.py | 44 +++------- .../get/parameters/parameter_0/__init__.py | 2 - .../get/parameters/parameter_0/schema.py | 2 - .../get/responses/response_200/__init__.py | 2 - .../content/application_json/schema.py | 2 - .../content/application_xml/schema.py | 2 - .../get/responses/response_400/__init__.py | 2 - .../get/responses/response_404/__init__.py | 2 - .../paths/user/post/operation.py | 37 ++------- .../paths/user/post/request_body/__init__.py | 5 +- .../content/application_json/schema.py | 2 - .../responses/response_default/__init__.py | 2 - .../security/security_requirement_object_0.py | 2 - .../user_create_with_array/post/operation.py | 37 ++------- .../post/request_body/__init__.py | 2 - .../responses/response_default/__init__.py | 2 - .../security/security_requirement_object_0.py | 2 - .../user_create_with_list/post/operation.py | 37 ++------- .../post/request_body/__init__.py | 2 - .../responses/response_default/__init__.py | 2 - .../security/security_requirement_object_0.py | 2 - .../paths/user_login/get/operation.py | 44 +++------- .../get/parameters/parameter_0/__init__.py | 2 - .../get/parameters/parameter_0/schema.py | 2 - .../get/parameters/parameter_1/__init__.py | 2 - .../get/parameters/parameter_1/schema.py | 2 - .../get/responses/response_200/__init__.py | 2 - .../content/application_json/schema.py | 2 - .../content/application_xml/schema.py | 2 - .../headers/header_set_cookie/__init__.py | 2 - .../headers/header_set_cookie/schema.py | 2 - .../header_x_expires_after/__init__.py | 2 - .../headers/header_x_expires_after/schema.py | 2 - .../headers/header_x_rate_limit/__init__.py | 2 - .../headers/header_x_rate_limit/schema.py | 2 - .../get/responses/response_400/__init__.py | 2 - .../paths/user_logout/get/operation.py | 16 +--- .../responses/response_default/__init__.py | 2 - .../security/security_requirement_object_0.py | 2 - .../paths/user_username/delete/operation.py | 37 ++------- .../delete/parameters/parameter_0/__init__.py | 2 - .../delete/parameters/parameter_0/schema.py | 2 - .../delete/responses/response_400/__init__.py | 2 - .../delete/responses/response_404/__init__.py | 2 - .../security/security_requirement_object_0.py | 2 - .../paths/user_username/get/operation.py | 44 +++------- .../get/parameters/parameter_0/__init__.py | 2 - .../get/parameters/parameter_0/schema.py | 2 - .../get/responses/response_200/__init__.py | 2 - .../content/application_json/schema.py | 2 - .../content/application_xml/schema.py | 2 - .../get/responses/response_400/__init__.py | 2 - .../get/responses/response_404/__init__.py | 2 - .../paths/user_username/put/operation.py | 58 ++++--------- .../put/parameters/parameter_0/__init__.py | 2 - .../put/parameters/parameter_0/schema.py | 2 - .../put/request_body/__init__.py | 5 +- .../content/application_json/schema.py | 2 - .../put/responses/response_400/__init__.py | 2 - .../put/responses/response_404/__init__.py | 2 - .../security/security_requirement_object_0.py | 2 - .../src/openapi_client/rest.py | 2 - .../src/openapi_client/schemas.py | 2 - .../src/openapi_client/security_schemes.py | 2 - .../src/openapi_client/server.py | 2 - .../src/openapi_client/servers/server_0.py | 2 - .../test/test_paths/test_pet/test_post.py | 2 - .../test/test_paths/test_pet/test_put.py | 2 - .../test_pet_find_by_status/test_get.py | 2 - .../test_pet_find_by_tags/test_get.py | 2 - .../test_paths/test_pet_pet_id/test_delete.py | 2 - .../test_paths/test_pet_pet_id/test_get.py | 2 - .../test_paths/test_pet_pet_id/test_post.py | 2 - .../test_pet_pet_id_upload_image/test_post.py | 2 - .../test_store_inventory/test_get.py | 2 - .../test_paths/test_store_order/test_post.py | 2 - .../test_store_order_order_id/test_delete.py | 2 - .../test_store_order_order_id/test_get.py | 2 - .../test/test_paths/test_user/test_post.py | 2 - .../test_user_create_with_array/test_post.py | 2 - .../test_user_create_with_list/test_post.py | 2 - .../test_paths/test_user_login/test_get.py | 2 - .../test_paths/test_user_logout/test_get.py | 2 - .../test_user_username/test_delete.py | 2 - .../test_paths/test_user_username/test_get.py | 2 - .../test_paths/test_user_username/test_put.py | 2 - 201 files changed, 290 insertions(+), 1019 deletions(-) diff --git a/petstore/openapi_json_schema_generator_python/.openapi-generator/FILES b/petstore/openapi_json_schema_generator_python/.openapi-generator/FILES index 965bc9f..55a48ba 100644 --- a/petstore/openapi_json_schema_generator_python/.openapi-generator/FILES +++ b/petstore/openapi_json_schema_generator_python/.openapi-generator/FILES @@ -1,6 +1,5 @@ .gitignore .gitlab-ci.yml -.openapi-generator-ignore .travis.yml README.md docs/apis/tags/pet_api.md @@ -366,12 +365,6 @@ test-requirements.txt test/__init__.py test/components/__init__.py test/components/schema/__init__.py -test/components/schema/test_api_response.py -test/components/schema/test_category.py -test/components/schema/test_order.py -test/components/schema/test_pet.py -test/components/schema/test_tag.py -test/components/schema/test_user.py test/test_paths/__init__.py test/test_paths/__init__.py test/test_paths/__init__.py diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/__init__.py index 3233587..2a55034 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/__init__.py @@ -4,9 +4,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/api_client.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/api_client.py index cc450b5..312129a 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/api_client.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/api_client.py @@ -1,9 +1,7 @@ # coding: utf-8 """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ @@ -1156,6 +1154,86 @@ class Api(TypedDictInputVerifier): """ api_client: ApiClient = dataclasses.field(default_factory=lambda: ApiClient()) + @staticmethod + def _get_used_path( + used_path: str, + path_parameters: typing.Tuple[typing.Type[PathParameter], ...] = (), + path_params: typing.Dict[str, typing.Any] = frozendict.frozendict(), + query_parameters: typing.Tuple[typing.Type[QueryParameter], ...] = (), + query_params: typing.Dict[str, typing.Any] = frozendict.frozendict(), + ) -> str: + used_path_params = {} + for parameter in path_parameters: + parameter_data = path_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + used_path_params.update(serialized_data) + + for k, v in used_path_params.items(): + used_path = used_path.replace('{%s}' % k, v) + + prefix_separator_iterator = None + for parameter in query_parameters: + parameter_data = query_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + if prefix_separator_iterator is None: + prefix_separator_iterator = parameter.get_prefix_separator_iterator() + serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) + for serialized_value in serialized_data.values(): + used_path += serialized_value + return used_path + + @staticmethod + def _get_headers( + header_parameters: typing.Tuple[typing.Type[HeaderParameter], ...] = (), + header_params: typing.Dict[str, typing.Any] = frozendict.frozendict(), + accept_content_types: typing.Tuple[str] = (), + ) -> _collections.HTTPHeaderDict: + headers = _collections.HTTPHeaderDict() + for parameter in header_parameters: + parameter_data = header_params.get(parameter.name, schemas.unset) + if parameter_data is schemas.unset: + continue + serialized_data = parameter.serialize(parameter_data) + headers.extend(serialized_data) + if accept_content_types: + for accept_content_type in accept_content_types: + headers.add('Accept', accept_content_type) + return headers + + @staticmethod + def _get_fields_and_body( + request_body: 'RequestBody', + body: typing.Any, + headers: _collections.HTTPHeaderDict, + content_type: str + ): + if request_body.required and body is schemas.unset: + raise exceptions.ApiValueError( + 'The required body parameter has an invalid value of: unset. Set a valid value instead') + _fields = None + _body = None + + if request_body.required or ((not request_body.required) and body is not schemas.unset): + serialized_data = request_body.serialize(body, content_type) + headers.add('Content-Type', content_type) + if 'fields' in serialized_data: + _fields = serialized_data['fields'] + elif 'body' in serialized_data: + _body = serialized_data['body'] + return _fields, _body + + @staticmethod + def _verify_response_status(api_response: 'ApiResponse'): + if not 200 <= api_response.response.status <= 399: + raise exceptions.ApiException( + status=api_response.response.status, + reason=api_response.response.reason, + api_response=api_response + ) + class SerializedRequestBody(typing_extensions.TypedDict, total=False): body: typing.Union[str, bytes] diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet.py index 811b95d..f2e0156 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet_find_by_status.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet_find_by_status.py index 6ae1f44..309bec6 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet_find_by_status.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet_find_by_status.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet_find_by_tags.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet_find_by_tags.py index f686c7c..85886a0 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet_find_by_tags.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet_find_by_tags.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet_pet_id.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet_pet_id.py index 48cbda0..20b4cfd 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet_pet_id.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet_pet_id.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet_pet_id_upload_image.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet_pet_id_upload_image.py index 5f0aa4f..57c4494 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet_pet_id_upload_image.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/pet_pet_id_upload_image.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/store_inventory.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/store_inventory.py index 1300159..343e380 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/store_inventory.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/store_inventory.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/store_order.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/store_order.py index 0e99157..5c8f288 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/store_order.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/store_order.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/store_order_order_id.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/store_order_order_id.py index cc6cc6d..490abf3 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/store_order_order_id.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/store_order_order_id.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user.py index 5256d87..6f73d7a 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_create_with_array.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_create_with_array.py index 3366752..72fbd6b 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_create_with_array.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_create_with_array.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_create_with_list.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_create_with_list.py index b0db9d8..b6681f3 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_create_with_list.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_create_with_list.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_login.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_login.py index 6fcfe73..05aadf0 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_login.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_login.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_logout.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_logout.py index ace472f..27c037d 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_logout.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_logout.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_username.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_username.py index 6a9586c..6bbe1c0 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_username.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/paths/user_username.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/tags/pet_api.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/tags/pet_api.py index 17a9af2..e24536f 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/tags/pet_api.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/tags/pet_api.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/tags/store_api.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/tags/store_api.py index 026f400..dadad3c 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/tags/store_api.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/tags/store_api.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/tags/user_api.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/tags/user_api.py index cccbc81..55f8030 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/tags/user_api.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/apis/tags/user_api.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_pet/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_pet/__init__.py index bbd09ec..ad34d8a 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_pet/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_pet/__init__.py @@ -1,13 +1,10 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -import typing -import typing_extensions +import typing, typing_extensions from openapi_client import api_client from .content.application_json import schema as application_json_schema diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_pet/content/application_json/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_pet/content/application_json/schema.py index 0a089af..6e41c98 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_pet/content/application_json/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_pet/content/application_json/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_pet/content/application_xml/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_pet/content/application_xml/schema.py index 0a089af..6e41c98 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_pet/content/application_xml/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_pet/content/application_xml/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_user_array/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_user_array/__init__.py index 87ca549..304c7f1 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_user_array/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_user_array/__init__.py @@ -1,13 +1,10 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -import typing -import typing_extensions +import typing, typing_extensions from openapi_client import api_client from .content.application_json import schema as application_json_schema diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_user_array/content/application_json/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_user_array/content/application_json/schema.py index 52a36e8..8278494 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_user_array/content/application_json/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/request_bodies/request_body_user_array/content/application_json/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/api_response.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/api_response.py index 3db3588..0d6bcdc 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/api_response.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/api_response.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/category.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/category.py index cc3d35e..7690499 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/category.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/category.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/order.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/order.py index 3c859c8..7434368 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/order.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/order.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/pet.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/pet.py index 144478d..6fc2818 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/pet.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/pet.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/tag.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/tag.py index 200bab0..e9c80c6 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/tag.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/tag.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/user.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/user.py index 8f9f99f..e23cabc 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/user.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/schema/user.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/security_schemes/security_scheme_api_key.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/security_schemes/security_scheme_api_key.py index a3e336e..95e9013 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/security_schemes/security_scheme_api_key.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/security_schemes/security_scheme_api_key.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/security_schemes/security_scheme_petstore_auth.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/security_schemes/security_scheme_petstore_auth.py index 6137184..dd7d143 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/components/security_schemes/security_scheme_petstore_auth.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/components/security_schemes/security_scheme_petstore_auth.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/configurations/api_configuration.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/configurations/api_configuration.py index d828362..fdfbc5b 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/configurations/api_configuration.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/configurations/api_configuration.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/configurations/schema_configuration.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/configurations/schema_configuration.py index 5718461..c253e08 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/configurations/schema_configuration.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/configurations/schema_configuration.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/exceptions.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/exceptions.py index 333f5a5..444c835 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/exceptions.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/exceptions.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/operation.py index d7a5c50..0a27e66 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/operation.py @@ -1,21 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from openapi_client import api_client, exceptions, security_schemes +from openapi_client import api_client, security_schemes import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -172,24 +164,15 @@ def _add_pet( class instances """ used_path = path - - _headers = HTTPHeaderDict() + _headers = self._get_headers(accept_content_types=accept_content_types) # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body.RequestBody.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + + _fields, _body = self._get_fields_and_body( + request_body=request_body.RequestBody, + body=body, + headers=_headers, + content_type=content_type + ) host = self.api_client.configuration.get_server_url( 'servers', server_index ) @@ -225,12 +208,7 @@ class instances else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/request_body/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/request_body/__init__.py index 5899db1..7bd4026 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/request_body/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/request_body/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/responses/response_200/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/responses/response_200/__init__.py index 28e1774..81d0fa8 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/responses/response_200/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/responses/response_200/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/responses/response_200/content/application_json/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/responses/response_200/content/application_json/schema.py index 0a089af..6e41c98 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/responses/response_200/content/application_json/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/responses/response_200/content/application_json/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/responses/response_200/content/application_xml/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/responses/response_200/content/application_xml/schema.py index 0a089af..6e41c98 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/responses/response_200/content/application_xml/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/responses/response_200/content/application_xml/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/responses/response_405/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/responses/response_405/__init__.py index 850f7e8..fd44b57 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/responses/response_405/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/responses/response_405/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/security/security_requirement_object_0.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/security/security_requirement_object_0.py index ed74ea0..1b532c6 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/security/security_requirement_object_0.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/post/security/security_requirement_object_0.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/operation.py index 707aec3..2afa7f4 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/operation.py @@ -1,21 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from openapi_client import api_client, exceptions, security_schemes +from openapi_client import api_client, security_schemes import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -178,24 +170,15 @@ def _update_pet( class instances """ used_path = path - - _headers = HTTPHeaderDict() + _headers = self._get_headers(accept_content_types=accept_content_types) # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body.RequestBody.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + + _fields, _body = self._get_fields_and_body( + request_body=request_body.RequestBody, + body=body, + headers=_headers, + content_type=content_type + ) host = self.api_client.configuration.get_server_url( 'servers', server_index ) @@ -233,12 +216,7 @@ class instances else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/request_body/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/request_body/__init__.py index 5899db1..7bd4026 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/request_body/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/request_body/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_200/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_200/__init__.py index 28e1774..81d0fa8 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_200/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_200/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_200/content/application_json/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_200/content/application_json/schema.py index 0a089af..6e41c98 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_200/content/application_json/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_200/content/application_json/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_200/content/application_xml/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_200/content/application_xml/schema.py index 0a089af..6e41c98 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_200/content/application_xml/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_200/content/application_xml/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_400/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_400/__init__.py index c9cfe54..1ea383b 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_400/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_400/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_404/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_404/__init__.py index d131fe3..6c3b1ee 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_404/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_404/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_405/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_405/__init__.py index 850f7e8..fd44b57 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_405/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/responses/response_405/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/security/security_requirement_object_0.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/security/security_requirement_object_0.py index ed74ea0..1b532c6 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/security/security_requirement_object_0.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet/put/security/security_requirement_object_0.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/operation.py index c2017b4..cff8042 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/operation.py @@ -1,21 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from openapi_client import api_client, exceptions, security_schemes +from openapi_client import api_client, security_schemes import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -53,9 +45,9 @@ class Params(RequiredParams, OptionalParams): pass - parameters = [ + parameters = ( parameter_0.Parameter0, - ] + ) _security: typing.List[security_schemes.SecurityRequirementObject] = [ security_requirement_object_0.security_requirement_object, ] @@ -136,24 +128,13 @@ def _find_pets_by_status( class instances """ self._verify_typed_dict_inputs(RequestQueryParameters.Params, query_params) - used_path = path - - prefix_separator_iterator = None - for parameter in RequestQueryParameters.parameters: - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() + used_path = self._get_used_path( + path, + query_parameters=RequestQueryParameters.parameters, + query_params=query_params + ) + _headers = self._get_headers(accept_content_types=accept_content_types) # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) host = self.api_client.configuration.get_server_url( 'servers', server_index ) @@ -187,12 +168,7 @@ class instances else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/parameters/parameter_0/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/parameters/parameter_0/__init__.py index a84c6f2..2fa1d08 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/parameters/parameter_0/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/parameters/parameter_0/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/parameters/parameter_0/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/parameters/parameter_0/schema.py index 088ddf9..66b9bd8 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/parameters/parameter_0/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/parameters/parameter_0/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/responses/response_200/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/responses/response_200/__init__.py index 28e1774..81d0fa8 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/responses/response_200/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/responses/response_200/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/responses/response_200/content/application_json/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/responses/response_200/content/application_json/schema.py index 21f335d..d6b85c3 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/responses/response_200/content/application_json/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/responses/response_200/content/application_json/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/responses/response_200/content/application_xml/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/responses/response_200/content/application_xml/schema.py index 21f335d..d6b85c3 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/responses/response_200/content/application_xml/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/responses/response_200/content/application_xml/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/responses/response_400/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/responses/response_400/__init__.py index c9cfe54..1ea383b 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/responses/response_400/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/responses/response_400/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/security/security_requirement_object_0.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/security/security_requirement_object_0.py index c91f498..5f66479 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/security/security_requirement_object_0.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_status/get/security/security_requirement_object_0.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/operation.py index 0fdc55c..ce455db 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/operation.py @@ -1,21 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from openapi_client import api_client, exceptions, security_schemes +from openapi_client import api_client, security_schemes import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -53,9 +45,9 @@ class Params(RequiredParams, OptionalParams): pass - parameters = [ + parameters = ( parameter_0.Parameter0, - ] + ) _security: typing.List[security_schemes.SecurityRequirementObject] = [ security_requirement_object_0.security_requirement_object, ] @@ -136,24 +128,13 @@ def _find_pets_by_tags( class instances """ self._verify_typed_dict_inputs(RequestQueryParameters.Params, query_params) - used_path = path - - prefix_separator_iterator = None - for parameter in RequestQueryParameters.parameters: - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() + used_path = self._get_used_path( + path, + query_parameters=RequestQueryParameters.parameters, + query_params=query_params + ) + _headers = self._get_headers(accept_content_types=accept_content_types) # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) host = self.api_client.configuration.get_server_url( 'servers', server_index ) @@ -187,12 +168,7 @@ class instances else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/parameters/parameter_0/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/parameters/parameter_0/__init__.py index 5b28837..210f4af 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/parameters/parameter_0/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/parameters/parameter_0/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/parameters/parameter_0/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/parameters/parameter_0/schema.py index ba0239b..239a3cf 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/parameters/parameter_0/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/parameters/parameter_0/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/responses/response_200/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/responses/response_200/__init__.py index 28e1774..81d0fa8 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/responses/response_200/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/responses/response_200/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/responses/response_200/content/application_json/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/responses/response_200/content/application_json/schema.py index 21f335d..d6b85c3 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/responses/response_200/content/application_json/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/responses/response_200/content/application_json/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/responses/response_200/content/application_xml/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/responses/response_200/content/application_xml/schema.py index 21f335d..d6b85c3 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/responses/response_200/content/application_xml/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/responses/response_200/content/application_xml/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/responses/response_400/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/responses/response_400/__init__.py index c9cfe54..1ea383b 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/responses/response_400/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/responses/response_400/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/security/security_requirement_object_0.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/security/security_requirement_object_0.py index c91f498..5f66479 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/security/security_requirement_object_0.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_find_by_tags/get/security/security_requirement_object_0.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/operation.py index 37fa5d1..d27bb04 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/operation.py @@ -1,21 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from openapi_client import api_client, exceptions, security_schemes +from openapi_client import api_client, security_schemes import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -53,9 +45,9 @@ class Params(RequiredParams, OptionalParams): pass - parameters = [ + parameters = ( parameter_0.Parameter0, - ] + ) class RequestPathParameters: RequiredParams = typing_extensions.TypedDict( @@ -76,9 +68,9 @@ class Params(RequiredParams, OptionalParams): pass - parameters = [ + parameters = ( parameter_1.Parameter1, - ] + ) _security: typing.List[security_schemes.SecurityRequirementObject] = [ security_requirement_object_0.security_requirement_object, ] @@ -151,26 +143,15 @@ class instances """ self._verify_typed_dict_inputs(RequestHeaderParameters.Params, header_params) self._verify_typed_dict_inputs(RequestPathParameters.Params, path_params) - used_path = path - - _path_params = {} - for parameter in RequestPathParameters.parameters: - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() - for parameter in RequestHeaderParameters.parameters: - parameter_data = header_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _headers.extend(serialized_data) + used_path = self._get_used_path( + path, + path_parameters=RequestPathParameters.parameters, + path_params=path_params + ) + _headers = self._get_headers( + header_parameters=RequestHeaderParameters.parameters, + header_params=header_params + ) # TODO add cookie handling host = self.api_client.configuration.get_server_url( 'servers', server_index @@ -204,12 +185,7 @@ class instances else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/parameters/parameter_0/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/parameters/parameter_0/__init__.py index f8f982e..7d77718 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/parameters/parameter_0/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/parameters/parameter_0/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/parameters/parameter_0/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/parameters/parameter_0/schema.py index 5d0b9d2..9ff03a0 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/parameters/parameter_0/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/parameters/parameter_0/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/parameters/parameter_1/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/parameters/parameter_1/__init__.py index a7129ad..47046ff 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/parameters/parameter_1/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/parameters/parameter_1/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/parameters/parameter_1/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/parameters/parameter_1/schema.py index 1c34465..351922f 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/parameters/parameter_1/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/parameters/parameter_1/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/responses/response_400/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/responses/response_400/__init__.py index c9cfe54..1ea383b 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/responses/response_400/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/responses/response_400/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/security/security_requirement_object_0.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/security/security_requirement_object_0.py index ed74ea0..1b532c6 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/security/security_requirement_object_0.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/delete/security/security_requirement_object_0.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/operation.py index 1192c6b..6ee379f 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/operation.py @@ -1,21 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from openapi_client import api_client, exceptions, security_schemes +from openapi_client import api_client, security_schemes import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -54,9 +46,9 @@ class Params(RequiredParams, OptionalParams): pass - parameters = [ + parameters = ( parameter_0.Parameter0, - ] + ) _security: typing.List[security_schemes.SecurityRequirementObject] = [ security_requirement_object_0.security_requirement_object, ] @@ -139,24 +131,13 @@ def _get_pet_by_id( class instances """ self._verify_typed_dict_inputs(RequestPathParameters.Params, path_params) - used_path = path - - _path_params = {} - for parameter in RequestPathParameters.parameters: - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() + used_path = self._get_used_path( + path, + path_parameters=RequestPathParameters.parameters, + path_params=path_params + ) + _headers = self._get_headers(accept_content_types=accept_content_types) # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) host = self.api_client.configuration.get_server_url( 'servers', server_index ) @@ -191,12 +172,7 @@ class instances else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/parameters/parameter_0/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/parameters/parameter_0/__init__.py index 4435320..e9557c9 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/parameters/parameter_0/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/parameters/parameter_0/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/parameters/parameter_0/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/parameters/parameter_0/schema.py index 1c34465..351922f 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/parameters/parameter_0/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/parameters/parameter_0/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_200/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_200/__init__.py index 28e1774..81d0fa8 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_200/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_200/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_200/content/application_json/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_200/content/application_json/schema.py index 0a089af..6e41c98 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_200/content/application_json/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_200/content/application_json/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_200/content/application_xml/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_200/content/application_xml/schema.py index 0a089af..6e41c98 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_200/content/application_xml/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_200/content/application_xml/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_400/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_400/__init__.py index c9cfe54..1ea383b 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_400/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_400/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_404/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_404/__init__.py index d131fe3..6c3b1ee 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_404/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/responses/response_404/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/security/security_requirement_object_0.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/security/security_requirement_object_0.py index 4d40a96..86fee32 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/security/security_requirement_object_0.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/get/security/security_requirement_object_0.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/operation.py index 9780f98..ac49dfe 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/operation.py @@ -1,21 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from openapi_client import api_client, exceptions, security_schemes +from openapi_client import api_client, security_schemes import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -51,9 +43,9 @@ class Params(RequiredParams, OptionalParams): pass - parameters = [ + parameters = ( parameter_0.Parameter0, - ] + ) _security: typing.List[security_schemes.SecurityRequirementObject] = [ security_requirement_object_0.security_requirement_object, ] @@ -167,31 +159,20 @@ def _update_pet_with_form( class instances """ self._verify_typed_dict_inputs(RequestPathParameters.Params, path_params) - used_path = path - - _path_params = {} - for parameter in RequestPathParameters.parameters: - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() + used_path = self._get_used_path( + path, + path_parameters=RequestPathParameters.parameters, + path_params=path_params + ) + _headers = self._get_headers() # TODO add cookie handling - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body.RequestBody.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + _fields, _body = self._get_fields_and_body( + request_body=request_body.RequestBody, + body=body, + headers=_headers, + content_type=content_type + ) host = self.api_client.configuration.get_server_url( 'servers', server_index ) @@ -226,12 +207,7 @@ class instances else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/parameters/parameter_0/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/parameters/parameter_0/__init__.py index 4435320..e9557c9 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/parameters/parameter_0/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/parameters/parameter_0/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/parameters/parameter_0/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/parameters/parameter_0/schema.py index 1c34465..351922f 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/parameters/parameter_0/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/parameters/parameter_0/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/request_body/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/request_body/__init__.py index fdda793..7c1c465 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/request_body/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/request_body/__init__.py @@ -1,13 +1,10 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -import typing -import typing_extensions +import typing, typing_extensions from openapi_client import api_client from .content.application_x_www_form_urlencoded import schema as application_x_www_form_urlencoded_schema diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/request_body/content/application_x_www_form_urlencoded/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/request_body/content/application_x_www_form_urlencoded/schema.py index 3c6404a..d9f3d1d 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/request_body/content/application_x_www_form_urlencoded/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/request_body/content/application_x_www_form_urlencoded/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/responses/response_405/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/responses/response_405/__init__.py index 850f7e8..fd44b57 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/responses/response_405/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/responses/response_405/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/security/security_requirement_object_0.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/security/security_requirement_object_0.py index ed74ea0..1b532c6 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/security/security_requirement_object_0.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id/post/security/security_requirement_object_0.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/operation.py index a8de18b..ef5079e 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/operation.py @@ -1,21 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from openapi_client import api_client, exceptions, security_schemes +from openapi_client import api_client, security_schemes import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -51,9 +43,9 @@ class Params(RequiredParams, OptionalParams): pass - parameters = [ + parameters = ( parameter_0.Parameter0, - ] + ) _security: typing.List[security_schemes.SecurityRequirementObject] = [ security_requirement_object_0.security_requirement_object, ] @@ -179,34 +171,20 @@ def _upload_file( class instances """ self._verify_typed_dict_inputs(RequestPathParameters.Params, path_params) - used_path = path - - _path_params = {} - for parameter in RequestPathParameters.parameters: - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() + used_path = self._get_used_path( + path, + path_parameters=RequestPathParameters.parameters, + path_params=path_params + ) + _headers = self._get_headers(accept_content_types=accept_content_types) # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - _fields = None - _body = None - if body is not schemas.unset: - serialized_data = request_body.RequestBody.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + _fields, _body = self._get_fields_and_body( + request_body=request_body.RequestBody, + body=body, + headers=_headers, + content_type=content_type + ) host = self.api_client.configuration.get_server_url( 'servers', server_index ) @@ -241,12 +219,7 @@ class instances else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/parameters/parameter_0/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/parameters/parameter_0/__init__.py index 4435320..e9557c9 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/parameters/parameter_0/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/parameters/parameter_0/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/parameters/parameter_0/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/parameters/parameter_0/schema.py index 1c34465..351922f 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/parameters/parameter_0/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/parameters/parameter_0/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/request_body/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/request_body/__init__.py index a2e8b31..8a08edb 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/request_body/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/request_body/__init__.py @@ -1,13 +1,10 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -import typing -import typing_extensions +import typing, typing_extensions from openapi_client import api_client from .content.multipart_form_data import schema as multipart_form_data_schema diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/request_body/content/multipart_form_data/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/request_body/content/multipart_form_data/schema.py index 42149ec..edc55db 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/request_body/content/multipart_form_data/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/request_body/content/multipart_form_data/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/responses/response_200/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/responses/response_200/__init__.py index ec94c7b..654cefb 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/responses/response_200/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/responses/response_200/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/responses/response_200/content/application_json/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/responses/response_200/content/application_json/schema.py index b7da355..34b77fd 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/responses/response_200/content/application_json/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/responses/response_200/content/application_json/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/security/security_requirement_object_0.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/security/security_requirement_object_0.py index ed74ea0..1b532c6 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/security/security_requirement_object_0.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/pet_pet_id_upload_image/post/security/security_requirement_object_0.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_inventory/get/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_inventory/get/operation.py index 2751cfe..5f5ca32 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_inventory/get/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_inventory/get/operation.py @@ -1,21 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from openapi_client import api_client, exceptions, security_schemes +from openapi_client import api_client, security_schemes import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -102,12 +94,8 @@ def _get_inventory( class instances """ used_path = path - - _headers = HTTPHeaderDict() + _headers = self._get_headers(accept_content_types=accept_content_types) # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) host = self.api_client.configuration.get_server_url( 'servers', server_index ) @@ -140,12 +128,7 @@ class instances else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_inventory/get/responses/response_200/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_inventory/get/responses/response_200/__init__.py index ec94c7b..654cefb 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_inventory/get/responses/response_200/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_inventory/get/responses/response_200/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_inventory/get/responses/response_200/content/application_json/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_inventory/get/responses/response_200/content/application_json/schema.py index e325326..a4a5a12 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_inventory/get/responses/response_200/content/application_json/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_inventory/get/responses/response_200/content/application_json/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_inventory/get/security/security_requirement_object_0.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_inventory/get/security/security_requirement_object_0.py index 4d40a96..86fee32 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_inventory/get/security/security_requirement_object_0.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_inventory/get/security/security_requirement_object_0.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/operation.py index a3cbe01..cc89b3c 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/operation.py @@ -1,21 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from openapi_client import api_client, exceptions +from openapi_client import api_client import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -141,24 +133,15 @@ def _place_order( class instances """ used_path = path - - _headers = HTTPHeaderDict() + _headers = self._get_headers(accept_content_types=accept_content_types) # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) - - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body.RequestBody.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + + _fields, _body = self._get_fields_and_body( + request_body=request_body.RequestBody, + body=body, + headers=_headers, + content_type=content_type + ) host = self.api_client.configuration.get_server_url( 'servers', server_index ) @@ -188,12 +171,7 @@ class instances else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/request_body/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/request_body/__init__.py index 21dda66..0c2cb35 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/request_body/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/request_body/__init__.py @@ -1,13 +1,10 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -import typing -import typing_extensions +import typing, typing_extensions from openapi_client import api_client from .content.application_json import schema as application_json_schema diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/request_body/content/application_json/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/request_body/content/application_json/schema.py index cf939c8..0a3a051 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/request_body/content/application_json/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/request_body/content/application_json/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/responses/response_200/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/responses/response_200/__init__.py index 28e1774..81d0fa8 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/responses/response_200/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/responses/response_200/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/responses/response_200/content/application_json/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/responses/response_200/content/application_json/schema.py index cf939c8..0a3a051 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/responses/response_200/content/application_json/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/responses/response_200/content/application_json/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/responses/response_200/content/application_xml/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/responses/response_200/content/application_xml/schema.py index cf939c8..0a3a051 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/responses/response_200/content/application_xml/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/responses/response_200/content/application_xml/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/responses/response_400/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/responses/response_400/__init__.py index c9cfe54..1ea383b 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/responses/response_400/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order/post/responses/response_400/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/operation.py index a0df107..84900f5 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/operation.py @@ -1,20 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from openapi_client import api_client, exceptions +from openapi_client import api_client import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -51,9 +44,9 @@ class Params(RequiredParams, OptionalParams): pass - parameters = [ + parameters = ( parameter_0.Parameter0, - ] + ) __StatusCodeToResponse = typing_extensions.TypedDict( '__StatusCodeToResponse', @@ -115,18 +108,11 @@ def _delete_order( class instances """ self._verify_typed_dict_inputs(RequestPathParameters.Params, path_params) - used_path = path - - _path_params = {} - for parameter in RequestPathParameters.parameters: - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) + used_path = self._get_used_path( + path, + path_parameters=RequestPathParameters.parameters, + path_params=path_params + ) # TODO add cookie handling host = self.api_client.configuration.get_server_url( 'servers', server_index @@ -154,12 +140,7 @@ class instances else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/parameters/parameter_0/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/parameters/parameter_0/__init__.py index fbbd4c0..fd484e1 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/parameters/parameter_0/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/parameters/parameter_0/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/parameters/parameter_0/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/parameters/parameter_0/schema.py index 5d0b9d2..9ff03a0 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/parameters/parameter_0/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/parameters/parameter_0/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/responses/response_400/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/responses/response_400/__init__.py index c9cfe54..1ea383b 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/responses/response_400/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/responses/response_400/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/responses/response_404/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/responses/response_404/__init__.py index d131fe3..6c3b1ee 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/responses/response_404/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/delete/responses/response_404/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/operation.py index dbbf127..2ba1194 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/operation.py @@ -1,21 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from openapi_client import api_client, exceptions +from openapi_client import api_client import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -53,9 +45,9 @@ class Params(RequiredParams, OptionalParams): pass - parameters = [ + parameters = ( parameter_0.Parameter0, - ] + ) __StatusCodeToResponse = typing_extensions.TypedDict( '__StatusCodeToResponse', @@ -130,24 +122,13 @@ def _get_order_by_id( class instances """ self._verify_typed_dict_inputs(RequestPathParameters.Params, path_params) - used_path = path - - _path_params = {} - for parameter in RequestPathParameters.parameters: - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() + used_path = self._get_used_path( + path, + path_parameters=RequestPathParameters.parameters, + path_params=path_params + ) + _headers = self._get_headers(accept_content_types=accept_content_types) # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) host = self.api_client.configuration.get_server_url( 'servers', server_index ) @@ -176,12 +157,7 @@ class instances else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/parameters/parameter_0/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/parameters/parameter_0/__init__.py index fbbd4c0..fd484e1 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/parameters/parameter_0/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/parameters/parameter_0/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/parameters/parameter_0/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/parameters/parameter_0/schema.py index 3a73ba2..662371d 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/parameters/parameter_0/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/parameters/parameter_0/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_200/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_200/__init__.py index 28e1774..81d0fa8 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_200/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_200/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_200/content/application_json/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_200/content/application_json/schema.py index cf939c8..0a3a051 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_200/content/application_json/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_200/content/application_json/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_200/content/application_xml/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_200/content/application_xml/schema.py index cf939c8..0a3a051 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_200/content/application_xml/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_200/content/application_xml/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_400/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_400/__init__.py index c9cfe54..1ea383b 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_400/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_400/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_404/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_404/__init__.py index d131fe3..6c3b1ee 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_404/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/store_order_order_id/get/responses/response_404/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/operation.py index 6b4d7f7..50863d7 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/operation.py @@ -1,21 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from openapi_client import api_client, exceptions, security_schemes +from openapi_client import api_client, security_schemes import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -128,21 +120,15 @@ def _create_user( class instances """ used_path = path - - _headers = HTTPHeaderDict() + _headers = self._get_headers() # TODO add cookie handling - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body.RequestBody.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + _fields, _body = self._get_fields_and_body( + request_body=request_body.RequestBody, + body=body, + headers=_headers, + content_type=content_type + ) host = self.api_client.configuration.get_server_url( 'servers', server_index ) @@ -169,12 +155,7 @@ class instances else: api_response = default_response.deserialize(response, self.api_client.schema_configuration) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/request_body/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/request_body/__init__.py index 21dda66..0c2cb35 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/request_body/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/request_body/__init__.py @@ -1,13 +1,10 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -import typing -import typing_extensions +import typing, typing_extensions from openapi_client import api_client from .content.application_json import schema as application_json_schema diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/request_body/content/application_json/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/request_body/content/application_json/schema.py index 4e9df85..19d6ed9 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/request_body/content/application_json/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/request_body/content/application_json/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/responses/response_default/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/responses/response_default/__init__.py index 8dbfdfb..1d60b63 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/responses/response_default/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/responses/response_default/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/security/security_requirement_object_0.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/security/security_requirement_object_0.py index 4d40a96..86fee32 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/security/security_requirement_object_0.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user/post/security/security_requirement_object_0.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_array/post/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_array/post/operation.py index e515564..1eb87f7 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_array/post/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_array/post/operation.py @@ -1,21 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from openapi_client import api_client, exceptions, security_schemes +from openapi_client import api_client, security_schemes import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -128,21 +120,15 @@ def _create_users_with_array_input( class instances """ used_path = path - - _headers = HTTPHeaderDict() + _headers = self._get_headers() # TODO add cookie handling - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body.RequestBody.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + _fields, _body = self._get_fields_and_body( + request_body=request_body.RequestBody, + body=body, + headers=_headers, + content_type=content_type + ) host = self.api_client.configuration.get_server_url( 'servers', server_index ) @@ -169,12 +155,7 @@ class instances else: api_response = default_response.deserialize(response, self.api_client.schema_configuration) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_array/post/request_body/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_array/post/request_body/__init__.py index 5d1d356..5c817f6 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_array/post/request_body/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_array/post/request_body/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_array/post/responses/response_default/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_array/post/responses/response_default/__init__.py index 8dbfdfb..1d60b63 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_array/post/responses/response_default/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_array/post/responses/response_default/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_array/post/security/security_requirement_object_0.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_array/post/security/security_requirement_object_0.py index 4d40a96..86fee32 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_array/post/security/security_requirement_object_0.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_array/post/security/security_requirement_object_0.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_list/post/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_list/post/operation.py index 96b5ebc..514e676 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_list/post/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_list/post/operation.py @@ -1,21 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from openapi_client import api_client, exceptions, security_schemes +from openapi_client import api_client, security_schemes import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -128,21 +120,15 @@ def _create_users_with_list_input( class instances """ used_path = path - - _headers = HTTPHeaderDict() + _headers = self._get_headers() # TODO add cookie handling - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body.RequestBody.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + _fields, _body = self._get_fields_and_body( + request_body=request_body.RequestBody, + body=body, + headers=_headers, + content_type=content_type + ) host = self.api_client.configuration.get_server_url( 'servers', server_index ) @@ -169,12 +155,7 @@ class instances else: api_response = default_response.deserialize(response, self.api_client.schema_configuration) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_list/post/request_body/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_list/post/request_body/__init__.py index 5d1d356..5c817f6 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_list/post/request_body/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_list/post/request_body/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_list/post/responses/response_default/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_list/post/responses/response_default/__init__.py index 8dbfdfb..1d60b63 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_list/post/responses/response_default/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_list/post/responses/response_default/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_list/post/security/security_requirement_object_0.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_list/post/security/security_requirement_object_0.py index 4d40a96..86fee32 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_list/post/security/security_requirement_object_0.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_create_with_list/post/security/security_requirement_object_0.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/operation.py index e1216a0..88ad664 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/operation.py @@ -1,21 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from openapi_client import api_client, exceptions +from openapi_client import api_client import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -56,10 +48,10 @@ class Params(RequiredParams, OptionalParams): pass - parameters = [ + parameters = ( parameter_0.Parameter0, parameter_1.Parameter1, - ] + ) __StatusCodeToResponse = typing_extensions.TypedDict( '__StatusCodeToResponse', @@ -132,24 +124,13 @@ def _login_user( class instances """ self._verify_typed_dict_inputs(RequestQueryParameters.Params, query_params) - used_path = path - - prefix_separator_iterator = None - for parameter in RequestQueryParameters.parameters: - parameter_data = query_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - if prefix_separator_iterator is None: - prefix_separator_iterator = parameter.get_prefix_separator_iterator() - serialized_data = parameter.serialize(parameter_data, prefix_separator_iterator) - for serialized_value in serialized_data.values(): - used_path += serialized_value - - _headers = HTTPHeaderDict() + used_path = self._get_used_path( + path, + query_parameters=RequestQueryParameters.parameters, + query_params=query_params + ) + _headers = self._get_headers(accept_content_types=accept_content_types) # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) host = self.api_client.configuration.get_server_url( 'servers', server_index ) @@ -177,12 +158,7 @@ class instances else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/parameters/parameter_0/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/parameters/parameter_0/__init__.py index b9e0931..b523b70 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/parameters/parameter_0/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/parameters/parameter_0/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/parameters/parameter_0/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/parameters/parameter_0/schema.py index 098be76..ff01808 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/parameters/parameter_0/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/parameters/parameter_0/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/parameters/parameter_1/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/parameters/parameter_1/__init__.py index ab1d0da..9c59c02 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/parameters/parameter_1/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/parameters/parameter_1/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/parameters/parameter_1/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/parameters/parameter_1/schema.py index 5d0b9d2..9ff03a0 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/parameters/parameter_1/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/parameters/parameter_1/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/__init__.py index 7d5e0d7..ea7ad45 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/content/application_json/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/content/application_json/schema.py index 5d0b9d2..9ff03a0 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/content/application_json/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/content/application_json/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/content/application_xml/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/content/application_xml/schema.py index 5d0b9d2..9ff03a0 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/content/application_xml/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/content/application_xml/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_set_cookie/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_set_cookie/__init__.py index d78c648..d9855eb 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_set_cookie/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_set_cookie/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_set_cookie/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_set_cookie/schema.py index 5d0b9d2..9ff03a0 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_set_cookie/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_set_cookie/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_x_expires_after/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_x_expires_after/__init__.py index 1c03ecc..ca405cd 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_x_expires_after/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_x_expires_after/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_x_expires_after/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_x_expires_after/schema.py index da5f681..f791605 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_x_expires_after/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_x_expires_after/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_x_rate_limit/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_x_rate_limit/__init__.py index 9535c0d..3b1864a 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_x_rate_limit/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_x_rate_limit/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_x_rate_limit/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_x_rate_limit/schema.py index d3aaaa6..e60bf7e 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_x_rate_limit/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_200/headers/header_x_rate_limit/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_400/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_400/__init__.py index c9cfe54..1ea383b 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_400/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_login/get/responses/response_400/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_logout/get/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_logout/get/operation.py index 7dbb930..38922ca 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_logout/get/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_logout/get/operation.py @@ -1,20 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from openapi_client import api_client, exceptions, security_schemes +from openapi_client import api_client, security_schemes import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -109,12 +102,7 @@ class instances else: api_response = default_response.deserialize(response, self.api_client.schema_configuration) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_logout/get/responses/response_default/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_logout/get/responses/response_default/__init__.py index 8dbfdfb..1d60b63 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_logout/get/responses/response_default/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_logout/get/responses/response_default/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_logout/get/security/security_requirement_object_0.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_logout/get/security/security_requirement_object_0.py index 4d40a96..86fee32 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_logout/get/security/security_requirement_object_0.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_logout/get/security/security_requirement_object_0.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/operation.py index db8b7c4..9ddd42b 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/operation.py @@ -1,20 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 - -from openapi_client import api_client, exceptions, security_schemes +from openapi_client import api_client, security_schemes import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -52,9 +45,9 @@ class Params(RequiredParams, OptionalParams): pass - parameters = [ + parameters = ( parameter_0.Parameter0, - ] + ) _security: typing.List[security_schemes.SecurityRequirementObject] = [ security_requirement_object_0.security_requirement_object, ] @@ -124,18 +117,11 @@ def _delete_user( class instances """ self._verify_typed_dict_inputs(RequestPathParameters.Params, path_params) - used_path = path - - _path_params = {} - for parameter in RequestPathParameters.parameters: - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) + used_path = self._get_used_path( + path, + path_parameters=RequestPathParameters.parameters, + path_params=path_params + ) # TODO add cookie handling host = self.api_client.configuration.get_server_url( 'servers', server_index @@ -169,12 +155,7 @@ class instances else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/parameters/parameter_0/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/parameters/parameter_0/__init__.py index c412b71..996a6b5 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/parameters/parameter_0/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/parameters/parameter_0/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/parameters/parameter_0/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/parameters/parameter_0/schema.py index 5d0b9d2..9ff03a0 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/parameters/parameter_0/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/parameters/parameter_0/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/responses/response_400/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/responses/response_400/__init__.py index c9cfe54..1ea383b 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/responses/response_400/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/responses/response_400/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/responses/response_404/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/responses/response_404/__init__.py index d131fe3..6c3b1ee 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/responses/response_404/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/responses/response_404/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/security/security_requirement_object_0.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/security/security_requirement_object_0.py index 4d40a96..86fee32 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/security/security_requirement_object_0.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/delete/security/security_requirement_object_0.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/operation.py index 4d154ec..ff6f15c 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/operation.py @@ -1,21 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from openapi_client import api_client, exceptions +from openapi_client import api_client import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -53,9 +45,9 @@ class Params(RequiredParams, OptionalParams): pass - parameters = [ + parameters = ( parameter_0.Parameter0, - ] + ) __StatusCodeToResponse = typing_extensions.TypedDict( '__StatusCodeToResponse', @@ -130,24 +122,13 @@ def _get_user_by_name( class instances """ self._verify_typed_dict_inputs(RequestPathParameters.Params, path_params) - used_path = path - - _path_params = {} - for parameter in RequestPathParameters.parameters: - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() + used_path = self._get_used_path( + path, + path_parameters=RequestPathParameters.parameters, + path_params=path_params + ) + _headers = self._get_headers(accept_content_types=accept_content_types) # TODO add cookie handling - if accept_content_types: - for accept_content_type in accept_content_types: - _headers.add('Accept', accept_content_type) host = self.api_client.configuration.get_server_url( 'servers', server_index ) @@ -176,12 +157,7 @@ class instances else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/parameters/parameter_0/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/parameters/parameter_0/__init__.py index c412b71..996a6b5 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/parameters/parameter_0/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/parameters/parameter_0/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/parameters/parameter_0/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/parameters/parameter_0/schema.py index 5d0b9d2..9ff03a0 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/parameters/parameter_0/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/parameters/parameter_0/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_200/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_200/__init__.py index 28e1774..81d0fa8 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_200/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_200/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_200/content/application_json/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_200/content/application_json/schema.py index 4e9df85..19d6ed9 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_200/content/application_json/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_200/content/application_json/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_200/content/application_xml/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_200/content/application_xml/schema.py index 4e9df85..19d6ed9 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_200/content/application_xml/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_200/content/application_xml/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_400/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_400/__init__.py index c9cfe54..1ea383b 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_400/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_400/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_404/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_404/__init__.py index d131fe3..6c3b1ee 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_404/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/get/responses/response_404/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/operation.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/operation.py index 8c57fc1..9a843eb 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/operation.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/operation.py @@ -1,21 +1,13 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -from dataclasses import dataclass -import typing_extensions -import urllib3 -from urllib3._collections import HTTPHeaderDict - -from openapi_client import api_client, exceptions, security_schemes +from openapi_client import api_client, security_schemes import datetime # noqa: F401 import decimal # noqa: F401 import io # noqa: F401 -import re # noqa: F401 import typing # noqa: F401 import typing_extensions # noqa: F401 import uuid # noqa: F401 @@ -54,9 +46,9 @@ class Params(RequiredParams, OptionalParams): pass - parameters = [ + parameters = ( parameter_0.Parameter0, - ] + ) _security: typing.List[security_schemes.SecurityRequirementObject] = [ security_requirement_object_0.security_requirement_object, ] @@ -167,33 +159,20 @@ def _update_user( class instances """ self._verify_typed_dict_inputs(RequestPathParameters.Params, path_params) - used_path = path - - _path_params = {} - for parameter in RequestPathParameters.parameters: - parameter_data = path_params.get(parameter.name, schemas.unset) - if parameter_data is schemas.unset: - continue - serialized_data = parameter.serialize(parameter_data) - _path_params.update(serialized_data) - - for k, v in _path_params.items(): - used_path = used_path.replace('{%s}' % k, v) - - _headers = HTTPHeaderDict() + used_path = self._get_used_path( + path, + path_parameters=RequestPathParameters.parameters, + path_params=path_params + ) + _headers = self._get_headers() # TODO add cookie handling - if body is schemas.unset: - raise exceptions.ApiValueError( - 'The required body parameter has an invalid value of: unset. Set a valid value instead') - _fields = None - _body = None - serialized_data = request_body.RequestBody.serialize(body, content_type) - _headers.add('Content-Type', content_type) - if 'fields' in serialized_data: - _fields = serialized_data['fields'] - elif 'body' in serialized_data: - _body = serialized_data['body'] + _fields, _body = self._get_fields_and_body( + request_body=request_body.RequestBody, + body=body, + headers=_headers, + content_type=content_type + ) host = self.api_client.configuration.get_server_url( 'servers', server_index ) @@ -229,12 +208,7 @@ class instances else: api_response = api_client.ApiResponseWithoutDeserialization(response=response) - if not 200 <= response.status <= 399: - raise exceptions.ApiException( - status=response.status, - reason=response.reason, - api_response=api_response - ) + self._verify_response_status(api_response) return api_response diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/parameters/parameter_0/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/parameters/parameter_0/__init__.py index c412b71..996a6b5 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/parameters/parameter_0/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/parameters/parameter_0/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/parameters/parameter_0/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/parameters/parameter_0/schema.py index 5d0b9d2..9ff03a0 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/parameters/parameter_0/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/parameters/parameter_0/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/request_body/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/request_body/__init__.py index 21dda66..0c2cb35 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/request_body/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/request_body/__init__.py @@ -1,13 +1,10 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ -import typing -import typing_extensions +import typing, typing_extensions from openapi_client import api_client from .content.application_json import schema as application_json_schema diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/request_body/content/application_json/schema.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/request_body/content/application_json/schema.py index 4e9df85..19d6ed9 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/request_body/content/application_json/schema.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/request_body/content/application_json/schema.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/responses/response_400/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/responses/response_400/__init__.py index c9cfe54..1ea383b 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/responses/response_400/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/responses/response_400/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/responses/response_404/__init__.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/responses/response_404/__init__.py index d131fe3..6c3b1ee 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/responses/response_404/__init__.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/responses/response_404/__init__.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/security/security_requirement_object_0.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/security/security_requirement_object_0.py index 4d40a96..86fee32 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/security/security_requirement_object_0.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/paths/user_username/put/security/security_requirement_object_0.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/rest.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/rest.py index 3b42a4b..690bf40 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/rest.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/rest.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/schemas.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/schemas.py index db8bb45..b2fd529 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/schemas.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/schemas.py @@ -2,9 +2,7 @@ """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/security_schemes.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/security_schemes.py index d658a14..803f41b 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/security_schemes.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/security_schemes.py @@ -1,9 +1,7 @@ # coding: utf-8 """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/server.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/server.py index 773c3c4..dbce5b0 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/server.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/server.py @@ -1,9 +1,7 @@ # coding: utf-8 """ OpenAPI Petstore - This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. # noqa: E501 - The version of the OpenAPI document: 1.0.0 Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/src/openapi_client/servers/server_0.py b/petstore/openapi_json_schema_generator_python/src/openapi_client/servers/server_0.py index 238ab9b..3ed11b1 100644 --- a/petstore/openapi_json_schema_generator_python/src/openapi_client/servers/server_0.py +++ b/petstore/openapi_json_schema_generator_python/src/openapi_client/servers/server_0.py @@ -1,7 +1,5 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet/test_post.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet/test_post.py index 7fc0924..cbe64c3 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet/test_post.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet/test_post.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet/test_put.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet/test_put.py index c6b88d0..ef93196 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet/test_put.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet/test_put.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_find_by_status/test_get.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_find_by_status/test_get.py index b7e7a46..ea16088 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_find_by_status/test_get.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_find_by_status/test_get.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_find_by_tags/test_get.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_find_by_tags/test_get.py index 89d5327..1bfd6f3 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_find_by_tags/test_get.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_find_by_tags/test_get.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_pet_id/test_delete.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_pet_id/test_delete.py index cf90bb7..7a51e89 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_pet_id/test_delete.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_pet_id/test_delete.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_pet_id/test_get.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_pet_id/test_get.py index 0b01190..1cb87b8 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_pet_id/test_get.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_pet_id/test_get.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_pet_id/test_post.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_pet_id/test_post.py index ac6f99e..723d573 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_pet_id/test_post.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_pet_id/test_post.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_pet_id_upload_image/test_post.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_pet_id_upload_image/test_post.py index beff9ed..bb15f9c 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_pet_id_upload_image/test_post.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_pet_pet_id_upload_image/test_post.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_store_inventory/test_get.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_store_inventory/test_get.py index 58a75f5..aade130 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_store_inventory/test_get.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_store_inventory/test_get.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_store_order/test_post.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_store_order/test_post.py index 97e4dde..3c02d1e 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_store_order/test_post.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_store_order/test_post.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_store_order_order_id/test_delete.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_store_order_order_id/test_delete.py index a3f5515..cf0a7bf 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_store_order_order_id/test_delete.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_store_order_order_id/test_delete.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_store_order_order_id/test_get.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_store_order_order_id/test_get.py index 86ed72e..41ca457 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_store_order_order_id/test_get.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_store_order_order_id/test_get.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_user/test_post.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_user/test_post.py index 2dfe50e..cc7f6ea 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_user/test_post.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_user/test_post.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_create_with_array/test_post.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_create_with_array/test_post.py index 5fd7be7..918c66d 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_create_with_array/test_post.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_create_with_array/test_post.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_create_with_list/test_post.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_create_with_list/test_post.py index 40fbba2..716e677 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_create_with_list/test_post.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_create_with_list/test_post.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_login/test_get.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_login/test_get.py index 79b4523..a373edf 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_login/test_get.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_login/test_get.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_logout/test_get.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_logout/test_get.py index 71dd246..beb3080 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_logout/test_get.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_logout/test_get.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_username/test_delete.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_username/test_delete.py index 96fce5d..c19d396 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_username/test_delete.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_username/test_delete.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_username/test_get.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_username/test_get.py index 96e9f78..4175b84 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_username/test_get.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_username/test_get.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ diff --git a/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_username/test_put.py b/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_username/test_put.py index 197a38b..1e2271c 100644 --- a/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_username/test_put.py +++ b/petstore/openapi_json_schema_generator_python/test/test_paths/test_user_username/test_put.py @@ -1,8 +1,6 @@ # coding: utf-8 """ - - Generated by: https://github.com/openapi-json-schema-tools/openapi-json-schema-generator """ From 852c3ee9236596d1ef66120ede935fe1b9a0b82c Mon Sep 17 00:00:00 2001 From: Justin Black Date: Tue, 9 May 2023 11:55:24 -0700 Subject: [PATCH 2/2] Samples regen --- .DS_Store | Bin 6148 -> 6148 bytes README.md | 13 +- .../.github/workflows/python.yml | 2 +- .../.openapi-generator/FILES | 1 + .../.openapi-generator/VERSION | 2 +- .../README.md | 10 +- .../docs/PetApi.md | 32 ++- .../docs/StoreApi.md | 14 +- .../docs/UserApi.md | 29 ++- .../openapi_client/__init__.py | 2 + .../openapi_client/api/pet_api.py | 187 +++++++++--------- .../openapi_client/api/store_api.py | 89 +++++---- .../openapi_client/api/user_api.py | 179 ++++++++--------- .../openapi_client/api_client.py | 70 +++---- .../openapi_client/api_response.py | 25 +++ .../openapi_client/configuration.py | 4 + .../openapi_client/models/api_response.py | 4 +- .../openapi_client/models/category.py | 14 +- .../openapi_client/models/order.py | 16 +- .../openapi_client/models/pet.py | 18 +- .../openapi_client/models/tag.py | 4 +- .../openapi_client/models/user.py | 4 +- .../openapi_client/rest.py | 4 + .../pyproject.toml | 13 +- .../requirements.txt | 2 +- .../openapi_generator_python_nextgen/setup.py | 2 +- 26 files changed, 408 insertions(+), 332 deletions(-) create mode 100644 petstore/openapi_generator_python_nextgen/openapi_client/api_response.py diff --git a/.DS_Store b/.DS_Store index b57b68004f656af3b96fabb41536f04271358b17..5f349613175b555e9f4b2e5ef4364aff5767d521 100644 GIT binary patch delta 98 zcmZoMXfc=|&e%S&P;8=}q9_vs0|O%ig8&0V2}3?Z5kqQPN^$bUjp~yPL|7y_7z!9t rffB{Yl1cgbIUBp<**CLu2yigAZ`}Buc{0C ## Documentation For Authorization -## petstore_auth +Authentication schemes defined for the API: + +### petstore_auth - **Type**: OAuth - **Flow**: implicit @@ -136,8 +138,8 @@ Class | Method | HTTP request | Description - **write:pets**: modify pets in your account - **read:pets**: read your pets - -## api_key + +### api_key - **Type**: API key - **API key parameter name**: api_key diff --git a/petstore/openapi_generator_python_nextgen/docs/PetApi.md b/petstore/openapi_generator_python_nextgen/docs/PetApi.md index 7194ed0..284ad36 100644 --- a/petstore/openapi_generator_python_nextgen/docs/PetApi.md +++ b/petstore/openapi_generator_python_nextgen/docs/PetApi.md @@ -25,12 +25,13 @@ Add a new pet to the store * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import openapi_client +from openapi_client.models.pet import Pet from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -59,6 +60,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling PetApi->add_pet: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -97,12 +99,12 @@ Deletes a pet * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import openapi_client from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -130,6 +132,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling PetApi->delete_pet: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -168,12 +171,13 @@ Multiple status values can be provided with comma separated strings * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import openapi_client +from openapi_client.models.pet import Pet from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -202,6 +206,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling PetApi->find_pets_by_status: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -240,12 +245,13 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import openapi_client +from openapi_client.models.pet import Pet from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -274,6 +280,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling PetApi->find_pets_by_tags: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -312,12 +319,13 @@ Returns a single pet * Api Key Authentication (api_key): ```python -from __future__ import print_function import time import os import openapi_client +from openapi_client.models.pet import Pet from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -350,6 +358,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling PetApi->get_pet_by_id: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -389,12 +398,13 @@ Update an existing pet * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import openapi_client +from openapi_client.models.pet import Pet from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -423,6 +433,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling PetApi->update_pet: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -463,12 +474,12 @@ Updates a pet in the store with form data * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import openapi_client from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -497,6 +508,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling PetApi->update_pet_with_form: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -536,12 +548,13 @@ uploads an image * OAuth Authentication (petstore_auth): ```python -from __future__ import print_function import time import os import openapi_client +from openapi_client.models.api_response import ApiResponse from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -561,7 +574,7 @@ with openapi_client.ApiClient(configuration) as api_client: api_instance = openapi_client.PetApi(api_client) pet_id = 56 # int | ID of pet to update additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional) - file = openapi_client.bytearray() # bytearray | file to upload (optional) + file = None # bytearray | file to upload (optional) try: # uploads an image @@ -572,6 +585,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling PetApi->upload_file: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/petstore/openapi_generator_python_nextgen/docs/StoreApi.md b/petstore/openapi_generator_python_nextgen/docs/StoreApi.md index 98aaa00..de47d52 100644 --- a/petstore/openapi_generator_python_nextgen/docs/StoreApi.md +++ b/petstore/openapi_generator_python_nextgen/docs/StoreApi.md @@ -20,12 +20,12 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ### Example ```python -from __future__ import print_function import time import os import openapi_client from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -46,6 +46,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling StoreApi->delete_order: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -84,12 +85,12 @@ Returns a map of status codes to quantities * Api Key Authentication (api_key): ```python -from __future__ import print_function import time import os import openapi_client from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -121,6 +122,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling StoreApi->get_inventory: %s\n" % e) ``` + ### Parameters This endpoint does not need any parameter. @@ -154,12 +156,13 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ### Example ```python -from __future__ import print_function import time import os import openapi_client +from openapi_client.models.order import Order from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -182,6 +185,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling StoreApi->get_order_by_id: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -220,12 +224,13 @@ Place an order for a pet ### Example ```python -from __future__ import print_function import time import os import openapi_client +from openapi_client.models.order import Order from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -248,6 +253,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling StoreApi->place_order: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/petstore/openapi_generator_python_nextgen/docs/UserApi.md b/petstore/openapi_generator_python_nextgen/docs/UserApi.md index b3db54d..66df4fc 100644 --- a/petstore/openapi_generator_python_nextgen/docs/UserApi.md +++ b/petstore/openapi_generator_python_nextgen/docs/UserApi.md @@ -25,12 +25,13 @@ This can only be done by the logged in user. * Api Key Authentication (api_key): ```python -from __future__ import print_function import time import os import openapi_client +from openapi_client.models.user import User from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -61,6 +62,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling UserApi->create_user: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -98,12 +100,13 @@ Creates list of users with given input array * Api Key Authentication (api_key): ```python -from __future__ import print_function import time import os import openapi_client +from openapi_client.models.user import User from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -134,6 +137,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling UserApi->create_users_with_array_input: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -171,12 +175,13 @@ Creates list of users with given input array * Api Key Authentication (api_key): ```python -from __future__ import print_function import time import os import openapi_client +from openapi_client.models.user import User from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -207,6 +212,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling UserApi->create_users_with_list_input: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -244,12 +250,12 @@ This can only be done by the logged in user. * Api Key Authentication (api_key): ```python -from __future__ import print_function import time import os import openapi_client from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -280,6 +286,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling UserApi->delete_user: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -317,12 +324,13 @@ Get user by user name ### Example ```python -from __future__ import print_function import time import os import openapi_client +from openapi_client.models.user import User from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -345,6 +353,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling UserApi->get_user_by_name: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -383,12 +392,12 @@ Logs user into the system ### Example ```python -from __future__ import print_function import time import os import openapi_client from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -412,6 +421,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling UserApi->login_user: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes @@ -451,12 +461,12 @@ Logs out current logged in user session * Api Key Authentication (api_key): ```python -from __future__ import print_function import time import os import openapi_client from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -486,6 +496,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling UserApi->logout_user: %s\n" % e) ``` + ### Parameters This endpoint does not need any parameter. @@ -520,12 +531,13 @@ This can only be done by the logged in user. * Api Key Authentication (api_key): ```python -from __future__ import print_function import time import os import openapi_client +from openapi_client.models.user import User from openapi_client.rest import ApiException from pprint import pprint + # Defining the host is optional and defaults to http://petstore.swagger.io/v2 # See configuration.py for a list of all supported configuration parameters. configuration = openapi_client.Configuration( @@ -557,6 +569,7 @@ with openapi_client.ApiClient(configuration) as api_client: print("Exception when calling UserApi->update_user: %s\n" % e) ``` + ### Parameters Name | Type | Description | Notes diff --git a/petstore/openapi_generator_python_nextgen/openapi_client/__init__.py b/petstore/openapi_generator_python_nextgen/openapi_client/__init__.py index ea10794..003510d 100644 --- a/petstore/openapi_generator_python_nextgen/openapi_client/__init__.py +++ b/petstore/openapi_generator_python_nextgen/openapi_client/__init__.py @@ -22,6 +22,7 @@ from openapi_client.api.user_api import UserApi # import ApiClient +from openapi_client.api_response import ApiResponse from openapi_client.api_client import ApiClient from openapi_client.configuration import Configuration from openapi_client.exceptions import OpenApiException @@ -30,6 +31,7 @@ from openapi_client.exceptions import ApiKeyError from openapi_client.exceptions import ApiAttributeError from openapi_client.exceptions import ApiException + # import models into sdk package from openapi_client.models.api_response import ApiResponse from openapi_client.models.category import Category diff --git a/petstore/openapi_generator_python_nextgen/openapi_client/api/pet_api.py b/petstore/openapi_generator_python_nextgen/openapi_client/api/pet_api.py index eedb084..b58b23d 100644 --- a/petstore/openapi_generator_python_nextgen/openapi_client/api/pet_api.py +++ b/petstore/openapi_generator_python_nextgen/openapi_client/api/pet_api.py @@ -13,18 +13,21 @@ import re # noqa: F401 +import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated -from pydantic import Field, StrictInt, StrictStr, conlist, validator +from pydantic import Field, StrictBytes, StrictInt, StrictStr, conlist, validator -from typing import List, Optional +from typing import List, Optional, Union from openapi_client.models.api_response import ApiResponse from openapi_client.models.pet import Pet from openapi_client.api_client import ApiClient +from openapi_client.api_response import ApiResponse from openapi_client.exceptions import ( # noqa: F401 ApiTypeError, ApiValueError @@ -58,10 +61,6 @@ def add_pet(self, pet : Annotated[Pet, Field(..., description="Pet object that n :type pet: Pet :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -72,10 +71,12 @@ def add_pet(self, pet : Annotated[Pet, Field(..., description="Pet object that n :rtype: Pet """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the add_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.add_pet_with_http_info(pet, **kwargs) # noqa: E501 @validate_arguments - def add_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs): # noqa: E501 + def add_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> ApiResponse: # noqa: E501 """Add a new pet to the store # noqa: E501 # noqa: E501 @@ -89,13 +90,14 @@ def add_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pe :type pet: Pet :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -152,7 +154,7 @@ def add_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pe _files = {} # process the body parameter _body_params = None - if _params['pet']: + if _params['pet'] is not None: _body_params = _params['pet'] # set the HTTP header `Accept` @@ -208,10 +210,6 @@ def delete_pet(self, pet_id : Annotated[StrictInt, Field(..., description="Pet i :type api_key: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -222,10 +220,12 @@ def delete_pet(self, pet_id : Annotated[StrictInt, Field(..., description="Pet i :rtype: None """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the delete_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.delete_pet_with_http_info(pet_id, api_key, **kwargs) # noqa: E501 @validate_arguments - def delete_pet_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="Pet id to delete")], api_key : Optional[StrictStr] = None, **kwargs): # noqa: E501 + def delete_pet_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="Pet id to delete")], api_key : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 """Deletes a pet # noqa: E501 # noqa: E501 @@ -241,13 +241,14 @@ def delete_pet_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., des :type api_key: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -348,10 +349,6 @@ def find_pets_by_status(self, status : Annotated[conlist(StrictStr), Field(..., :type status: List[str] :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -362,10 +359,12 @@ def find_pets_by_status(self, status : Annotated[conlist(StrictStr), Field(..., :rtype: List[Pet] """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the find_pets_by_status_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501 @validate_arguments - def find_pets_by_status_with_http_info(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs): # noqa: E501 + def find_pets_by_status_with_http_info(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs) -> ApiResponse: # noqa: E501 """Finds Pets by status # noqa: E501 Multiple status values can be provided with comma separated strings # noqa: E501 @@ -379,13 +378,14 @@ def find_pets_by_status_with_http_info(self, status : Annotated[conlist(StrictSt :type status: List[str] :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -477,7 +477,7 @@ def find_pets_by_status_with_http_info(self, status : Annotated[conlist(StrictSt @validate_arguments def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr), Field(..., description="Tags to filter by")], **kwargs) -> List[Pet]: # noqa: E501 - """Finds Pets by tags # noqa: E501 + """(Deprecated) Finds Pets by tags # noqa: E501 Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -490,10 +490,6 @@ def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr), Field(..., desc :type tags: List[str] :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -504,11 +500,13 @@ def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr), Field(..., desc :rtype: List[Pet] """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the find_pets_by_tags_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501 @validate_arguments - def find_pets_by_tags_with_http_info(self, tags : Annotated[conlist(StrictStr), Field(..., description="Tags to filter by")], **kwargs): # noqa: E501 - """Finds Pets by tags # noqa: E501 + def find_pets_by_tags_with_http_info(self, tags : Annotated[conlist(StrictStr), Field(..., description="Tags to filter by")], **kwargs) -> ApiResponse: # noqa: E501 + """(Deprecated) Finds Pets by tags # noqa: E501 Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -521,13 +519,14 @@ def find_pets_by_tags_with_http_info(self, tags : Annotated[conlist(StrictStr), :type tags: List[str] :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -543,6 +542,8 @@ def find_pets_by_tags_with_http_info(self, tags : Annotated[conlist(StrictStr), :rtype: tuple(List[Pet], status_code(int), headers(HTTPHeaderDict)) """ + warnings.warn("GET /pet/findByTags is deprecated.", DeprecationWarning) + _params = locals() _all_params = [ @@ -632,10 +633,6 @@ def get_pet_by_id(self, pet_id : Annotated[StrictInt, Field(..., description="ID :type pet_id: int :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -646,10 +643,12 @@ def get_pet_by_id(self, pet_id : Annotated[StrictInt, Field(..., description="ID :rtype: Pet """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the get_pet_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.get_pet_by_id_with_http_info(pet_id, **kwargs) # noqa: E501 @validate_arguments - def get_pet_by_id_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to return")], **kwargs): # noqa: E501 + def get_pet_by_id_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to return")], **kwargs) -> ApiResponse: # noqa: E501 """Find pet by ID # noqa: E501 Returns a single pet # noqa: E501 @@ -663,13 +662,14 @@ def get_pet_by_id_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., :type pet_id: int :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -774,10 +774,6 @@ def update_pet(self, pet : Annotated[Pet, Field(..., description="Pet object tha :type pet: Pet :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -788,10 +784,12 @@ def update_pet(self, pet : Annotated[Pet, Field(..., description="Pet object tha :rtype: Pet """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the update_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.update_pet_with_http_info(pet, **kwargs) # noqa: E501 @validate_arguments - def update_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs): # noqa: E501 + def update_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> ApiResponse: # noqa: E501 """Update an existing pet # noqa: E501 # noqa: E501 @@ -805,13 +803,14 @@ def update_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description= :type pet: Pet :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -868,7 +867,7 @@ def update_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description= _files = {} # process the body parameter _body_params = None - if _params['pet']: + if _params['pet'] is not None: _body_params = _params['pet'] # set the HTTP header `Accept` @@ -928,10 +927,6 @@ def update_pet_with_form(self, pet_id : Annotated[StrictInt, Field(..., descript :type status: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -942,10 +937,12 @@ def update_pet_with_form(self, pet_id : Annotated[StrictInt, Field(..., descript :rtype: None """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the update_pet_with_form_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.update_pet_with_form_with_http_info(pet_id, name, status, **kwargs) # noqa: E501 @validate_arguments - def update_pet_with_form_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet that needs to be updated")], name : Annotated[Optional[StrictStr], Field(description="Updated name of the pet")] = None, status : Annotated[Optional[StrictStr], Field(description="Updated status of the pet")] = None, **kwargs): # noqa: E501 + def update_pet_with_form_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet that needs to be updated")], name : Annotated[Optional[StrictStr], Field(description="Updated name of the pet")] = None, status : Annotated[Optional[StrictStr], Field(description="Updated status of the pet")] = None, **kwargs) -> ApiResponse: # noqa: E501 """Updates a pet in the store with form data # noqa: E501 # noqa: E501 @@ -963,13 +960,14 @@ def update_pet_with_form_with_http_info(self, pet_id : Annotated[StrictInt, Fiel :type status: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1067,7 +1065,7 @@ def update_pet_with_form_with_http_info(self, pet_id : Annotated[StrictInt, Fiel _request_auth=_params.get('_request_auth')) @validate_arguments - def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[StrictStr], Field(description="file to upload")] = None, **kwargs) -> ApiResponse: # noqa: E501 + def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, **kwargs) -> ApiResponse: # noqa: E501 """uploads an image # noqa: E501 # noqa: E501 @@ -1085,10 +1083,6 @@ def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID o :type file: bytearray :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1099,10 +1093,12 @@ def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID o :rtype: ApiResponse """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the upload_file_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.upload_file_with_http_info(pet_id, additional_metadata, file, **kwargs) # noqa: E501 @validate_arguments - def upload_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[StrictStr], Field(description="file to upload")] = None, **kwargs): # noqa: E501 + def upload_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, **kwargs) -> ApiResponse: # noqa: E501 """uploads an image # noqa: E501 # noqa: E501 @@ -1120,13 +1116,14 @@ def upload_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., de :type file: bytearray :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of diff --git a/petstore/openapi_generator_python_nextgen/openapi_client/api/store_api.py b/petstore/openapi_generator_python_nextgen/openapi_client/api/store_api.py index d45fdfa..ec11d15 100644 --- a/petstore/openapi_generator_python_nextgen/openapi_client/api/store_api.py +++ b/petstore/openapi_generator_python_nextgen/openapi_client/api/store_api.py @@ -13,6 +13,8 @@ import re # noqa: F401 +import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated @@ -24,6 +26,7 @@ from openapi_client.models.order import Order from openapi_client.api_client import ApiClient +from openapi_client.api_response import ApiResponse from openapi_client.exceptions import ( # noqa: F401 ApiTypeError, ApiValueError @@ -57,10 +60,6 @@ def delete_order(self, order_id : Annotated[StrictStr, Field(..., description="I :type order_id: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -71,10 +70,12 @@ def delete_order(self, order_id : Annotated[StrictStr, Field(..., description="I :rtype: None """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the delete_order_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.delete_order_with_http_info(order_id, **kwargs) # noqa: E501 @validate_arguments - def delete_order_with_http_info(self, order_id : Annotated[StrictStr, Field(..., description="ID of the order that needs to be deleted")], **kwargs): # noqa: E501 + def delete_order_with_http_info(self, order_id : Annotated[StrictStr, Field(..., description="ID of the order that needs to be deleted")], **kwargs) -> ApiResponse: # noqa: E501 """Delete purchase order by ID # noqa: E501 For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors # noqa: E501 @@ -88,13 +89,14 @@ def delete_order_with_http_info(self, order_id : Annotated[StrictStr, Field(..., :type order_id: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -189,10 +191,6 @@ def get_inventory(self, **kwargs) -> Dict[str, int]: # noqa: E501 :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -203,10 +201,12 @@ def get_inventory(self, **kwargs) -> Dict[str, int]: # noqa: E501 :rtype: Dict[str, int] """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the get_inventory_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.get_inventory_with_http_info(**kwargs) # noqa: E501 @validate_arguments - def get_inventory_with_http_info(self, **kwargs): # noqa: E501 + def get_inventory_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 """Returns pet inventories by status # noqa: E501 Returns a map of status codes to quantities # noqa: E501 @@ -218,13 +218,14 @@ def get_inventory_with_http_info(self, **kwargs): # noqa: E501 :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -323,10 +324,6 @@ def get_order_by_id(self, order_id : Annotated[conint(strict=True, le=5, ge=1), :type order_id: int :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -337,10 +334,12 @@ def get_order_by_id(self, order_id : Annotated[conint(strict=True, le=5, ge=1), :rtype: Order """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the get_order_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.get_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501 @validate_arguments - def get_order_by_id_with_http_info(self, order_id : Annotated[conint(strict=True, le=5, ge=1), Field(..., description="ID of pet that needs to be fetched")], **kwargs): # noqa: E501 + def get_order_by_id_with_http_info(self, order_id : Annotated[conint(strict=True, le=5, ge=1), Field(..., description="ID of pet that needs to be fetched")], **kwargs) -> ApiResponse: # noqa: E501 """Find purchase order by ID # noqa: E501 For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions # noqa: E501 @@ -354,13 +353,14 @@ def get_order_by_id_with_http_info(self, order_id : Annotated[conint(strict=True :type order_id: int :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -465,10 +465,6 @@ def place_order(self, order : Annotated[Order, Field(..., description="order pla :type order: Order :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -479,10 +475,12 @@ def place_order(self, order : Annotated[Order, Field(..., description="order pla :rtype: Order """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the place_order_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.place_order_with_http_info(order, **kwargs) # noqa: E501 @validate_arguments - def place_order_with_http_info(self, order : Annotated[Order, Field(..., description="order placed for purchasing the pet")], **kwargs): # noqa: E501 + def place_order_with_http_info(self, order : Annotated[Order, Field(..., description="order placed for purchasing the pet")], **kwargs) -> ApiResponse: # noqa: E501 """Place an order for a pet # noqa: E501 # noqa: E501 @@ -496,13 +494,14 @@ def place_order_with_http_info(self, order : Annotated[Order, Field(..., descrip :type order: Order :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -559,7 +558,7 @@ def place_order_with_http_info(self, order : Annotated[Order, Field(..., descrip _files = {} # process the body parameter _body_params = None - if _params['order']: + if _params['order'] is not None: _body_params = _params['order'] # set the HTTP header `Accept` diff --git a/petstore/openapi_generator_python_nextgen/openapi_client/api/user_api.py b/petstore/openapi_generator_python_nextgen/openapi_client/api/user_api.py index e66aa97..3eae176 100644 --- a/petstore/openapi_generator_python_nextgen/openapi_client/api/user_api.py +++ b/petstore/openapi_generator_python_nextgen/openapi_client/api/user_api.py @@ -13,6 +13,8 @@ import re # noqa: F401 +import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated @@ -22,6 +24,7 @@ from openapi_client.models.user import User from openapi_client.api_client import ApiClient +from openapi_client.api_response import ApiResponse from openapi_client.exceptions import ( # noqa: F401 ApiTypeError, ApiValueError @@ -55,10 +58,6 @@ def create_user(self, user : Annotated[User, Field(..., description="Created use :type user: User :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -69,10 +68,12 @@ def create_user(self, user : Annotated[User, Field(..., description="Created use :rtype: None """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the create_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.create_user_with_http_info(user, **kwargs) # noqa: E501 @validate_arguments - def create_user_with_http_info(self, user : Annotated[User, Field(..., description="Created user object")], **kwargs): # noqa: E501 + def create_user_with_http_info(self, user : Annotated[User, Field(..., description="Created user object")], **kwargs) -> ApiResponse: # noqa: E501 """Create user # noqa: E501 This can only be done by the logged in user. # noqa: E501 @@ -86,13 +87,14 @@ def create_user_with_http_info(self, user : Annotated[User, Field(..., descripti :type user: User :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -149,7 +151,7 @@ def create_user_with_http_info(self, user : Annotated[User, Field(..., descripti _files = {} # process the body parameter _body_params = None - if _params['user']: + if _params['user'] is not None: _body_params = _params['user'] # set the HTTP header `Content-Type` @@ -196,10 +198,6 @@ def create_users_with_array_input(self, user : Annotated[conlist(User), Field(.. :type user: List[User] :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -210,10 +208,12 @@ def create_users_with_array_input(self, user : Annotated[conlist(User), Field(.. :rtype: None """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the create_users_with_array_input_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.create_users_with_array_input_with_http_info(user, **kwargs) # noqa: E501 @validate_arguments - def create_users_with_array_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs): # noqa: E501 + def create_users_with_array_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> ApiResponse: # noqa: E501 """Creates list of users with given input array # noqa: E501 # noqa: E501 @@ -227,13 +227,14 @@ def create_users_with_array_input_with_http_info(self, user : Annotated[conlist( :type user: List[User] :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -290,7 +291,7 @@ def create_users_with_array_input_with_http_info(self, user : Annotated[conlist( _files = {} # process the body parameter _body_params = None - if _params['user']: + if _params['user'] is not None: _body_params = _params['user'] # set the HTTP header `Content-Type` @@ -337,10 +338,6 @@ def create_users_with_list_input(self, user : Annotated[conlist(User), Field(... :type user: List[User] :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -351,10 +348,12 @@ def create_users_with_list_input(self, user : Annotated[conlist(User), Field(... :rtype: None """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the create_users_with_list_input_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.create_users_with_list_input_with_http_info(user, **kwargs) # noqa: E501 @validate_arguments - def create_users_with_list_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs): # noqa: E501 + def create_users_with_list_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> ApiResponse: # noqa: E501 """Creates list of users with given input array # noqa: E501 # noqa: E501 @@ -368,13 +367,14 @@ def create_users_with_list_input_with_http_info(self, user : Annotated[conlist(U :type user: List[User] :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -431,7 +431,7 @@ def create_users_with_list_input_with_http_info(self, user : Annotated[conlist(U _files = {} # process the body parameter _body_params = None - if _params['user']: + if _params['user'] is not None: _body_params = _params['user'] # set the HTTP header `Content-Type` @@ -478,10 +478,6 @@ def delete_user(self, username : Annotated[StrictStr, Field(..., description="Th :type username: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -492,10 +488,12 @@ def delete_user(self, username : Annotated[StrictStr, Field(..., description="Th :rtype: None """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the delete_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.delete_user_with_http_info(username, **kwargs) # noqa: E501 @validate_arguments - def delete_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be deleted")], **kwargs): # noqa: E501 + def delete_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be deleted")], **kwargs) -> ApiResponse: # noqa: E501 """Delete user # noqa: E501 This can only be done by the logged in user. # noqa: E501 @@ -509,13 +507,14 @@ def delete_user_with_http_info(self, username : Annotated[StrictStr, Field(..., :type username: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -612,10 +611,6 @@ def get_user_by_name(self, username : Annotated[StrictStr, Field(..., descriptio :type username: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -626,10 +621,12 @@ def get_user_by_name(self, username : Annotated[StrictStr, Field(..., descriptio :rtype: User """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the get_user_by_name_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.get_user_by_name_with_http_info(username, **kwargs) # noqa: E501 @validate_arguments - def get_user_by_name_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be fetched. Use user1 for testing.")], **kwargs): # noqa: E501 + def get_user_by_name_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be fetched. Use user1 for testing.")], **kwargs) -> ApiResponse: # noqa: E501 """Get user by user name # noqa: E501 # noqa: E501 @@ -643,13 +640,14 @@ def get_user_by_name_with_http_info(self, username : Annotated[StrictStr, Field( :type username: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -756,10 +754,6 @@ def login_user(self, username : Annotated[constr(strict=True), Field(..., descri :type password: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -770,10 +764,12 @@ def login_user(self, username : Annotated[constr(strict=True), Field(..., descri :rtype: str """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the login_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.login_user_with_http_info(username, password, **kwargs) # noqa: E501 @validate_arguments - def login_user_with_http_info(self, username : Annotated[constr(strict=True), Field(..., description="The user name for login")], password : Annotated[StrictStr, Field(..., description="The password for login in clear text")], **kwargs): # noqa: E501 + def login_user_with_http_info(self, username : Annotated[constr(strict=True), Field(..., description="The user name for login")], password : Annotated[StrictStr, Field(..., description="The password for login in clear text")], **kwargs) -> ApiResponse: # noqa: E501 """Logs user into the system # noqa: E501 # noqa: E501 @@ -789,13 +785,14 @@ def login_user_with_http_info(self, username : Annotated[constr(strict=True), Fi :type password: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -901,10 +898,6 @@ def logout_user(self, **kwargs) -> None: # noqa: E501 :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -915,10 +908,12 @@ def logout_user(self, **kwargs) -> None: # noqa: E501 :rtype: None """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the logout_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.logout_user_with_http_info(**kwargs) # noqa: E501 @validate_arguments - def logout_user_with_http_info(self, **kwargs): # noqa: E501 + def logout_user_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 """Logs out current logged in user session # noqa: E501 # noqa: E501 @@ -930,13 +925,14 @@ def logout_user_with_http_info(self, **kwargs): # noqa: E501 :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1031,10 +1027,6 @@ def update_user(self, username : Annotated[StrictStr, Field(..., description="na :type user: User :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. - :type _preload_content: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1045,10 +1037,12 @@ def update_user(self, username : Annotated[StrictStr, Field(..., description="na :rtype: None """ kwargs['_return_http_data_only'] = True + if '_preload_content' in kwargs: + raise ValueError("Error! Please call the update_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.update_user_with_http_info(username, user, **kwargs) # noqa: E501 @validate_arguments - def update_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="name that need to be deleted")], user : Annotated[User, Field(..., description="Updated user object")], **kwargs): # noqa: E501 + def update_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="name that need to be deleted")], user : Annotated[User, Field(..., description="Updated user object")], **kwargs) -> ApiResponse: # noqa: E501 """Updated user # noqa: E501 This can only be done by the logged in user. # noqa: E501 @@ -1064,13 +1058,14 @@ def update_user_with_http_info(self, username : Annotated[StrictStr, Field(..., :type user: User :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional - :param _return_http_data_only: response data without head status code - and headers - :type _return_http_data_only: bool, optional - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1131,7 +1126,7 @@ def update_user_with_http_info(self, username : Annotated[StrictStr, Field(..., _files = {} # process the body parameter _body_params = None - if _params['user']: + if _params['user'] is not None: _body_params = _params['user'] # set the HTTP header `Content-Type` diff --git a/petstore/openapi_generator_python_nextgen/openapi_client/api_client.py b/petstore/openapi_generator_python_nextgen/openapi_client/api_client.py index 80144b7..60b5512 100644 --- a/petstore/openapi_generator_python_nextgen/openapi_client/api_client.py +++ b/petstore/openapi_generator_python_nextgen/openapi_client/api_client.py @@ -25,6 +25,7 @@ from urllib.parse import quote from openapi_client.configuration import Configuration +from openapi_client.api_response import ApiResponse import openapi_client.models from openapi_client import rest from openapi_client.exceptions import ApiValueError, ApiException @@ -221,36 +222,36 @@ def __call_api( self.last_response = response_data - return_data = response_data - - if not _preload_content: - return return_data - - response_type = response_types_map.get(str(response_data.status), None) - - if response_type == "bytearray": - response_data.data = response_data.data - else: - match = None - content_type = response_data.getheader('content-type') - if content_type is not None: - match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) - encoding = match.group(1) if match else "utf-8" - response_data.data = response_data.data.decode(encoding) - - # deserialize response data - if response_type == "bytearray": - return_data = response_data.data - elif response_type: - return_data = self.deserialize(response_data, response_type) - else: - return_data = None + return_data = None # assuming derialization is not needed + # data needs deserialization or returns HTTP data (deserialized) only + if _preload_content or _return_http_data_only: + response_type = response_types_map.get(str(response_data.status), None) + + if response_type == "bytearray": + response_data.data = response_data.data + else: + match = None + content_type = response_data.getheader('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_data.data = response_data.data.decode(encoding) + + # deserialize response data + if response_type == "bytearray": + return_data = response_data.data + elif response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None if _return_http_data_only: - return (return_data) + return return_data else: - return (return_data, response_data.status, - response_data.getheaders()) + return ApiResponse(status_code = response_data.status, + data = return_data, + headers = response_data.getheaders(), + raw_data = response_data.data) def sanitize_for_serialization(self, obj): """Builds a JSON POST object. @@ -358,8 +359,8 @@ def call_api(self, resource_path, method, body=None, post_params=None, files=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): + 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. @@ -378,13 +379,14 @@ def call_api(self, resource_path, method, :param files dict: key -> filename, value -> filepath, for `multipart/form-data`. :param async_req bool: execute request asynchronously - :param _return_http_data_only: response data without head status code - and headers + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. :param collection_formats: dict of collection formats for path, query, header, and post parameters. - :param _preload_content: if False, the urllib3.HTTPResponse object will - be returned without reading/decoding response - data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of diff --git a/petstore/openapi_generator_python_nextgen/openapi_client/api_response.py b/petstore/openapi_generator_python_nextgen/openapi_client/api_response.py new file mode 100644 index 0000000..d81c2ff --- /dev/null +++ b/petstore/openapi_generator_python_nextgen/openapi_client/api_response.py @@ -0,0 +1,25 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Any, Dict, Optional +from pydantic import Field, StrictInt, StrictStr + +class ApiResponse: + """ + API response object + """ + + status_code: Optional[StrictInt] = Field(None, description="HTTP status code") + headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") + data: Optional[Any] = Field(None, description="Deserialized data given the data type") + raw_data: Optional[Any] = Field(None, description="Raw data (HTTP response body)") + + def __init__(self, + status_code=None, + headers=None, + data=None, + raw_data=None): + self.status_code = status_code + self.headers = headers + self.data = data + self.raw_data = raw_data diff --git a/petstore/openapi_generator_python_nextgen/openapi_client/configuration.py b/petstore/openapi_generator_python_nextgen/openapi_client/configuration.py index 88df810..1c11c5c 100644 --- a/petstore/openapi_generator_python_nextgen/openapi_client/configuration.py +++ b/petstore/openapi_generator_python_nextgen/openapi_client/configuration.py @@ -165,6 +165,10 @@ def __init__(self, host=None, self.assert_hostname = None """Set this to True/False to enable/disable SSL hostname verification. """ + self.tls_server_name = None + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 """urllib3 connection pool's maximum number of connections saved diff --git a/petstore/openapi_generator_python_nextgen/openapi_client/models/api_response.py b/petstore/openapi_generator_python_nextgen/openapi_client/models/api_response.py index 6b72726..79eb670 100644 --- a/petstore/openapi_generator_python_nextgen/openapi_client/models/api_response.py +++ b/petstore/openapi_generator_python_nextgen/openapi_client/models/api_response.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -32,6 +31,7 @@ class ApiResponse(BaseModel): __properties = ["code", "type", "message"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -62,7 +62,7 @@ def from_dict(cls, obj: dict) -> ApiResponse: if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return ApiResponse.parse_obj(obj) _obj = ApiResponse.parse_obj({ diff --git a/petstore/openapi_generator_python_nextgen/openapi_client/models/category.py b/petstore/openapi_generator_python_nextgen/openapi_client/models/category.py index 719eaa9..4a7b89b 100644 --- a/petstore/openapi_generator_python_nextgen/openapi_client/models/category.py +++ b/petstore/openapi_generator_python_nextgen/openapi_client/models/category.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,12 +30,17 @@ class Category(BaseModel): __properties = ["id", "name"] @validator('name') - def name_validate_regular_expression(cls, v): - if not re.match(r"^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$", v): + def name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$", value): raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$/") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -67,7 +71,7 @@ def from_dict(cls, obj: dict) -> Category: if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Category.parse_obj(obj) _obj = Category.parse_obj({ diff --git a/petstore/openapi_generator_python_nextgen/openapi_client/models/order.py b/petstore/openapi_generator_python_nextgen/openapi_client/models/order.py index b9784d9..1a2f54a 100644 --- a/petstore/openapi_generator_python_nextgen/openapi_client/models/order.py +++ b/petstore/openapi_generator_python_nextgen/openapi_client/models/order.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -35,14 +34,17 @@ class Order(BaseModel): __properties = ["id", "petId", "quantity", "shipDate", "status", "complete"] @validator('status') - def status_validate_enum(cls, v): - if v is None: - return v - if v not in ('placed', 'approved', 'delivered'): + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('placed', 'approved', 'delivered'): raise ValueError("must be one of enum values ('placed', 'approved', 'delivered')") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -73,7 +75,7 @@ def from_dict(cls, obj: dict) -> Order: if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Order.parse_obj(obj) _obj = Order.parse_obj({ diff --git a/petstore/openapi_generator_python_nextgen/openapi_client/models/pet.py b/petstore/openapi_generator_python_nextgen/openapi_client/models/pet.py index 0d62529..93537bb 100644 --- a/petstore/openapi_generator_python_nextgen/openapi_client/models/pet.py +++ b/petstore/openapi_generator_python_nextgen/openapi_client/models/pet.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -30,21 +29,24 @@ class Pet(BaseModel): """ id: Optional[StrictInt] = None category: Optional[Category] = None - name: StrictStr = ... + name: StrictStr = Field(...) photo_urls: conlist(StrictStr) = Field(..., alias="photoUrls") tags: Optional[conlist(Tag)] = None status: Optional[StrictStr] = Field(None, description="pet status in the store") __properties = ["id", "category", "name", "photoUrls", "tags", "status"] @validator('status') - def status_validate_enum(cls, v): - if v is None: - return v - if v not in ('available', 'pending', 'sold'): + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('available', 'pending', 'sold'): raise ValueError("must be one of enum values ('available', 'pending', 'sold')") - return v + return value class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -85,7 +87,7 @@ def from_dict(cls, obj: dict) -> Pet: if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Pet.parse_obj(obj) _obj = Pet.parse_obj({ diff --git a/petstore/openapi_generator_python_nextgen/openapi_client/models/tag.py b/petstore/openapi_generator_python_nextgen/openapi_client/models/tag.py index 5c7021b..97d58ff 100644 --- a/petstore/openapi_generator_python_nextgen/openapi_client/models/tag.py +++ b/petstore/openapi_generator_python_nextgen/openapi_client/models/tag.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -31,6 +30,7 @@ class Tag(BaseModel): __properties = ["id", "name"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -61,7 +61,7 @@ def from_dict(cls, obj: dict) -> Tag: if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return Tag.parse_obj(obj) _obj = Tag.parse_obj({ diff --git a/petstore/openapi_generator_python_nextgen/openapi_client/models/user.py b/petstore/openapi_generator_python_nextgen/openapi_client/models/user.py index 6cc929f..0b87a69 100644 --- a/petstore/openapi_generator_python_nextgen/openapi_client/models/user.py +++ b/petstore/openapi_generator_python_nextgen/openapi_client/models/user.py @@ -13,7 +13,6 @@ from __future__ import annotations -from inspect import getfullargspec import pprint import re # noqa: F401 import json @@ -37,6 +36,7 @@ class User(BaseModel): __properties = ["id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus"] class Config: + """Pydantic configuration""" allow_population_by_field_name = True validate_assignment = True @@ -67,7 +67,7 @@ def from_dict(cls, obj: dict) -> User: if obj is None: return None - if type(obj) is not dict: + if not isinstance(obj, dict): return User.parse_obj(obj) _obj = User.parse_obj({ diff --git a/petstore/openapi_generator_python_nextgen/openapi_client/rest.py b/petstore/openapi_generator_python_nextgen/openapi_client/rest.py index d01dc6e..2f92288 100644 --- a/petstore/openapi_generator_python_nextgen/openapi_client/rest.py +++ b/petstore/openapi_generator_python_nextgen/openapi_client/rest.py @@ -66,6 +66,10 @@ def __init__(self, configuration, pools_size=4, maxsize=None): if configuration.retries is not None: addition_pool_args['retries'] = configuration.retries + if configuration.tls_server_name: + addition_pool_args['server_hostname'] = configuration.tls_server_name + + if configuration.socket_options is not None: addition_pool_args['socket_options'] = configuration.socket_options diff --git a/petstore/openapi_generator_python_nextgen/pyproject.toml b/petstore/openapi_generator_python_nextgen/pyproject.toml index af3d65b..6acee31 100644 --- a/petstore/openapi_generator_python_nextgen/pyproject.toml +++ b/petstore/openapi_generator_python_nextgen/pyproject.toml @@ -2,10 +2,10 @@ name = "openapi_client" version = "1.0.0" description = "OpenAPI Petstore" -authors = ["team@openapitools.org"] +authors = ["OpenAPI Generator Community "] license = "Apache-2.0" readme = "README.md" -repository = "https://github.com/GIT_REPO_ID/GIT_USER_ID" +repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID" keywords = ["OpenAPI", "OpenAPI-Generator", "OpenAPI Petstore"] [tool.poetry.dependencies] @@ -13,14 +13,17 @@ python = "^3.7" urllib3 = ">= 1.25.3" python-dateutil = ">=2.8.2" -pydantic = ">= 1.10.5" +pydantic = "^1.10.5, <2" aenum = ">=3.1.11" [tool.poetry.dev-dependencies] pytest = ">=7.2.1" -tox = ">=4.4.6" -flake8 = ">=6.0.0" +tox = ">=3.9.0" +flake8 = ">=4.0.0" [build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" + +[tool.pylint.'MESSAGES CONTROL'] +extension-pkg-whitelist = "pydantic" diff --git a/petstore/openapi_generator_python_nextgen/requirements.txt b/petstore/openapi_generator_python_nextgen/requirements.txt index b98ff3e..74ede17 100644 --- a/petstore/openapi_generator_python_nextgen/requirements.txt +++ b/petstore/openapi_generator_python_nextgen/requirements.txt @@ -1,5 +1,5 @@ python_dateutil >= 2.5.3 setuptools >= 21.0.0 urllib3 >= 1.25.3 -pydantic >= 1.10.2 +pydantic >= 1.10.5, < 2 aenum >= 3.1.11 diff --git a/petstore/openapi_generator_python_nextgen/setup.py b/petstore/openapi_generator_python_nextgen/setup.py index d4543f0..8f13d97 100644 --- a/petstore/openapi_generator_python_nextgen/setup.py +++ b/petstore/openapi_generator_python_nextgen/setup.py @@ -26,7 +26,7 @@ REQUIRES = [ "urllib3 >= 1.25.3", "python-dateutil", - "pydantic", + "pydantic >= 1.10.5, < 2", "aenum" ]