From ffb4be85856acbdb23f3a1cdef1d5024d95c9f77 Mon Sep 17 00:00:00 2001 From: Jonathan Ballet Date: Sun, 31 Dec 2023 23:21:43 +0100 Subject: [PATCH 1/8] python: adjust basic typing information This is an initial pass to fix and adjust the typing information for the generated client. This is enough to have mypy runnning without complains on all the (modern) generated clients (Pydantic v1 code is not checked for instance) mypy is also now run directly in the CI, so further changes will also be checked and thus, will need to be compliant with good typing information. Note that this doesn't *fully* type all the code: mypy is not run in "strict" mode and there are still many functions/methods/attributes which are still not fully typed, but it's a first good step in that direction. --- .../samples-python-client-echo-api.yaml | 4 + .../workflows/samples-python-petstore.yaml | 4 + bin/configs/python-aiohttp.yaml | 3 + .../resources/python/__init__package.mustache | 2 +- .../src/main/resources/python/api.mustache | 12 +- .../main/resources/python/api_client.mustache | 11 +- .../resources/python/api_response.mustache | 2 +- .../resources/python/asyncio/rest.mustache | 2 + .../main/resources/python/exceptions.mustache | 1 - .../resources/python/model_anyof.mustache | 20 +- .../main/resources/python/model_enum.mustache | 5 +- .../resources/python/model_generic.mustache | 53 +- .../resources/python/model_oneof.mustache | 16 +- .../main/resources/python/pyproject.mustache | 6 + .../src/main/resources/python/rest.mustache | 51 +- .../python/test-requirements.mustache | 2 + .../openapi_client/__init__.py | 2 +- .../openapi_client/api/auth_api.py | 14 +- .../openapi_client/api/body_api.py | 28 +- .../openapi_client/api/form_api.py | 14 +- .../openapi_client/api/header_api.py | 12 +- .../openapi_client/api/path_api.py | 12 +- .../openapi_client/api/query_api.py | 26 +- .../openapi_client/api_client.py | 11 +- .../openapi_client/api_response.py | 2 +- .../openapi_client/exceptions.py | 1 - .../openapi_client/models/bird.py | 16 +- .../openapi_client/models/category.py | 16 +- .../openapi_client/models/data_query.py | 16 +- .../openapi_client/models/default_value.py | 16 +- .../models/number_properties_only.py | 16 +- .../openapi_client/models/pet.py | 20 +- .../openapi_client/models/query.py | 16 +- .../openapi_client/models/string_enum_ref.py | 5 +- .../openapi_client/models/tag.py | 16 +- ...ue_object_all_of_query_object_parameter.py | 16 +- ...rue_array_string_query_object_parameter.py | 16 +- .../openapi_client/rest.py | 51 +- .../pyproject.toml | 6 + .../test-requirements.txt | 2 + .../python/openapi_client/__init__.py | 2 +- .../python/openapi_client/api/auth_api.py | 14 +- .../python/openapi_client/api/body_api.py | 28 +- .../python/openapi_client/api/form_api.py | 14 +- .../python/openapi_client/api/header_api.py | 12 +- .../python/openapi_client/api/path_api.py | 12 +- .../python/openapi_client/api/query_api.py | 26 +- .../python/openapi_client/api_client.py | 11 +- .../python/openapi_client/api_response.py | 2 +- .../python/openapi_client/exceptions.py | 1 - .../python/openapi_client/models/bird.py | 16 +- .../python/openapi_client/models/category.py | 16 +- .../openapi_client/models/data_query.py | 16 +- .../openapi_client/models/default_value.py | 16 +- .../models/number_properties_only.py | 16 +- .../python/openapi_client/models/pet.py | 20 +- .../python/openapi_client/models/query.py | 16 +- .../openapi_client/models/string_enum_ref.py | 5 +- .../python/openapi_client/models/tag.py | 16 +- ...ue_object_all_of_query_object_parameter.py | 16 +- ...rue_array_string_query_object_parameter.py | 16 +- .../echo_api/python/openapi_client/rest.py | 51 +- samples/client/echo_api/python/poetry.lock | 614 ++++++++++++++++++ samples/client/echo_api/python/pyproject.toml | 6 + .../echo_api/python/test-requirements.txt | 2 + .../docs/PropertyNameCollision.md | 4 +- .../python-aiohttp/petstore_api/__init__.py | 2 +- .../petstore_api/api/another_fake_api.py | 12 +- .../petstore_api/api/default_api.py | 12 +- .../petstore_api/api/fake_api.py | 60 +- .../api/fake_classname_tags123_api.py | 12 +- .../petstore_api/api/pet_api.py | 28 +- .../petstore_api/api/store_api.py | 18 +- .../petstore_api/api/user_api.py | 26 +- .../python-aiohttp/petstore_api/api_client.py | 11 +- .../petstore_api/api_response.py | 2 +- .../python-aiohttp/petstore_api/exceptions.py | 1 - .../models/additional_properties_any_type.py | 18 +- .../models/additional_properties_class.py | 16 +- .../models/additional_properties_object.py | 18 +- ...tional_properties_with_description_only.py | 18 +- .../models/all_of_with_single_ref.py | 16 +- .../petstore_api/models/animal.py | 20 +- .../petstore_api/models/any_of_color.py | 20 +- .../petstore_api/models/any_of_pig.py | 20 +- .../petstore_api/models/api_response.py | 16 +- .../models/array_of_array_of_model.py | 18 +- .../models/array_of_array_of_number_only.py | 16 +- .../models/array_of_number_only.py | 16 +- .../petstore_api/models/array_test.py | 18 +- .../petstore_api/models/basque_pig.py | 16 +- .../petstore_api/models/capitalization.py | 16 +- .../python-aiohttp/petstore_api/models/cat.py | 16 +- .../petstore_api/models/category.py | 16 +- .../models/circular_reference_model.py | 18 +- .../petstore_api/models/class_model.py | 16 +- .../petstore_api/models/client.py | 16 +- .../petstore_api/models/color.py | 16 +- .../petstore_api/models/creature.py | 18 +- .../petstore_api/models/creature_info.py | 16 +- .../petstore_api/models/danish_pig.py | 16 +- .../petstore_api/models/deprecated_object.py | 16 +- .../python-aiohttp/petstore_api/models/dog.py | 16 +- .../petstore_api/models/dummy_model.py | 18 +- .../petstore_api/models/enum_arrays.py | 16 +- .../petstore_api/models/enum_class.py | 5 +- .../petstore_api/models/enum_string1.py | 5 +- .../petstore_api/models/enum_string2.py | 5 +- .../petstore_api/models/enum_test.py | 16 +- .../petstore_api/models/file.py | 16 +- .../models/file_schema_test_class.py | 20 +- .../petstore_api/models/first_ref.py | 18 +- .../python-aiohttp/petstore_api/models/foo.py | 16 +- .../models/foo_get_default_response.py | 18 +- .../petstore_api/models/format_test.py | 16 +- .../petstore_api/models/has_only_read_only.py | 20 +- .../models/health_check_result.py | 16 +- .../models/inner_dict_with_property.py | 16 +- .../petstore_api/models/int_or_string.py | 16 +- .../petstore_api/models/list_class.py | 16 +- .../models/map_of_array_of_model.py | 18 +- .../petstore_api/models/map_test.py | 16 +- ...perties_and_additional_properties_class.py | 18 +- .../petstore_api/models/model200_response.py | 16 +- .../petstore_api/models/model_return.py | 16 +- .../petstore_api/models/name.py | 20 +- .../petstore_api/models/nullable_class.py | 18 +- .../petstore_api/models/nullable_property.py | 16 +- .../petstore_api/models/number_only.py | 16 +- .../object_to_test_additional_properties.py | 16 +- .../models/object_with_deprecated_fields.py | 18 +- .../petstore_api/models/one_of_enum_string.py | 16 +- .../petstore_api/models/order.py | 16 +- .../petstore_api/models/outer_composite.py | 16 +- .../petstore_api/models/outer_enum.py | 5 +- .../models/outer_enum_default_value.py | 5 +- .../petstore_api/models/outer_enum_integer.py | 5 +- .../outer_enum_integer_default_value.py | 5 +- .../models/outer_object_with_enum_property.py | 16 +- .../petstore_api/models/parent.py | 18 +- .../models/parent_with_optional_dict.py | 18 +- .../python-aiohttp/petstore_api/models/pet.py | 20 +- .../python-aiohttp/petstore_api/models/pig.py | 16 +- .../models/property_name_collision.py | 20 +- .../petstore_api/models/read_only_first.py | 18 +- .../petstore_api/models/second_ref.py | 18 +- .../models/self_reference_model.py | 18 +- .../petstore_api/models/single_ref_type.py | 5 +- .../models/special_character_enum.py | 5 +- .../petstore_api/models/special_model_name.py | 16 +- .../petstore_api/models/special_name.py | 18 +- .../python-aiohttp/petstore_api/models/tag.py | 16 +- ..._error_responses_with_model400_response.py | 16 +- ..._error_responses_with_model404_response.py | 16 +- ..._freeform_additional_properties_request.py | 18 +- .../petstore_api/models/tiger.py | 16 +- ...t_with_additional_model_list_properties.py | 18 +- ..._with_additional_string_list_properties.py | 16 +- .../petstore_api/models/user.py | 16 +- .../petstore_api/models/with_nested_one_of.py | 20 +- .../python-aiohttp/petstore_api/rest.py | 2 + .../petstore/python-aiohttp/pyproject.toml | 6 + .../python-aiohttp/test-requirements.txt | 2 + .../petstore/python/petstore_api/__init__.py | 2 +- .../petstore_api/api/another_fake_api.py | 12 +- .../python/petstore_api/api/default_api.py | 12 +- .../python/petstore_api/api/fake_api.py | 60 +- .../api/fake_classname_tags123_api.py | 12 +- .../python/petstore_api/api/pet_api.py | 28 +- .../python/petstore_api/api/store_api.py | 18 +- .../python/petstore_api/api/user_api.py | 26 +- .../python/petstore_api/api_client.py | 11 +- .../python/petstore_api/api_response.py | 2 +- .../python/petstore_api/exceptions.py | 1 - .../models/additional_properties_any_type.py | 18 +- .../models/additional_properties_class.py | 18 +- .../models/additional_properties_object.py | 18 +- ...tional_properties_with_description_only.py | 18 +- .../models/all_of_with_single_ref.py | 18 +- .../python/petstore_api/models/animal.py | 22 +- .../petstore_api/models/any_of_color.py | 20 +- .../python/petstore_api/models/any_of_pig.py | 20 +- .../petstore_api/models/api_response.py | 18 +- .../models/array_of_array_of_model.py | 20 +- .../models/array_of_array_of_number_only.py | 18 +- .../models/array_of_number_only.py | 18 +- .../python/petstore_api/models/array_test.py | 20 +- .../python/petstore_api/models/basque_pig.py | 18 +- .../petstore_api/models/capitalization.py | 18 +- .../python/petstore_api/models/cat.py | 18 +- .../python/petstore_api/models/category.py | 18 +- .../models/circular_reference_model.py | 20 +- .../python/petstore_api/models/class_model.py | 18 +- .../python/petstore_api/models/client.py | 18 +- .../python/petstore_api/models/color.py | 16 +- .../python/petstore_api/models/creature.py | 20 +- .../petstore_api/models/creature_info.py | 18 +- .../python/petstore_api/models/danish_pig.py | 18 +- .../petstore_api/models/deprecated_object.py | 18 +- .../python/petstore_api/models/dog.py | 18 +- .../python/petstore_api/models/dummy_model.py | 20 +- .../python/petstore_api/models/enum_arrays.py | 18 +- .../python/petstore_api/models/enum_class.py | 5 +- .../petstore_api/models/enum_string1.py | 5 +- .../petstore_api/models/enum_string2.py | 5 +- .../python/petstore_api/models/enum_test.py | 18 +- .../python/petstore_api/models/file.py | 18 +- .../models/file_schema_test_class.py | 22 +- .../python/petstore_api/models/first_ref.py | 20 +- .../python/petstore_api/models/foo.py | 18 +- .../models/foo_get_default_response.py | 20 +- .../python/petstore_api/models/format_test.py | 18 +- .../petstore_api/models/has_only_read_only.py | 22 +- .../models/health_check_result.py | 18 +- .../models/inner_dict_with_property.py | 18 +- .../petstore_api/models/int_or_string.py | 16 +- .../python/petstore_api/models/list_class.py | 18 +- .../models/map_of_array_of_model.py | 20 +- .../python/petstore_api/models/map_test.py | 18 +- ...perties_and_additional_properties_class.py | 20 +- .../petstore_api/models/model200_response.py | 18 +- .../petstore_api/models/model_return.py | 18 +- .../python/petstore_api/models/name.py | 22 +- .../petstore_api/models/nullable_class.py | 18 +- .../petstore_api/models/nullable_property.py | 18 +- .../python/petstore_api/models/number_only.py | 18 +- .../object_to_test_additional_properties.py | 18 +- .../models/object_with_deprecated_fields.py | 20 +- .../petstore_api/models/one_of_enum_string.py | 16 +- .../python/petstore_api/models/order.py | 18 +- .../petstore_api/models/outer_composite.py | 18 +- .../python/petstore_api/models/outer_enum.py | 5 +- .../models/outer_enum_default_value.py | 5 +- .../petstore_api/models/outer_enum_integer.py | 5 +- .../outer_enum_integer_default_value.py | 5 +- .../models/outer_object_with_enum_property.py | 18 +- .../python/petstore_api/models/parent.py | 20 +- .../models/parent_with_optional_dict.py | 20 +- .../python/petstore_api/models/pet.py | 22 +- .../python/petstore_api/models/pig.py | 16 +- .../models/property_name_collision.py | 18 +- .../petstore_api/models/read_only_first.py | 20 +- .../python/petstore_api/models/second_ref.py | 20 +- .../models/self_reference_model.py | 20 +- .../petstore_api/models/single_ref_type.py | 5 +- .../models/special_character_enum.py | 5 +- .../petstore_api/models/special_model_name.py | 18 +- .../petstore_api/models/special_name.py | 20 +- .../python/petstore_api/models/tag.py | 18 +- ..._error_responses_with_model400_response.py | 18 +- ..._error_responses_with_model404_response.py | 18 +- ..._freeform_additional_properties_request.py | 18 +- .../python/petstore_api/models/tiger.py | 18 +- ...t_with_additional_model_list_properties.py | 20 +- ..._with_additional_string_list_properties.py | 18 +- .../python/petstore_api/models/user.py | 18 +- .../petstore_api/models/with_nested_one_of.py | 22 +- .../petstore/python/petstore_api/rest.py | 51 +- .../client/petstore/python/pyproject.toml | 6 + .../petstore/python/test-requirements.txt | 2 + .../petstore/python/tests/test_color_model.py | 151 +++++ .../petstore/python/tests/test_model.py | 127 +--- 262 files changed, 2683 insertions(+), 2284 deletions(-) create mode 100644 samples/client/echo_api/python/poetry.lock create mode 100644 samples/openapi3/client/petstore/python/tests/test_color_model.py diff --git a/.github/workflows/samples-python-client-echo-api.yaml b/.github/workflows/samples-python-client-echo-api.yaml index 8b073ac1897f..05ce58c4e45e 100644 --- a/.github/workflows/samples-python-client-echo-api.yaml +++ b/.github/workflows/samples-python-client-echo-api.yaml @@ -42,3 +42,7 @@ jobs: - name: Test working-directory: ${{ matrix.sample }} run: python -m pytest + + - name: mypy + working-directory: ${{ matrix.sample }} + run: python -m mypy diff --git a/.github/workflows/samples-python-petstore.yaml b/.github/workflows/samples-python-petstore.yaml index f6ec2e090071..4cf215d0c8d9 100644 --- a/.github/workflows/samples-python-petstore.yaml +++ b/.github/workflows/samples-python-petstore.yaml @@ -57,3 +57,7 @@ jobs: - name: Test working-directory: ${{ matrix.sample }} run: poetry run pytest -v + + - name: mypy + working-directory: ${{ matrix.sample }} + run: poetry run mypy diff --git a/bin/configs/python-aiohttp.yaml b/bin/configs/python-aiohttp.yaml index 6bec6d585b66..8c13f87b6319 100644 --- a/bin/configs/python-aiohttp.yaml +++ b/bin/configs/python-aiohttp.yaml @@ -6,3 +6,6 @@ library: asyncio additionalProperties: packageName: petstore_api mapNumberTo: float +nameMappings: + _type: underscore_type + type_: type_with_underscore diff --git a/modules/openapi-generator/src/main/resources/python/__init__package.mustache b/modules/openapi-generator/src/main/resources/python/__init__package.mustache index 7985e6e46a4f..ddc9f9db1314 100644 --- a/modules/openapi-generator/src/main/resources/python/__init__package.mustache +++ b/modules/openapi-generator/src/main/resources/python/__init__package.mustache @@ -10,7 +10,7 @@ __version__ = "{{packageVersion}}" {{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classFilename}} import {{classname}} {{/apis}}{{/apiInfo}} # import ApiClient -from {{packageName}}.api_response import ApiResponse +#from {{packageName}}.api_response import ApiResponse from {{packageName}}.api_client import ApiClient from {{packageName}}.configuration import Configuration from {{packageName}}.exceptions import OpenApiException diff --git a/modules/openapi-generator/src/main/resources/python/api.mustache b/modules/openapi-generator/src/main/resources/python/api.mustache index fdfbfbb872e8..177318620c94 100644 --- a/modules/openapi-generator/src/main/resources/python/api.mustache +++ b/modules/openapi-generator/src/main/resources/python/api.mustache @@ -6,19 +6,15 @@ import io import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated {{#imports}} {{import}} {{/imports}} from {{packageName}}.api_client import ApiClient -from {{packageName}}.api_response import ApiResponse +from {{packageName}}.api_response import ApiResponse as _ApiResponse from {{packageName}}.rest import RESTResponseType @@ -52,7 +48,7 @@ class {{classname}}: @validate_call - {{#asyncio}}async {{/asyncio}}def {{operationId}}_with_http_info{{>partial_api_args}} -> ApiResponse[{{{returnType}}}{{^returnType}}None{{/returnType}}]: + {{#asyncio}}async {{/asyncio}}def {{operationId}}_with_http_info{{>partial_api_args}} -> _ApiResponse[{{{returnType}}}{{^returnType}}None{{/returnType}}]: {{>partial_api}} response_data = {{#asyncio}}await {{/asyncio}}self.api_client.call_api( *_param, diff --git a/modules/openapi-generator/src/main/resources/python/api_client.mustache b/modules/openapi-generator/src/main/resources/python/api_client.mustache index 6744afb40c01..f77d3213d149 100644 --- a/modules/openapi-generator/src/main/resources/python/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_client.mustache @@ -281,15 +281,13 @@ class ApiClient: ) except ApiException as e: - if e.body: - e.body = e.body.decode('utf-8') raise e return response_data def response_deserialize( self, - response_data: rest.RESTResponse = None, + response_data: rest.RESTResponse, response_types_map=None ) -> ApiResponse: """Deserializes response into an object. @@ -318,7 +316,10 @@ class ApiClient: 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_text = response_data.data.decode(encoding) + if response_data.data is None: # should not happen + response_text = "" + else: + response_text = response_data.data.decode(encoding) return_data = self.deserialize(response_text, response_type) finally: if not 200 <= response_data.status <= 299: @@ -331,7 +332,7 @@ class ApiClient: return ApiResponse( status_code = response_data.status, data = return_data, - headers = response_data.getheaders(), + headers = dict(response_data.getheaders()), raw_data = response_data.data ) diff --git a/modules/openapi-generator/src/main/resources/python/api_response.mustache b/modules/openapi-generator/src/main/resources/python/api_response.mustache index 2ac1ada6e9b3..393bb5a42425 100644 --- a/modules/openapi-generator/src/main/resources/python/api_response.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_response.mustache @@ -14,7 +14,7 @@ class ApiResponse(BaseModel, Generic[T]): status_code: StrictInt = Field(description="HTTP status code") headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") data: T = Field(description="Deserialized data given the data type") - raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + raw_data: Optional[StrictBytes] = Field(description="Raw data (HTTP response body)") model_config = { "arbitrary_types_allowed": True diff --git a/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache b/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache index bc1e8138c38e..7a902d4bbbb4 100644 --- a/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache +++ b/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache @@ -6,6 +6,7 @@ import io import json import re import ssl +from typing import Optional import aiohttp import aiohttp_retry @@ -72,6 +73,7 @@ class RESTClientObject: ) retries = configuration.retries + self.retry_client: Optional[aiohttp_retry.RetryClient] if retries is not None: self.retry_client = aiohttp_retry.RetryClient( client_session=self.pool_manager, diff --git a/modules/openapi-generator/src/main/resources/python/exceptions.mustache b/modules/openapi-generator/src/main/resources/python/exceptions.mustache index 82f9b7da0803..a690ceb926cb 100644 --- a/modules/openapi-generator/src/main/resources/python/exceptions.mustache +++ b/modules/openapi-generator/src/main/resources/python/exceptions.mustache @@ -2,7 +2,6 @@ {{>partial_header}} from typing import Any, Optional - from typing_extensions import Self class OpenApiException(Exception): diff --git a/modules/openapi-generator/src/main/resources/python/model_anyof.mustache b/modules/openapi-generator/src/main/resources/python/model_anyof.mustache index 0d575011b268..31096e3ecb42 100644 --- a/modules/openapi-generator/src/main/resources/python/model_anyof.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_anyof.mustache @@ -13,12 +13,8 @@ import re # noqa: F401 {{{.}}} {{/vendorExtensions.x-py-model-imports}} from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict -from typing_extensions import Literal +from typing_extensions import Literal, Self from pydantic import StrictStr, Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self {{#lambda.uppercase}}{{{classname}}}{{/lambda.uppercase}}_ANY_OF_SCHEMAS = [{{#anyOf}}"{{.}}"{{^-last}}, {{/-last}}{{/anyOf}}] @@ -35,7 +31,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} actual_instance: Optional[Union[{{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}]] = None else: actual_instance: Any = None - any_of_schemas: List[str] = Literal[{{#lambda.uppercase}}{{{classname}}}{{/lambda.uppercase}}_ANY_OF_SCHEMAS] + #any_of_schemas: List[str] = Literal[{{#lambda.uppercase}}{{{classname}}}{{/lambda.uppercase}}_ANY_OF_SCHEMAS] model_config = { "validate_assignment": True, @@ -161,22 +157,20 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> Dict: + def to_dict(self) -> Optional[Union[Dict, {{#anyOf}}{{.}}{{^-last}}, {{/-last}}{{/anyOf}}]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: - return "null" + return None - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: - return json.dumps(self.actual_instance) + return self.actual_instance def to_str(self) -> str: """Returns the string representation of the actual instance""" diff --git a/modules/openapi-generator/src/main/resources/python/model_enum.mustache b/modules/openapi-generator/src/main/resources/python/model_enum.mustache index 0bd7dafbeef8..6d8b6bb8ec1a 100644 --- a/modules/openapi-generator/src/main/resources/python/model_enum.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_enum.mustache @@ -6,10 +6,7 @@ from enum import Enum {{#vendorExtensions.x-py-datetime-imports}}{{#-first}}from datetime import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-datetime-imports}} {{#vendorExtensions.x-py-typing-imports}}{{#-first}}from typing import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-typing-imports}} {{#vendorExtensions.x-py-pydantic-imports}}{{#-first}}from pydantic import{{/-first}} {{{.}}}{{^-last}},{{/-last}}{{/vendorExtensions.x-py-pydantic-imports}} -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class {{classname}}({{vendorExtensions.x-py-enum-type}}, Enum): diff --git a/modules/openapi-generator/src/main/resources/python/model_generic.mustache b/modules/openapi-generator/src/main/resources/python/model_generic.mustache index 1b676e469554..dd8626777526 100644 --- a/modules/openapi-generator/src/main/resources/python/model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_generic.mustache @@ -12,10 +12,8 @@ import json {{#vendorExtensions.x-py-model-imports}} {{{.}}} {{/vendorExtensions.x-py-model-imports}} -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}): """ @@ -90,7 +88,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} {{#hasChildren}} {{#discriminator}} # JSON field name that stores the object type - __discriminator_property_name: ClassVar[List[str]] = '{{discriminator.propertyBaseName}}' + __discriminator_property_name: ClassVar[str] = '{{discriminator.propertyBaseName}}' # discriminator mappings __discriminator_value_class_map: ClassVar[Dict[str, str]] = { @@ -98,7 +96,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} } @classmethod - def get_discriminator_value(cls, obj: Dict) -> str: + def get_discriminator_value(cls, obj: Dict) -> Optional[str]: """Returns the discriminator value (object type) of the data""" discriminator_value = obj[cls.__discriminator_property_name] if discriminator_value: @@ -118,7 +116,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> {{^hasChildren}}Self{{/hasChildren}}{{#hasChildren}}{{#discriminator}}Union[{{#children}}Self{{^-last}}, {{/-last}}{{/children}}]{{/discriminator}}{{^discriminator}}Self{{/discriminator}}{{/hasChildren}}: + def from_json(cls, json_str: str) -> Optional[{{^hasChildren}}Self{{/hasChildren}}{{#hasChildren}}{{#discriminator}}Union[{{#children}}Self{{^-last}}, {{/-last}}{{/children}}]{{/discriminator}}{{^discriminator}}Self{{/discriminator}}{{/hasChildren}}]: """Create an instance of {{{classname}}} from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -138,16 +136,18 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} * Fields in `self.additional_properties` are added to the output dict. {{/isAdditionalPropertiesTrue}} """ + excluded_fields: Set[str] = set([ + {{#vendorExtensions.x-py-readonly}} + "{{{.}}}", + {{/vendorExtensions.x-py-readonly}} + {{#isAdditionalPropertiesTrue}} + "additional_properties", + {{/isAdditionalPropertiesTrue}} + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - {{#vendorExtensions.x-py-readonly}} - "{{{.}}}", - {{/vendorExtensions.x-py-readonly}} - {{#isAdditionalPropertiesTrue}} - "additional_properties", - {{/isAdditionalPropertiesTrue}} - }, + exclude=excluded_fields, exclude_none=True, ) {{#allVars}} @@ -237,10 +237,10 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} {{/allVars}} return _dict + {{#hasChildren}} @classmethod - def from_dict(cls, obj: Dict) -> {{^hasChildren}}Self{{/hasChildren}}{{#hasChildren}}{{#discriminator}}Union[{{#children}}Self{{^-last}}, {{/-last}}{{/children}}]{{/discriminator}}{{^discriminator}}Self{{/discriminator}}{{/hasChildren}}: + def from_dict(cls, obj: Dict) -> Optional[{{#discriminator}}Union[{{#children}}Self{{^-last}}, {{/-last}}{{/children}}]{{/discriminator}}{{^discriminator}}Self{{/discriminator}}]: """Create an instance of {{{classname}}} from a dict""" - {{#hasChildren}} {{#discriminator}} # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) @@ -252,8 +252,11 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) {{/discriminator}} - {{/hasChildren}} - {{^hasChildren}} + {{/hasChildren}} + {{^hasChildren}} + @classmethod + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: + """Create an instance of {{{classname}}} from a dict""" if obj is None: return None @@ -280,7 +283,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} {{^items.items.isPrimitiveType}} "{{{baseName}}}": [ [{{{items.items.dataType}}}.from_dict(_inner_item) for _inner_item in _item] - for _item in obj.get("{{{baseName}}}") + for _item in obj["{{{baseName}}}"] ] if obj.get("{{{baseName}}}") is not None else None{{^-last}},{{/-last}} {{/items.items.isPrimitiveType}} {{/items.isArray}} @@ -290,7 +293,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} "{{{baseName}}}": obj.get("{{{baseName}}}"){{^-last}},{{/-last}} {{/items.isEnumOrRef}} {{^items.isEnumOrRef}} - "{{{baseName}}}": [{{{items.dataType}}}.from_dict(_item) for _item in obj.get("{{{baseName}}}")] if obj.get("{{{baseName}}}") is not None else None{{^-last}},{{/-last}} + "{{{baseName}}}": [{{{items.dataType}}}.from_dict(_item) for _item in obj["{{{baseName}}}"]] if obj.get("{{{baseName}}}") is not None else None{{^-last}},{{/-last}} {{/items.isEnumOrRef}} {{/items.isPrimitiveType}} {{#items.isPrimitiveType}} @@ -323,14 +326,14 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} if _v is not None else None ) - for _k, _v in obj.get("{{{baseName}}}").items() + for _k, _v in obj.get("{{{baseName}}}", {}).items() ){{^-last}},{{/-last}} {{/items.isArray}} {{/items.isContainer}} {{^items.isContainer}} "{{{baseName}}}": dict( (_k, {{{items.dataType}}}.from_dict(_v)) - for _k, _v in obj.get("{{{baseName}}}").items() + for _k, _v in obj["{{{baseName}}}"].items() ) if obj.get("{{{baseName}}}") is not None else None{{^-last}},{{/-last}} @@ -348,7 +351,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} {{^isContainer}} {{^isPrimitiveType}} {{^isEnumOrRef}} - "{{{baseName}}}": {{{dataType}}}.from_dict(obj.get("{{{baseName}}}")) if obj.get("{{{baseName}}}") is not None else None{{^-last}},{{/-last}} + "{{{baseName}}}": {{{dataType}}}.from_dict(obj["{{{baseName}}}"]) if obj.get("{{{baseName}}}") is not None else None{{^-last}},{{/-last}} {{/isEnumOrRef}} {{#isEnumOrRef}} "{{{baseName}}}": obj.get("{{{baseName}}}"){{^-last}},{{/-last}} @@ -373,7 +376,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} {{/isAdditionalPropertiesTrue}} return _obj - {{/hasChildren}} + {{/hasChildren}} {{#vendorExtensions.x-py-postponed-model-imports.size}} {{#vendorExtensions.x-py-postponed-model-imports}} diff --git a/modules/openapi-generator/src/main/resources/python/model_oneof.mustache b/modules/openapi-generator/src/main/resources/python/model_oneof.mustache index b87c42cf2b9b..69dd8f0c9295 100644 --- a/modules/openapi-generator/src/main/resources/python/model_oneof.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_oneof.mustache @@ -13,12 +13,8 @@ import re # noqa: F401 {{{.}}} {{/vendorExtensions.x-py-model-imports}} from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict -from typing_extensions import Literal +from typing_extensions import Literal, Self from pydantic import StrictStr, Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self {{#lambda.uppercase}}{{{classname}}}{{/lambda.uppercase}}_ONE_OF_SCHEMAS = [{{#oneOf}}"{{.}}"{{^-last}}, {{/-last}}{{/oneOf}}] @@ -31,7 +27,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} {{vendorExtensions.x-py-name}}: {{{vendorExtensions.x-py-typing}}} {{/composedSchemas.oneOf}} actual_instance: Optional[Union[{{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}]] = None - one_of_schemas: List[str] = Literal[{{#oneOf}}"{{.}}"{{^-last}}, {{/-last}}{{/oneOf}}] + #one_of_schemas = Literal[{{#oneOf}}"{{.}}"{{^-last}}, {{/-last}}{{/oneOf}}] model_config = { "validate_assignment": True, @@ -184,19 +180,17 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> Dict: + def to_dict(self) -> Optional[Union[Dict, {{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type diff --git a/modules/openapi-generator/src/main/resources/python/pyproject.mustache b/modules/openapi-generator/src/main/resources/python/pyproject.mustache index f4e117c27958..8c8116cff622 100644 --- a/modules/openapi-generator/src/main/resources/python/pyproject.mustache +++ b/modules/openapi-generator/src/main/resources/python/pyproject.mustache @@ -32,6 +32,9 @@ typing-extensions = ">=4.7.1" pytest = ">=7.2.1" tox = ">=3.9.0" flake8 = ">=4.0.0" +types-python-dateutil = ">=2.8.19.14" +mypy = "1.4.1" + [build-system] requires = ["setuptools"] @@ -39,3 +42,6 @@ build-backend = "setuptools.build_meta" [tool.pylint.'MESSAGES CONTROL'] extension-pkg-whitelist = "pydantic" + +[tool.mypy] +files = ["{{{packageName}}}"] diff --git a/modules/openapi-generator/src/main/resources/python/rest.mustache b/modules/openapi-generator/src/main/resources/python/rest.mustache index f09988458595..99741f6ec004 100644 --- a/modules/openapi-generator/src/main/resources/python/rest.mustache +++ b/modules/openapi-generator/src/main/resources/python/rest.mustache @@ -61,56 +61,45 @@ class RESTClientObject: else: cert_reqs = ssl.CERT_NONE - addition_pool_args = {} + pool_args = { + "cert_reqs": cert_reqs, + "ca_certs": configuration.ssl_ca_cert, + "cert_file": configuration.cert_file, + "key_file": configuration.key_file, + } if configuration.assert_hostname is not None: - addition_pool_args['assert_hostname'] = ( + pool_args['assert_hostname'] = ( configuration.assert_hostname ) if configuration.retries is not None: - addition_pool_args['retries'] = configuration.retries + pool_args['retries'] = configuration.retries if configuration.tls_server_name: - addition_pool_args['server_hostname'] = configuration.tls_server_name + pool_args['server_hostname'] = configuration.tls_server_name if configuration.socket_options is not None: - addition_pool_args['socket_options'] = configuration.socket_options + pool_args['socket_options'] = configuration.socket_options if configuration.connection_pool_maxsize is not None: - addition_pool_args['maxsize'] = configuration.connection_pool_maxsize + pool_args['maxsize'] = configuration.connection_pool_maxsize # https pool manager + self.pool_manager: urllib3.PoolManager + if configuration.proxy: if is_socks_proxy_url(configuration.proxy): from urllib3.contrib.socks import SOCKSProxyManager - self.pool_manager = SOCKSProxyManager( - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - proxy_url=configuration.proxy, - headers=configuration.proxy_headers, - **addition_pool_args - ) + pool_args["proxy_url"] = configuration.proxy + pool_args["headers"] = configuration.proxy_headers + self.pool_manager = SOCKSProxyManager(**pool_args) else: - self.pool_manager = urllib3.ProxyManager( - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - proxy_url=configuration.proxy, - proxy_headers=configuration.proxy_headers, - **addition_pool_args - ) + pool_args["proxy_url"] = configuration.proxy + pool_args["proxy_headers"] = configuration.proxy_headers + self.pool_manager = urllib3.ProxyManager(**pool_args) else: - self.pool_manager = urllib3.PoolManager( - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - **addition_pool_args - ) + self.pool_manager = urllib3.PoolManager(**pool_args) def request( self, diff --git a/modules/openapi-generator/src/main/resources/python/test-requirements.mustache b/modules/openapi-generator/src/main/resources/python/test-requirements.mustache index 3a0d0b939a1e..8e6d8cb13749 100644 --- a/modules/openapi-generator/src/main/resources/python/test-requirements.mustache +++ b/modules/openapi-generator/src/main/resources/python/test-requirements.mustache @@ -1,3 +1,5 @@ pytest~=7.1.3 pytest-cov>=2.8.1 pytest-randomly>=3.12.0 +mypy>=1.4.1 +types-python-dateutil>=2.8.19 diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/__init__.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/__init__.py index 7b67f7c597fb..715ae020f7ae 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/__init__.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/__init__.py @@ -26,7 +26,7 @@ from openapi_client.api.query_api import QueryApi # import ApiClient -from openapi_client.api_response import ApiResponse +#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 diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/auth_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/auth_api.py index 82740c98af88..4dc8f8576019 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/auth_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/auth_api.py @@ -17,16 +17,12 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse +from openapi_client.api_response import ApiResponse as _ApiResponse from openapi_client.rest import RESTResponseType @@ -121,7 +117,7 @@ def test_auth_http_basic_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """To test HTTP basic authentication To test HTTP basic authentication @@ -364,7 +360,7 @@ def test_auth_http_bearer_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """To test HTTP bearer authentication To test HTTP bearer authentication diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/body_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/body_api.py index 77bd5615092d..1a03f727baf8 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/body_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/body_api.py @@ -17,12 +17,8 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import Field from typing_extensions import Annotated @@ -34,7 +30,7 @@ from openapi_client.models.tag import Tag from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse +from openapi_client.api_response import ApiResponse as _ApiResponse from openapi_client.rest import RESTResponseType @@ -129,7 +125,7 @@ def test_binary_gif_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[bytearray]: + ) -> _ApiResponse[bytearray]: """Test binary (gif) response body Test binary (gif) response body @@ -376,7 +372,7 @@ def test_body_application_octetstream_binary_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test body parameter(s) Test body parameter(s) @@ -651,7 +647,7 @@ def test_body_multipart_formdata_array_of_binary_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test array of binary in multipart mime Test array of binary in multipart mime @@ -922,7 +918,7 @@ def test_body_multipart_formdata_single_binary_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test single binary in multipart mime Test single binary in multipart mime @@ -1192,7 +1188,7 @@ def test_echo_body_all_of_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Pet]: + ) -> _ApiResponse[Pet]: """Test body parameter(s) Test body parameter(s) @@ -1462,7 +1458,7 @@ def test_echo_body_free_form_object_response_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test free form object Test free form object @@ -1732,7 +1728,7 @@ def test_echo_body_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Pet]: + ) -> _ApiResponse[Pet]: """Test body parameter(s) Test body parameter(s) @@ -2002,7 +1998,7 @@ def test_echo_body_pet_response_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test empty response body Test empty response body @@ -2272,7 +2268,7 @@ def test_echo_body_tag_response_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test empty json (request body) Test empty json (request body) diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/form_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/form_api.py index d3cc6a2f35b0..764774a5e95e 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/form_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/form_api.py @@ -17,12 +17,8 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import StrictBool, StrictInt, StrictStr @@ -30,7 +26,7 @@ from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse +from openapi_client.api_response import ApiResponse as _ApiResponse from openapi_client.rest import RESTResponseType @@ -140,7 +136,7 @@ def test_form_integer_boolean_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test form parameter(s) Test form parameter(s) @@ -455,7 +451,7 @@ def test_form_oneof_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test form parameter(s) for oneOf schema Test form parameter(s) for oneOf schema diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/header_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/header_api.py index 0303dd3710bd..dcdfffbc4cd7 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/header_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/header_api.py @@ -17,12 +17,8 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import StrictBool, StrictInt, StrictStr, field_validator @@ -31,7 +27,7 @@ from openapi_client.models.string_enum_ref import StringEnumRef from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse +from openapi_client.api_response import ApiResponse as _ApiResponse from openapi_client.rest import RESTResponseType @@ -151,7 +147,7 @@ def test_header_integer_boolean_string_enums_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test header parameter(s) Test header parameter(s) diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/path_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/path_api.py index f7e4a3e2003a..1d501b5c268c 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/path_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/path_api.py @@ -17,19 +17,15 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import StrictInt, StrictStr, field_validator from openapi_client.models.string_enum_ref import StringEnumRef from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse +from openapi_client.api_response import ApiResponse as _ApiResponse from openapi_client.rest import RESTResponseType @@ -144,7 +140,7 @@ def tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_e _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test path parameter(s) Test path parameter(s) diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/query_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/query_api.py index 8b37ac7bbe6d..cf0980110e19 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/query_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/query_api.py @@ -17,12 +17,8 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from datetime import date, datetime @@ -35,7 +31,7 @@ from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse +from openapi_client.api_response import ApiResponse as _ApiResponse from openapi_client.rest import RESTResponseType @@ -140,7 +136,7 @@ def test_enum_ref_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -421,7 +417,7 @@ def test_query_datetime_date_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -732,7 +728,7 @@ def test_query_integer_boolean_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -1015,7 +1011,7 @@ def test_query_style_deep_object_explode_true_object_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -1274,7 +1270,7 @@ def test_query_style_deep_object_explode_true_object_all_of_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -1533,7 +1529,7 @@ def test_query_style_form_explode_true_array_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -1792,7 +1788,7 @@ def test_query_style_form_explode_true_object_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -2051,7 +2047,7 @@ def test_query_style_form_explode_true_object_all_of_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test query parameter(s) Test query parameter(s) diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_client.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_client.py index bdf8ec05b2da..30d89d397037 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_client.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_client.py @@ -274,15 +274,13 @@ def call_api( ) except ApiException as e: - if e.body: - e.body = e.body.decode('utf-8') raise e return response_data def response_deserialize( self, - response_data: rest.RESTResponse = None, + response_data: rest.RESTResponse, response_types_map=None ) -> ApiResponse: """Deserializes response into an object. @@ -311,7 +309,10 @@ def response_deserialize( 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_text = response_data.data.decode(encoding) + if response_data.data is None: # should not happen + response_text = "" + else: + response_text = response_data.data.decode(encoding) return_data = self.deserialize(response_text, response_type) finally: if not 200 <= response_data.status <= 299: @@ -324,7 +325,7 @@ def response_deserialize( return ApiResponse( status_code = response_data.status, data = return_data, - headers = response_data.getheaders(), + headers = dict(response_data.getheaders()), raw_data = response_data.data ) diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_response.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_response.py index 2ac1ada6e9b3..393bb5a42425 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_response.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_response.py @@ -14,7 +14,7 @@ class ApiResponse(BaseModel, Generic[T]): status_code: StrictInt = Field(description="HTTP status code") headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") data: T = Field(description="Deserialized data given the data type") - raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + raw_data: Optional[StrictBytes] = Field(description="Raw data (HTTP response body)") model_config = { "arbitrary_types_allowed": True diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/exceptions.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/exceptions.py index 4ddc870f3e0b..bd5561d241ed 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/exceptions.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/exceptions.py @@ -13,7 +13,6 @@ """ # noqa: E501 from typing import Any, Optional - from typing_extensions import Self class OpenApiException(Exception): diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/bird.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/bird.py index 37b2425aa6f8..564835843858 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/bird.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/bird.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Bird(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Bird from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,16 +63,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Bird from a dict""" if obj is None: return None diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/category.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/category.py index 078fb6557194..addd51dca300 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/category.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/category.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Category(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Category from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,16 +63,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Category from a dict""" if obj is None: return None diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/data_query.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/data_query.py index 49d1c4ec4eb6..25972299790e 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/data_query.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/data_query.py @@ -23,10 +23,8 @@ from pydantic import StrictStr from pydantic import Field from openapi_client.models.query import Query -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class DataQuery(Query): """ @@ -54,7 +52,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DataQuery from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -68,16 +66,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of DataQuery from a dict""" if obj is None: return None diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/default_value.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/default_value.py index 809cb22027f4..b5fc10c8fe5b 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/default_value.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/default_value.py @@ -22,10 +22,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr, field_validator from openapi_client.models.string_enum_ref import StringEnumRef -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class DefaultValue(BaseModel): """ @@ -69,7 +67,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DefaultValue from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -83,10 +81,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # set to None if array_string_nullable (nullable) is None @@ -107,7 +107,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of DefaultValue from a dict""" if obj is None: return None diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/number_properties_only.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/number_properties_only.py index e5e6acc13b65..57db9e7fc5a3 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/number_properties_only.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/number_properties_only.py @@ -23,10 +23,8 @@ from pydantic import BaseModel, StrictFloat, StrictInt from pydantic import Field from typing_extensions import Annotated -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class NumberPropertiesOnly(BaseModel): """ @@ -54,7 +52,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of NumberPropertiesOnly from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -68,16 +66,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of NumberPropertiesOnly from a dict""" if obj is None: return None diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/pet.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/pet.py index 21276281a221..fb54cd096541 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/pet.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/pet.py @@ -24,10 +24,8 @@ from pydantic import Field from openapi_client.models.category import Category from openapi_client.models.tag import Tag -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Pet(BaseModel): """ @@ -68,7 +66,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Pet from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -82,10 +80,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of category @@ -101,7 +101,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Pet from a dict""" if obj is None: return None @@ -117,9 +117,9 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "id": obj.get("id"), "name": obj.get("name"), - "category": Category.from_dict(obj.get("category")) if obj.get("category") is not None else None, + "category": Category.from_dict(obj["category"]) if obj.get("category") is not None else None, "photoUrls": obj.get("photoUrls"), - "tags": [Tag.from_dict(_item) for _item in obj.get("tags")] if obj.get("tags") is not None else None, + "tags": [Tag.from_dict(_item) for _item in obj["tags"]] if obj.get("tags") is not None else None, "status": obj.get("status") }) return _obj diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/query.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/query.py index 863b9e47782d..c93c7889c4f7 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/query.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/query.py @@ -22,10 +22,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr, field_validator from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Query(BaseModel): """ @@ -63,7 +61,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Query from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -77,16 +75,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Dict) -> Optional[Self]: """Create an instance of Query from a dict""" diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/string_enum_ref.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/string_enum_ref.py index cedd6194f983..d7af2929c966 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/string_enum_ref.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/string_enum_ref.py @@ -21,10 +21,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class StringEnumRef(str, Enum): diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/tag.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/tag.py index de29129b4a66..bf20705c2cfa 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/tag.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/tag.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Tag(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Tag from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,16 +63,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Tag from a dict""" if obj is None: return None diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py index 683221d51dcc..74f3d0e1f409 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(BaseModel): """ @@ -53,7 +51,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -67,16 +65,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter from a dict""" if obj is None: return None diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py index 4e3509e9c6e4..4eba0536db29 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,16 +62,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter from a dict""" if obj is None: return None diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/rest.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/rest.py index 5d0ca946c1f6..e1d6a981431d 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/rest.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/rest.py @@ -72,56 +72,45 @@ def __init__(self, configuration) -> None: else: cert_reqs = ssl.CERT_NONE - addition_pool_args = {} + pool_args = { + "cert_reqs": cert_reqs, + "ca_certs": configuration.ssl_ca_cert, + "cert_file": configuration.cert_file, + "key_file": configuration.key_file, + } if configuration.assert_hostname is not None: - addition_pool_args['assert_hostname'] = ( + pool_args['assert_hostname'] = ( configuration.assert_hostname ) if configuration.retries is not None: - addition_pool_args['retries'] = configuration.retries + pool_args['retries'] = configuration.retries if configuration.tls_server_name: - addition_pool_args['server_hostname'] = configuration.tls_server_name + pool_args['server_hostname'] = configuration.tls_server_name if configuration.socket_options is not None: - addition_pool_args['socket_options'] = configuration.socket_options + pool_args['socket_options'] = configuration.socket_options if configuration.connection_pool_maxsize is not None: - addition_pool_args['maxsize'] = configuration.connection_pool_maxsize + pool_args['maxsize'] = configuration.connection_pool_maxsize # https pool manager + self.pool_manager: urllib3.PoolManager + if configuration.proxy: if is_socks_proxy_url(configuration.proxy): from urllib3.contrib.socks import SOCKSProxyManager - self.pool_manager = SOCKSProxyManager( - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - proxy_url=configuration.proxy, - headers=configuration.proxy_headers, - **addition_pool_args - ) + pool_args["proxy_url"] = configuration.proxy + pool_args["headers"] = configuration.proxy_headers + self.pool_manager = SOCKSProxyManager(**pool_args) else: - self.pool_manager = urllib3.ProxyManager( - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - proxy_url=configuration.proxy, - proxy_headers=configuration.proxy_headers, - **addition_pool_args - ) + pool_args["proxy_url"] = configuration.proxy + pool_args["proxy_headers"] = configuration.proxy_headers + self.pool_manager = urllib3.ProxyManager(**pool_args) else: - self.pool_manager = urllib3.PoolManager( - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - **addition_pool_args - ) + self.pool_manager = urllib3.PoolManager(**pool_args) def request( self, diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/pyproject.toml b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/pyproject.toml index af471ab63148..1d4cc5350dc8 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/pyproject.toml +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/pyproject.toml @@ -21,6 +21,9 @@ typing-extensions = ">=4.7.1" pytest = ">=7.2.1" tox = ">=3.9.0" flake8 = ">=4.0.0" +types-python-dateutil = ">=2.8.19.14" +mypy = "1.4.1" + [build-system] requires = ["setuptools"] @@ -28,3 +31,6 @@ build-backend = "setuptools.build_meta" [tool.pylint.'MESSAGES CONTROL'] extension-pkg-whitelist = "pydantic" + +[tool.mypy] +files = ["openapi_client"] diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/test-requirements.txt b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/test-requirements.txt index 3a0d0b939a1e..8e6d8cb13749 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/test-requirements.txt +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/test-requirements.txt @@ -1,3 +1,5 @@ pytest~=7.1.3 pytest-cov>=2.8.1 pytest-randomly>=3.12.0 +mypy>=1.4.1 +types-python-dateutil>=2.8.19 diff --git a/samples/client/echo_api/python/openapi_client/__init__.py b/samples/client/echo_api/python/openapi_client/__init__.py index 7b67f7c597fb..715ae020f7ae 100644 --- a/samples/client/echo_api/python/openapi_client/__init__.py +++ b/samples/client/echo_api/python/openapi_client/__init__.py @@ -26,7 +26,7 @@ from openapi_client.api.query_api import QueryApi # import ApiClient -from openapi_client.api_response import ApiResponse +#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 diff --git a/samples/client/echo_api/python/openapi_client/api/auth_api.py b/samples/client/echo_api/python/openapi_client/api/auth_api.py index 82740c98af88..4dc8f8576019 100644 --- a/samples/client/echo_api/python/openapi_client/api/auth_api.py +++ b/samples/client/echo_api/python/openapi_client/api/auth_api.py @@ -17,16 +17,12 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse +from openapi_client.api_response import ApiResponse as _ApiResponse from openapi_client.rest import RESTResponseType @@ -121,7 +117,7 @@ def test_auth_http_basic_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """To test HTTP basic authentication To test HTTP basic authentication @@ -364,7 +360,7 @@ def test_auth_http_bearer_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """To test HTTP bearer authentication To test HTTP bearer authentication diff --git a/samples/client/echo_api/python/openapi_client/api/body_api.py b/samples/client/echo_api/python/openapi_client/api/body_api.py index 77bd5615092d..1a03f727baf8 100644 --- a/samples/client/echo_api/python/openapi_client/api/body_api.py +++ b/samples/client/echo_api/python/openapi_client/api/body_api.py @@ -17,12 +17,8 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import Field from typing_extensions import Annotated @@ -34,7 +30,7 @@ from openapi_client.models.tag import Tag from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse +from openapi_client.api_response import ApiResponse as _ApiResponse from openapi_client.rest import RESTResponseType @@ -129,7 +125,7 @@ def test_binary_gif_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[bytearray]: + ) -> _ApiResponse[bytearray]: """Test binary (gif) response body Test binary (gif) response body @@ -376,7 +372,7 @@ def test_body_application_octetstream_binary_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test body parameter(s) Test body parameter(s) @@ -651,7 +647,7 @@ def test_body_multipart_formdata_array_of_binary_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test array of binary in multipart mime Test array of binary in multipart mime @@ -922,7 +918,7 @@ def test_body_multipart_formdata_single_binary_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test single binary in multipart mime Test single binary in multipart mime @@ -1192,7 +1188,7 @@ def test_echo_body_all_of_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Pet]: + ) -> _ApiResponse[Pet]: """Test body parameter(s) Test body parameter(s) @@ -1462,7 +1458,7 @@ def test_echo_body_free_form_object_response_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test free form object Test free form object @@ -1732,7 +1728,7 @@ def test_echo_body_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Pet]: + ) -> _ApiResponse[Pet]: """Test body parameter(s) Test body parameter(s) @@ -2002,7 +1998,7 @@ def test_echo_body_pet_response_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test empty response body Test empty response body @@ -2272,7 +2268,7 @@ def test_echo_body_tag_response_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test empty json (request body) Test empty json (request body) diff --git a/samples/client/echo_api/python/openapi_client/api/form_api.py b/samples/client/echo_api/python/openapi_client/api/form_api.py index d3cc6a2f35b0..764774a5e95e 100644 --- a/samples/client/echo_api/python/openapi_client/api/form_api.py +++ b/samples/client/echo_api/python/openapi_client/api/form_api.py @@ -17,12 +17,8 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import StrictBool, StrictInt, StrictStr @@ -30,7 +26,7 @@ from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse +from openapi_client.api_response import ApiResponse as _ApiResponse from openapi_client.rest import RESTResponseType @@ -140,7 +136,7 @@ def test_form_integer_boolean_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test form parameter(s) Test form parameter(s) @@ -455,7 +451,7 @@ def test_form_oneof_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test form parameter(s) for oneOf schema Test form parameter(s) for oneOf schema diff --git a/samples/client/echo_api/python/openapi_client/api/header_api.py b/samples/client/echo_api/python/openapi_client/api/header_api.py index 0303dd3710bd..dcdfffbc4cd7 100644 --- a/samples/client/echo_api/python/openapi_client/api/header_api.py +++ b/samples/client/echo_api/python/openapi_client/api/header_api.py @@ -17,12 +17,8 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import StrictBool, StrictInt, StrictStr, field_validator @@ -31,7 +27,7 @@ from openapi_client.models.string_enum_ref import StringEnumRef from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse +from openapi_client.api_response import ApiResponse as _ApiResponse from openapi_client.rest import RESTResponseType @@ -151,7 +147,7 @@ def test_header_integer_boolean_string_enums_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test header parameter(s) Test header parameter(s) diff --git a/samples/client/echo_api/python/openapi_client/api/path_api.py b/samples/client/echo_api/python/openapi_client/api/path_api.py index f7e4a3e2003a..1d501b5c268c 100644 --- a/samples/client/echo_api/python/openapi_client/api/path_api.py +++ b/samples/client/echo_api/python/openapi_client/api/path_api.py @@ -17,19 +17,15 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import StrictInt, StrictStr, field_validator from openapi_client.models.string_enum_ref import StringEnumRef from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse +from openapi_client.api_response import ApiResponse as _ApiResponse from openapi_client.rest import RESTResponseType @@ -144,7 +140,7 @@ def tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_e _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test path parameter(s) Test path parameter(s) diff --git a/samples/client/echo_api/python/openapi_client/api/query_api.py b/samples/client/echo_api/python/openapi_client/api/query_api.py index 8b37ac7bbe6d..cf0980110e19 100644 --- a/samples/client/echo_api/python/openapi_client/api/query_api.py +++ b/samples/client/echo_api/python/openapi_client/api/query_api.py @@ -17,12 +17,8 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from datetime import date, datetime @@ -35,7 +31,7 @@ from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse +from openapi_client.api_response import ApiResponse as _ApiResponse from openapi_client.rest import RESTResponseType @@ -140,7 +136,7 @@ def test_enum_ref_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -421,7 +417,7 @@ def test_query_datetime_date_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -732,7 +728,7 @@ def test_query_integer_boolean_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -1015,7 +1011,7 @@ def test_query_style_deep_object_explode_true_object_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -1274,7 +1270,7 @@ def test_query_style_deep_object_explode_true_object_all_of_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -1533,7 +1529,7 @@ def test_query_style_form_explode_true_array_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -1792,7 +1788,7 @@ def test_query_style_form_explode_true_object_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -2051,7 +2047,7 @@ def test_query_style_form_explode_true_object_all_of_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Test query parameter(s) Test query parameter(s) diff --git a/samples/client/echo_api/python/openapi_client/api_client.py b/samples/client/echo_api/python/openapi_client/api_client.py index bdf8ec05b2da..30d89d397037 100644 --- a/samples/client/echo_api/python/openapi_client/api_client.py +++ b/samples/client/echo_api/python/openapi_client/api_client.py @@ -274,15 +274,13 @@ def call_api( ) except ApiException as e: - if e.body: - e.body = e.body.decode('utf-8') raise e return response_data def response_deserialize( self, - response_data: rest.RESTResponse = None, + response_data: rest.RESTResponse, response_types_map=None ) -> ApiResponse: """Deserializes response into an object. @@ -311,7 +309,10 @@ def response_deserialize( 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_text = response_data.data.decode(encoding) + if response_data.data is None: # should not happen + response_text = "" + else: + response_text = response_data.data.decode(encoding) return_data = self.deserialize(response_text, response_type) finally: if not 200 <= response_data.status <= 299: @@ -324,7 +325,7 @@ def response_deserialize( return ApiResponse( status_code = response_data.status, data = return_data, - headers = response_data.getheaders(), + headers = dict(response_data.getheaders()), raw_data = response_data.data ) diff --git a/samples/client/echo_api/python/openapi_client/api_response.py b/samples/client/echo_api/python/openapi_client/api_response.py index 2ac1ada6e9b3..393bb5a42425 100644 --- a/samples/client/echo_api/python/openapi_client/api_response.py +++ b/samples/client/echo_api/python/openapi_client/api_response.py @@ -14,7 +14,7 @@ class ApiResponse(BaseModel, Generic[T]): status_code: StrictInt = Field(description="HTTP status code") headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") data: T = Field(description="Deserialized data given the data type") - raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + raw_data: Optional[StrictBytes] = Field(description="Raw data (HTTP response body)") model_config = { "arbitrary_types_allowed": True diff --git a/samples/client/echo_api/python/openapi_client/exceptions.py b/samples/client/echo_api/python/openapi_client/exceptions.py index 4ddc870f3e0b..bd5561d241ed 100644 --- a/samples/client/echo_api/python/openapi_client/exceptions.py +++ b/samples/client/echo_api/python/openapi_client/exceptions.py @@ -13,7 +13,6 @@ """ # noqa: E501 from typing import Any, Optional - from typing_extensions import Self class OpenApiException(Exception): diff --git a/samples/client/echo_api/python/openapi_client/models/bird.py b/samples/client/echo_api/python/openapi_client/models/bird.py index 912e333dfcf8..4d132db20876 100644 --- a/samples/client/echo_api/python/openapi_client/models/bird.py +++ b/samples/client/echo_api/python/openapi_client/models/bird.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Bird(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Bird from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,16 +63,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Bird from a dict""" if obj is None: return None diff --git a/samples/client/echo_api/python/openapi_client/models/category.py b/samples/client/echo_api/python/openapi_client/models/category.py index ce51a55a27e2..540100717752 100644 --- a/samples/client/echo_api/python/openapi_client/models/category.py +++ b/samples/client/echo_api/python/openapi_client/models/category.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Category(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Category from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,16 +63,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Category from a dict""" if obj is None: return None diff --git a/samples/client/echo_api/python/openapi_client/models/data_query.py b/samples/client/echo_api/python/openapi_client/models/data_query.py index 03d979ce5f3b..c17285162f88 100644 --- a/samples/client/echo_api/python/openapi_client/models/data_query.py +++ b/samples/client/echo_api/python/openapi_client/models/data_query.py @@ -23,10 +23,8 @@ from pydantic import StrictStr from pydantic import Field from openapi_client.models.query import Query -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class DataQuery(Query): """ @@ -54,7 +52,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DataQuery from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -68,16 +66,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of DataQuery from a dict""" if obj is None: return None diff --git a/samples/client/echo_api/python/openapi_client/models/default_value.py b/samples/client/echo_api/python/openapi_client/models/default_value.py index fac957f7aaaf..bad7cf445f4a 100644 --- a/samples/client/echo_api/python/openapi_client/models/default_value.py +++ b/samples/client/echo_api/python/openapi_client/models/default_value.py @@ -22,10 +22,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr, field_validator from openapi_client.models.string_enum_ref import StringEnumRef -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class DefaultValue(BaseModel): """ @@ -69,7 +67,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DefaultValue from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -83,10 +81,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # set to None if array_string_nullable (nullable) is None @@ -107,7 +107,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of DefaultValue from a dict""" if obj is None: return None diff --git a/samples/client/echo_api/python/openapi_client/models/number_properties_only.py b/samples/client/echo_api/python/openapi_client/models/number_properties_only.py index b149da3a87d2..4cf1fbfa3ef8 100644 --- a/samples/client/echo_api/python/openapi_client/models/number_properties_only.py +++ b/samples/client/echo_api/python/openapi_client/models/number_properties_only.py @@ -23,10 +23,8 @@ from pydantic import BaseModel, StrictFloat, StrictInt from pydantic import Field from typing_extensions import Annotated -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class NumberPropertiesOnly(BaseModel): """ @@ -54,7 +52,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of NumberPropertiesOnly from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -68,16 +66,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of NumberPropertiesOnly from a dict""" if obj is None: return None diff --git a/samples/client/echo_api/python/openapi_client/models/pet.py b/samples/client/echo_api/python/openapi_client/models/pet.py index 08269b0eabf0..8e92491cdf7d 100644 --- a/samples/client/echo_api/python/openapi_client/models/pet.py +++ b/samples/client/echo_api/python/openapi_client/models/pet.py @@ -24,10 +24,8 @@ from pydantic import Field from openapi_client.models.category import Category from openapi_client.models.tag import Tag -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Pet(BaseModel): """ @@ -68,7 +66,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Pet from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -82,10 +80,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of category @@ -101,7 +101,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Pet from a dict""" if obj is None: return None @@ -112,9 +112,9 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "id": obj.get("id"), "name": obj.get("name"), - "category": Category.from_dict(obj.get("category")) if obj.get("category") is not None else None, + "category": Category.from_dict(obj["category"]) if obj.get("category") is not None else None, "photoUrls": obj.get("photoUrls"), - "tags": [Tag.from_dict(_item) for _item in obj.get("tags")] if obj.get("tags") is not None else None, + "tags": [Tag.from_dict(_item) for _item in obj["tags"]] if obj.get("tags") is not None else None, "status": obj.get("status") }) return _obj diff --git a/samples/client/echo_api/python/openapi_client/models/query.py b/samples/client/echo_api/python/openapi_client/models/query.py index 863b9e47782d..c93c7889c4f7 100644 --- a/samples/client/echo_api/python/openapi_client/models/query.py +++ b/samples/client/echo_api/python/openapi_client/models/query.py @@ -22,10 +22,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr, field_validator from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Query(BaseModel): """ @@ -63,7 +61,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Query from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -77,16 +75,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Dict) -> Optional[Self]: """Create an instance of Query from a dict""" diff --git a/samples/client/echo_api/python/openapi_client/models/string_enum_ref.py b/samples/client/echo_api/python/openapi_client/models/string_enum_ref.py index cedd6194f983..d7af2929c966 100644 --- a/samples/client/echo_api/python/openapi_client/models/string_enum_ref.py +++ b/samples/client/echo_api/python/openapi_client/models/string_enum_ref.py @@ -21,10 +21,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class StringEnumRef(str, Enum): diff --git a/samples/client/echo_api/python/openapi_client/models/tag.py b/samples/client/echo_api/python/openapi_client/models/tag.py index fa3745c26a66..59cc64276dfa 100644 --- a/samples/client/echo_api/python/openapi_client/models/tag.py +++ b/samples/client/echo_api/python/openapi_client/models/tag.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Tag(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Tag from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,16 +63,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Tag from a dict""" if obj is None: return None diff --git a/samples/client/echo_api/python/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py b/samples/client/echo_api/python/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py index 1929f6cf546e..95a32e8a0baf 100644 --- a/samples/client/echo_api/python/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py +++ b/samples/client/echo_api/python/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(BaseModel): """ @@ -53,7 +51,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -67,16 +65,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter from a dict""" if obj is None: return None diff --git a/samples/client/echo_api/python/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py b/samples/client/echo_api/python/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py index d1d85efa1d5a..d591cf36aba9 100644 --- a/samples/client/echo_api/python/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py +++ b/samples/client/echo_api/python/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,16 +62,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter from a dict""" if obj is None: return None diff --git a/samples/client/echo_api/python/openapi_client/rest.py b/samples/client/echo_api/python/openapi_client/rest.py index 5d0ca946c1f6..e1d6a981431d 100644 --- a/samples/client/echo_api/python/openapi_client/rest.py +++ b/samples/client/echo_api/python/openapi_client/rest.py @@ -72,56 +72,45 @@ def __init__(self, configuration) -> None: else: cert_reqs = ssl.CERT_NONE - addition_pool_args = {} + pool_args = { + "cert_reqs": cert_reqs, + "ca_certs": configuration.ssl_ca_cert, + "cert_file": configuration.cert_file, + "key_file": configuration.key_file, + } if configuration.assert_hostname is not None: - addition_pool_args['assert_hostname'] = ( + pool_args['assert_hostname'] = ( configuration.assert_hostname ) if configuration.retries is not None: - addition_pool_args['retries'] = configuration.retries + pool_args['retries'] = configuration.retries if configuration.tls_server_name: - addition_pool_args['server_hostname'] = configuration.tls_server_name + pool_args['server_hostname'] = configuration.tls_server_name if configuration.socket_options is not None: - addition_pool_args['socket_options'] = configuration.socket_options + pool_args['socket_options'] = configuration.socket_options if configuration.connection_pool_maxsize is not None: - addition_pool_args['maxsize'] = configuration.connection_pool_maxsize + pool_args['maxsize'] = configuration.connection_pool_maxsize # https pool manager + self.pool_manager: urllib3.PoolManager + if configuration.proxy: if is_socks_proxy_url(configuration.proxy): from urllib3.contrib.socks import SOCKSProxyManager - self.pool_manager = SOCKSProxyManager( - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - proxy_url=configuration.proxy, - headers=configuration.proxy_headers, - **addition_pool_args - ) + pool_args["proxy_url"] = configuration.proxy + pool_args["headers"] = configuration.proxy_headers + self.pool_manager = SOCKSProxyManager(**pool_args) else: - self.pool_manager = urllib3.ProxyManager( - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - proxy_url=configuration.proxy, - proxy_headers=configuration.proxy_headers, - **addition_pool_args - ) + pool_args["proxy_url"] = configuration.proxy + pool_args["proxy_headers"] = configuration.proxy_headers + self.pool_manager = urllib3.ProxyManager(**pool_args) else: - self.pool_manager = urllib3.PoolManager( - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - **addition_pool_args - ) + self.pool_manager = urllib3.PoolManager(**pool_args) def request( self, diff --git a/samples/client/echo_api/python/poetry.lock b/samples/client/echo_api/python/poetry.lock new file mode 100644 index 000000000000..7dfd40d63a77 --- /dev/null +++ b/samples/client/echo_api/python/poetry.lock @@ -0,0 +1,614 @@ +# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. + +[[package]] +name = "annotated-types" +version = "0.5.0" +description = "Reusable constraint types to use with typing.Annotated" +optional = false +python-versions = ">=3.7" +files = [ + {file = "annotated_types-0.5.0-py3-none-any.whl", hash = "sha256:58da39888f92c276ad970249761ebea80ba544b77acddaa1a4d6cf78287d45fd"}, + {file = "annotated_types-0.5.0.tar.gz", hash = "sha256:47cdc3490d9ac1506ce92c7aaa76c579dc3509ff11e098fc867e5130ab7be802"}, +] + +[package.dependencies] +typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""} + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "distlib" +version = "0.3.8" +description = "Distribution utilities" +optional = false +python-versions = "*" +files = [ + {file = "distlib-0.3.8-py2.py3-none-any.whl", hash = "sha256:034db59a0b96f8ca18035f36290806a9a6e6bd9d1ff91e45a7f172eb17e51784"}, + {file = "distlib-0.3.8.tar.gz", hash = "sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64"}, +] + +[[package]] +name = "exceptiongroup" +version = "1.2.0" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"}, + {file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"}, +] + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "filelock" +version = "3.12.2" +description = "A platform independent file lock." +optional = false +python-versions = ">=3.7" +files = [ + {file = "filelock-3.12.2-py3-none-any.whl", hash = "sha256:cbb791cdea2a72f23da6ac5b5269ab0a0d161e9ef0100e653b69049a7706d1ec"}, + {file = "filelock-3.12.2.tar.gz", hash = "sha256:002740518d8aa59a26b0c76e10fb8c6e15eae825d34b6fdf670333fd7b938d81"}, +] + +[package.extras] +docs = ["furo (>=2023.5.20)", "sphinx (>=7.0.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4.1)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] + +[[package]] +name = "flake8" +version = "5.0.4" +description = "the modular source code checker: pep8 pyflakes and co" +optional = false +python-versions = ">=3.6.1" +files = [ + {file = "flake8-5.0.4-py2.py3-none-any.whl", hash = "sha256:7a1cf6b73744f5806ab95e526f6f0d8c01c66d7bbe349562d22dfca20610b248"}, + {file = "flake8-5.0.4.tar.gz", hash = "sha256:6fbe320aad8d6b95cec8b8e47bc933004678dc63095be98528b7bdd2a9f510db"}, +] + +[package.dependencies] +importlib-metadata = {version = ">=1.1.0,<4.3", markers = "python_version < \"3.8\""} +mccabe = ">=0.7.0,<0.8.0" +pycodestyle = ">=2.9.0,<2.10.0" +pyflakes = ">=2.5.0,<2.6.0" + +[[package]] +name = "importlib-metadata" +version = "4.2.0" +description = "Read metadata from Python packages" +optional = false +python-versions = ">=3.6" +files = [ + {file = "importlib_metadata-4.2.0-py3-none-any.whl", hash = "sha256:057e92c15bc8d9e8109738a48db0ccb31b4d9d5cfbee5a8670879a30be66304b"}, + {file = "importlib_metadata-4.2.0.tar.gz", hash = "sha256:b7e52a1f8dec14a75ea73e0891f3060099ca1d8e6a462a4dff11c3e119ea1b31"}, +] + +[package.dependencies] +typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} +zipp = ">=0.5" + +[package.extras] +docs = ["jaraco.packaging (>=8.2)", "rst.linker (>=1.9)", "sphinx"] +testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pep517", "pyfakefs", "pytest (>=4.6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-flake8", "pytest-mypy"] + +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + +[[package]] +name = "mccabe" +version = "0.7.0" +description = "McCabe checker, plugin for flake8" +optional = false +python-versions = ">=3.6" +files = [ + {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, + {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, +] + +[[package]] +name = "mypy" +version = "1.4.1" +description = "Optional static typing for Python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "mypy-1.4.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:566e72b0cd6598503e48ea610e0052d1b8168e60a46e0bfd34b3acf2d57f96a8"}, + {file = "mypy-1.4.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:ca637024ca67ab24a7fd6f65d280572c3794665eaf5edcc7e90a866544076878"}, + {file = "mypy-1.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0dde1d180cd84f0624c5dcaaa89c89775550a675aff96b5848de78fb11adabcd"}, + {file = "mypy-1.4.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:8c4d8e89aa7de683e2056a581ce63c46a0c41e31bd2b6d34144e2c80f5ea53dc"}, + {file = "mypy-1.4.1-cp310-cp310-win_amd64.whl", hash = "sha256:bfdca17c36ae01a21274a3c387a63aa1aafe72bff976522886869ef131b937f1"}, + {file = "mypy-1.4.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7549fbf655e5825d787bbc9ecf6028731973f78088fbca3a1f4145c39ef09462"}, + {file = "mypy-1.4.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:98324ec3ecf12296e6422939e54763faedbfcc502ea4a4c38502082711867258"}, + {file = "mypy-1.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:141dedfdbfe8a04142881ff30ce6e6653c9685b354876b12e4fe6c78598b45e2"}, + {file = "mypy-1.4.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:8207b7105829eca6f3d774f64a904190bb2231de91b8b186d21ffd98005f14a7"}, + {file = "mypy-1.4.1-cp311-cp311-win_amd64.whl", hash = "sha256:16f0db5b641ba159eff72cff08edc3875f2b62b2fa2bc24f68c1e7a4e8232d01"}, + {file = "mypy-1.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:470c969bb3f9a9efcedbadcd19a74ffb34a25f8e6b0e02dae7c0e71f8372f97b"}, + {file = "mypy-1.4.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e5952d2d18b79f7dc25e62e014fe5a23eb1a3d2bc66318df8988a01b1a037c5b"}, + {file = "mypy-1.4.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:190b6bab0302cec4e9e6767d3eb66085aef2a1cc98fe04936d8a42ed2ba77bb7"}, + {file = "mypy-1.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:9d40652cc4fe33871ad3338581dca3297ff5f2213d0df345bcfbde5162abf0c9"}, + {file = "mypy-1.4.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:01fd2e9f85622d981fd9063bfaef1aed6e336eaacca00892cd2d82801ab7c042"}, + {file = "mypy-1.4.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:2460a58faeea905aeb1b9b36f5065f2dc9a9c6e4c992a6499a2360c6c74ceca3"}, + {file = "mypy-1.4.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a2746d69a8196698146a3dbe29104f9eb6a2a4d8a27878d92169a6c0b74435b6"}, + {file = "mypy-1.4.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:ae704dcfaa180ff7c4cfbad23e74321a2b774f92ca77fd94ce1049175a21c97f"}, + {file = "mypy-1.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:43d24f6437925ce50139a310a64b2ab048cb2d3694c84c71c3f2a1626d8101dc"}, + {file = "mypy-1.4.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c482e1246726616088532b5e964e39765b6d1520791348e6c9dc3af25b233828"}, + {file = "mypy-1.4.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:43b592511672017f5b1a483527fd2684347fdffc041c9ef53428c8dc530f79a3"}, + {file = "mypy-1.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:34a9239d5b3502c17f07fd7c0b2ae6b7dd7d7f6af35fbb5072c6208e76295816"}, + {file = "mypy-1.4.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5703097c4936bbb9e9bce41478c8d08edd2865e177dc4c52be759f81ee4dd26c"}, + {file = "mypy-1.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:e02d700ec8d9b1859790c0475df4e4092c7bf3272a4fd2c9f33d87fac4427b8f"}, + {file = "mypy-1.4.1-py3-none-any.whl", hash = "sha256:45d32cec14e7b97af848bddd97d85ea4f0db4d5a149ed9676caa4eb2f7402bb4"}, + {file = "mypy-1.4.1.tar.gz", hash = "sha256:9bbcd9ab8ea1f2e1c8031c21445b511442cc45c89951e49bbf852cbb70755b1b"}, +] + +[package.dependencies] +mypy-extensions = ">=1.0.0" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typed-ast = {version = ">=1.4.0,<2", markers = "python_version < \"3.8\""} +typing-extensions = ">=4.1.0" + +[package.extras] +dmypy = ["psutil (>=4.0)"] +install-types = ["pip"] +python2 = ["typed-ast (>=1.4.0,<2)"] +reports = ["lxml"] + +[[package]] +name = "mypy-extensions" +version = "1.0.0" +description = "Type system extensions for programs checked with the mypy type checker." +optional = false +python-versions = ">=3.5" +files = [ + {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, + {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, +] + +[[package]] +name = "packaging" +version = "23.2" +description = "Core utilities for Python packages" +optional = false +python-versions = ">=3.7" +files = [ + {file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"}, + {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"}, +] + +[[package]] +name = "platformdirs" +version = "2.6.2" +description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +optional = false +python-versions = ">=3.7" +files = [ + {file = "platformdirs-2.6.2-py3-none-any.whl", hash = "sha256:83c8f6d04389165de7c9b6f0c682439697887bca0aa2f1c87ef1826be3584490"}, + {file = "platformdirs-2.6.2.tar.gz", hash = "sha256:e1fea1fe471b9ff8332e229df3cb7de4f53eeea4998d3b6bfff542115e998bd2"}, +] + +[package.dependencies] +typing-extensions = {version = ">=4.4", markers = "python_version < \"3.8\""} + +[package.extras] +docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=5.3)", "sphinx-autodoc-typehints (>=1.19.5)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.2.2)", "pytest (>=7.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] + +[[package]] +name = "pluggy" +version = "1.2.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pluggy-1.2.0-py3-none-any.whl", hash = "sha256:c2fd55a7d7a3863cba1a013e4e2414658b1d07b6bc57b3919e0c63c9abb99849"}, + {file = "pluggy-1.2.0.tar.gz", hash = "sha256:d12f0c4b579b15f5e054301bb226ee85eeeba08ffec228092f8defbaa3a4c4b3"}, +] + +[package.dependencies] +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "py" +version = "1.11.0" +description = "library with cross-python path, ini-parsing, io, code, log facilities" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +files = [ + {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, + {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, +] + +[[package]] +name = "pycodestyle" +version = "2.9.1" +description = "Python style guide checker" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pycodestyle-2.9.1-py2.py3-none-any.whl", hash = "sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b"}, + {file = "pycodestyle-2.9.1.tar.gz", hash = "sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785"}, +] + +[[package]] +name = "pydantic" +version = "2.5.3" +description = "Data validation using Python type hints" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pydantic-2.5.3-py3-none-any.whl", hash = "sha256:d0caf5954bee831b6bfe7e338c32b9e30c85dfe080c843680783ac2b631673b4"}, + {file = "pydantic-2.5.3.tar.gz", hash = "sha256:b3ef57c62535b0941697cce638c08900d87fcb67e29cfa99e8a68f747f393f7a"}, +] + +[package.dependencies] +annotated-types = ">=0.4.0" +importlib-metadata = {version = "*", markers = "python_version == \"3.7\""} +pydantic-core = "2.14.6" +typing-extensions = ">=4.6.1" + +[package.extras] +email = ["email-validator (>=2.0.0)"] + +[[package]] +name = "pydantic-core" +version = "2.14.6" +description = "" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pydantic_core-2.14.6-cp310-cp310-macosx_10_7_x86_64.whl", hash = "sha256:72f9a942d739f09cd42fffe5dc759928217649f070056f03c70df14f5770acf9"}, + {file = "pydantic_core-2.14.6-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:6a31d98c0d69776c2576dda4b77b8e0c69ad08e8b539c25c7d0ca0dc19a50d6c"}, + {file = "pydantic_core-2.14.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5aa90562bc079c6c290f0512b21768967f9968e4cfea84ea4ff5af5d917016e4"}, + {file = "pydantic_core-2.14.6-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:370ffecb5316ed23b667d99ce4debe53ea664b99cc37bfa2af47bc769056d534"}, + {file = "pydantic_core-2.14.6-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f85f3843bdb1fe80e8c206fe6eed7a1caeae897e496542cee499c374a85c6e08"}, + {file = "pydantic_core-2.14.6-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9862bf828112e19685b76ca499b379338fd4c5c269d897e218b2ae8fcb80139d"}, + {file = "pydantic_core-2.14.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:036137b5ad0cb0004c75b579445a1efccd072387a36c7f217bb8efd1afbe5245"}, + {file = "pydantic_core-2.14.6-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:92879bce89f91f4b2416eba4429c7b5ca22c45ef4a499c39f0c5c69257522c7c"}, + {file = "pydantic_core-2.14.6-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:0c08de15d50fa190d577e8591f0329a643eeaed696d7771760295998aca6bc66"}, + {file = "pydantic_core-2.14.6-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:36099c69f6b14fc2c49d7996cbf4f87ec4f0e66d1c74aa05228583225a07b590"}, + {file = "pydantic_core-2.14.6-cp310-none-win32.whl", hash = "sha256:7be719e4d2ae6c314f72844ba9d69e38dff342bc360379f7c8537c48e23034b7"}, + {file = "pydantic_core-2.14.6-cp310-none-win_amd64.whl", hash = "sha256:36fa402dcdc8ea7f1b0ddcf0df4254cc6b2e08f8cd80e7010d4c4ae6e86b2a87"}, + {file = "pydantic_core-2.14.6-cp311-cp311-macosx_10_7_x86_64.whl", hash = "sha256:dea7fcd62915fb150cdc373212141a30037e11b761fbced340e9db3379b892d4"}, + {file = "pydantic_core-2.14.6-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ffff855100bc066ff2cd3aa4a60bc9534661816b110f0243e59503ec2df38421"}, + {file = "pydantic_core-2.14.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1b027c86c66b8627eb90e57aee1f526df77dc6d8b354ec498be9a757d513b92b"}, + {file = "pydantic_core-2.14.6-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:00b1087dabcee0b0ffd104f9f53d7d3eaddfaa314cdd6726143af6bc713aa27e"}, + {file = "pydantic_core-2.14.6-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:75ec284328b60a4e91010c1acade0c30584f28a1f345bc8f72fe8b9e46ec6a96"}, + {file = "pydantic_core-2.14.6-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7e1f4744eea1501404b20b0ac059ff7e3f96a97d3e3f48ce27a139e053bb370b"}, + {file = "pydantic_core-2.14.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b2602177668f89b38b9f84b7b3435d0a72511ddef45dc14446811759b82235a1"}, + {file = "pydantic_core-2.14.6-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6c8edaea3089bf908dd27da8f5d9e395c5b4dc092dbcce9b65e7156099b4b937"}, + {file = "pydantic_core-2.14.6-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:478e9e7b360dfec451daafe286998d4a1eeaecf6d69c427b834ae771cad4b622"}, + {file = "pydantic_core-2.14.6-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:b6ca36c12a5120bad343eef193cc0122928c5c7466121da7c20f41160ba00ba2"}, + {file = "pydantic_core-2.14.6-cp311-none-win32.whl", hash = "sha256:2b8719037e570639e6b665a4050add43134d80b687288ba3ade18b22bbb29dd2"}, + {file = "pydantic_core-2.14.6-cp311-none-win_amd64.whl", hash = "sha256:78ee52ecc088c61cce32b2d30a826f929e1708f7b9247dc3b921aec367dc1b23"}, + {file = "pydantic_core-2.14.6-cp311-none-win_arm64.whl", hash = "sha256:a19b794f8fe6569472ff77602437ec4430f9b2b9ec7a1105cfd2232f9ba355e6"}, + {file = "pydantic_core-2.14.6-cp312-cp312-macosx_10_7_x86_64.whl", hash = "sha256:667aa2eac9cd0700af1ddb38b7b1ef246d8cf94c85637cbb03d7757ca4c3fdec"}, + {file = "pydantic_core-2.14.6-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:cdee837710ef6b56ebd20245b83799fce40b265b3b406e51e8ccc5b85b9099b7"}, + {file = "pydantic_core-2.14.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2c5bcf3414367e29f83fd66f7de64509a8fd2368b1edf4351e862910727d3e51"}, + {file = "pydantic_core-2.14.6-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:26a92ae76f75d1915806b77cf459811e772d8f71fd1e4339c99750f0e7f6324f"}, + {file = "pydantic_core-2.14.6-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a983cca5ed1dd9a35e9e42ebf9f278d344603bfcb174ff99a5815f953925140a"}, + {file = "pydantic_core-2.14.6-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cb92f9061657287eded380d7dc455bbf115430b3aa4741bdc662d02977e7d0af"}, + {file = "pydantic_core-2.14.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e4ace1e220b078c8e48e82c081e35002038657e4b37d403ce940fa679e57113b"}, + {file = "pydantic_core-2.14.6-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ef633add81832f4b56d3b4c9408b43d530dfca29e68fb1b797dcb861a2c734cd"}, + {file = "pydantic_core-2.14.6-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:7e90d6cc4aad2cc1f5e16ed56e46cebf4877c62403a311af20459c15da76fd91"}, + {file = "pydantic_core-2.14.6-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:e8a5ac97ea521d7bde7621d86c30e86b798cdecd985723c4ed737a2aa9e77d0c"}, + {file = "pydantic_core-2.14.6-cp312-none-win32.whl", hash = "sha256:f27207e8ca3e5e021e2402ba942e5b4c629718e665c81b8b306f3c8b1ddbb786"}, + {file = "pydantic_core-2.14.6-cp312-none-win_amd64.whl", hash = "sha256:b3e5fe4538001bb82e2295b8d2a39356a84694c97cb73a566dc36328b9f83b40"}, + {file = "pydantic_core-2.14.6-cp312-none-win_arm64.whl", hash = "sha256:64634ccf9d671c6be242a664a33c4acf12882670b09b3f163cd00a24cffbd74e"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-macosx_10_7_x86_64.whl", hash = "sha256:24368e31be2c88bd69340fbfe741b405302993242ccb476c5c3ff48aeee1afe0"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-macosx_11_0_arm64.whl", hash = "sha256:e33b0834f1cf779aa839975f9d8755a7c2420510c0fa1e9fa0497de77cd35d2c"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6af4b3f52cc65f8a0bc8b1cd9676f8c21ef3e9132f21fed250f6958bd7223bed"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d15687d7d7f40333bd8266f3814c591c2e2cd263fa2116e314f60d82086e353a"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:095b707bb287bfd534044166ab767bec70a9bba3175dcdc3371782175c14e43c"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:94fc0e6621e07d1e91c44e016cc0b189b48db053061cc22d6298a611de8071bb"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1ce830e480f6774608dedfd4a90c42aac4a7af0a711f1b52f807130c2e434c06"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:a306cdd2ad3a7d795d8e617a58c3a2ed0f76c8496fb7621b6cd514eb1532cae8"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:2f5fa187bde8524b1e37ba894db13aadd64faa884657473b03a019f625cee9a8"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:438027a975cc213a47c5d70672e0d29776082155cfae540c4e225716586be75e"}, + {file = "pydantic_core-2.14.6-cp37-none-win32.whl", hash = "sha256:f96ae96a060a8072ceff4cfde89d261837b4294a4f28b84a28765470d502ccc6"}, + {file = "pydantic_core-2.14.6-cp37-none-win_amd64.whl", hash = "sha256:e646c0e282e960345314f42f2cea5e0b5f56938c093541ea6dbf11aec2862391"}, + {file = "pydantic_core-2.14.6-cp38-cp38-macosx_10_7_x86_64.whl", hash = "sha256:db453f2da3f59a348f514cfbfeb042393b68720787bbef2b4c6068ea362c8149"}, + {file = "pydantic_core-2.14.6-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:3860c62057acd95cc84044e758e47b18dcd8871a328ebc8ccdefd18b0d26a21b"}, + {file = "pydantic_core-2.14.6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:36026d8f99c58d7044413e1b819a67ca0e0b8ebe0f25e775e6c3d1fabb3c38fb"}, + {file = "pydantic_core-2.14.6-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8ed1af8692bd8d2a29d702f1a2e6065416d76897d726e45a1775b1444f5928a7"}, + {file = "pydantic_core-2.14.6-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:314ccc4264ce7d854941231cf71b592e30d8d368a71e50197c905874feacc8a8"}, + {file = "pydantic_core-2.14.6-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:982487f8931067a32e72d40ab6b47b1628a9c5d344be7f1a4e668fb462d2da42"}, + {file = "pydantic_core-2.14.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2dbe357bc4ddda078f79d2a36fc1dd0494a7f2fad83a0a684465b6f24b46fe80"}, + {file = "pydantic_core-2.14.6-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2f6ffc6701a0eb28648c845f4945a194dc7ab3c651f535b81793251e1185ac3d"}, + {file = "pydantic_core-2.14.6-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:7f5025db12fc6de7bc1104d826d5aee1d172f9ba6ca936bf6474c2148ac336c1"}, + {file = "pydantic_core-2.14.6-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:dab03ed811ed1c71d700ed08bde8431cf429bbe59e423394f0f4055f1ca0ea60"}, + {file = "pydantic_core-2.14.6-cp38-none-win32.whl", hash = "sha256:dfcbebdb3c4b6f739a91769aea5ed615023f3c88cb70df812849aef634c25fbe"}, + {file = "pydantic_core-2.14.6-cp38-none-win_amd64.whl", hash = "sha256:99b14dbea2fdb563d8b5a57c9badfcd72083f6006caf8e126b491519c7d64ca8"}, + {file = "pydantic_core-2.14.6-cp39-cp39-macosx_10_7_x86_64.whl", hash = "sha256:4ce8299b481bcb68e5c82002b96e411796b844d72b3e92a3fbedfe8e19813eab"}, + {file = "pydantic_core-2.14.6-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:b9a9d92f10772d2a181b5ca339dee066ab7d1c9a34ae2421b2a52556e719756f"}, + {file = "pydantic_core-2.14.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fd9e98b408384989ea4ab60206b8e100d8687da18b5c813c11e92fd8212a98e0"}, + {file = "pydantic_core-2.14.6-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4f86f1f318e56f5cbb282fe61eb84767aee743ebe32c7c0834690ebea50c0a6b"}, + {file = "pydantic_core-2.14.6-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:86ce5fcfc3accf3a07a729779d0b86c5d0309a4764c897d86c11089be61da160"}, + {file = "pydantic_core-2.14.6-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3dcf1978be02153c6a31692d4fbcc2a3f1db9da36039ead23173bc256ee3b91b"}, + {file = "pydantic_core-2.14.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eedf97be7bc3dbc8addcef4142f4b4164066df0c6f36397ae4aaed3eb187d8ab"}, + {file = "pydantic_core-2.14.6-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d5f916acf8afbcab6bacbb376ba7dc61f845367901ecd5e328fc4d4aef2fcab0"}, + {file = "pydantic_core-2.14.6-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:8a14c192c1d724c3acbfb3f10a958c55a2638391319ce8078cb36c02283959b9"}, + {file = "pydantic_core-2.14.6-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:0348b1dc6b76041516e8a854ff95b21c55f5a411c3297d2ca52f5528e49d8411"}, + {file = "pydantic_core-2.14.6-cp39-none-win32.whl", hash = "sha256:de2a0645a923ba57c5527497daf8ec5df69c6eadf869e9cd46e86349146e5975"}, + {file = "pydantic_core-2.14.6-cp39-none-win_amd64.whl", hash = "sha256:aca48506a9c20f68ee61c87f2008f81f8ee99f8d7f0104bff3c47e2d148f89d9"}, + {file = "pydantic_core-2.14.6-pp310-pypy310_pp73-macosx_10_7_x86_64.whl", hash = "sha256:d5c28525c19f5bb1e09511669bb57353d22b94cf8b65f3a8d141c389a55dec95"}, + {file = "pydantic_core-2.14.6-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:78d0768ee59baa3de0f4adac9e3748b4b1fffc52143caebddfd5ea2961595277"}, + {file = "pydantic_core-2.14.6-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8b93785eadaef932e4fe9c6e12ba67beb1b3f1e5495631419c784ab87e975670"}, + {file = "pydantic_core-2.14.6-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a874f21f87c485310944b2b2734cd6d318765bcbb7515eead33af9641816506e"}, + {file = "pydantic_core-2.14.6-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b89f4477d915ea43b4ceea6756f63f0288941b6443a2b28c69004fe07fde0d0d"}, + {file = "pydantic_core-2.14.6-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:172de779e2a153d36ee690dbc49c6db568d7b33b18dc56b69a7514aecbcf380d"}, + {file = "pydantic_core-2.14.6-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:dfcebb950aa7e667ec226a442722134539e77c575f6cfaa423f24371bb8d2e94"}, + {file = "pydantic_core-2.14.6-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:55a23dcd98c858c0db44fc5c04fc7ed81c4b4d33c653a7c45ddaebf6563a2f66"}, + {file = "pydantic_core-2.14.6-pp37-pypy37_pp73-macosx_10_7_x86_64.whl", hash = "sha256:4241204e4b36ab5ae466ecec5c4c16527a054c69f99bba20f6f75232a6a534e2"}, + {file = "pydantic_core-2.14.6-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e574de99d735b3fc8364cba9912c2bec2da78775eba95cbb225ef7dda6acea24"}, + {file = "pydantic_core-2.14.6-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1302a54f87b5cd8528e4d6d1bf2133b6aa7c6122ff8e9dc5220fbc1e07bffebd"}, + {file = "pydantic_core-2.14.6-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f8e81e4b55930e5ffab4a68db1af431629cf2e4066dbdbfef65348b8ab804ea8"}, + {file = "pydantic_core-2.14.6-pp37-pypy37_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:c99462ffc538717b3e60151dfaf91125f637e801f5ab008f81c402f1dff0cd0f"}, + {file = "pydantic_core-2.14.6-pp37-pypy37_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:e4cf2d5829f6963a5483ec01578ee76d329eb5caf330ecd05b3edd697e7d768a"}, + {file = "pydantic_core-2.14.6-pp38-pypy38_pp73-macosx_10_7_x86_64.whl", hash = "sha256:cf10b7d58ae4a1f07fccbf4a0a956d705356fea05fb4c70608bb6fa81d103cda"}, + {file = "pydantic_core-2.14.6-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:399ac0891c284fa8eb998bcfa323f2234858f5d2efca3950ae58c8f88830f145"}, + {file = "pydantic_core-2.14.6-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9c6a5c79b28003543db3ba67d1df336f253a87d3112dac3a51b94f7d48e4c0e1"}, + {file = "pydantic_core-2.14.6-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:599c87d79cab2a6a2a9df4aefe0455e61e7d2aeede2f8577c1b7c0aec643ee8e"}, + {file = "pydantic_core-2.14.6-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:43e166ad47ba900f2542a80d83f9fc65fe99eb63ceec4debec160ae729824052"}, + {file = "pydantic_core-2.14.6-pp38-pypy38_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:3a0b5db001b98e1c649dd55afa928e75aa4087e587b9524a4992316fa23c9fba"}, + {file = "pydantic_core-2.14.6-pp38-pypy38_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:747265448cb57a9f37572a488a57d873fd96bf51e5bb7edb52cfb37124516da4"}, + {file = "pydantic_core-2.14.6-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:7ebe3416785f65c28f4f9441e916bfc8a54179c8dea73c23023f7086fa601c5d"}, + {file = "pydantic_core-2.14.6-pp39-pypy39_pp73-macosx_10_7_x86_64.whl", hash = "sha256:86c963186ca5e50d5c8287b1d1c9d3f8f024cbe343d048c5bd282aec2d8641f2"}, + {file = "pydantic_core-2.14.6-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:e0641b506486f0b4cd1500a2a65740243e8670a2549bb02bc4556a83af84ae03"}, + {file = "pydantic_core-2.14.6-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:71d72ca5eaaa8d38c8df16b7deb1a2da4f650c41b58bb142f3fb75d5ad4a611f"}, + {file = "pydantic_core-2.14.6-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:27e524624eace5c59af499cd97dc18bb201dc6a7a2da24bfc66ef151c69a5f2a"}, + {file = "pydantic_core-2.14.6-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:a3dde6cac75e0b0902778978d3b1646ca9f438654395a362cb21d9ad34b24acf"}, + {file = "pydantic_core-2.14.6-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:00646784f6cd993b1e1c0e7b0fdcbccc375d539db95555477771c27555e3c556"}, + {file = "pydantic_core-2.14.6-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:23598acb8ccaa3d1d875ef3b35cb6376535095e9405d91a3d57a8c7db5d29341"}, + {file = "pydantic_core-2.14.6-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:7f41533d7e3cf9520065f610b41ac1c76bc2161415955fbcead4981b22c7611e"}, + {file = "pydantic_core-2.14.6.tar.gz", hash = "sha256:1fd0c1d395372843fba13a51c28e3bb9d59bd7aebfeb17358ffaaa1e4dbbe948"}, +] + +[package.dependencies] +typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" + +[[package]] +name = "pyflakes" +version = "2.5.0" +description = "passive checker of Python programs" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pyflakes-2.5.0-py2.py3-none-any.whl", hash = "sha256:4579f67d887f804e67edb544428f264b7b24f435b263c4614f384135cea553d2"}, + {file = "pyflakes-2.5.0.tar.gz", hash = "sha256:491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3"}, +] + +[[package]] +name = "pytest" +version = "7.4.4" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, + {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" +tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "python-dateutil" +version = "2.8.2" +description = "Extensions to the standard Python datetime module" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" +files = [ + {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, + {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, +] + +[package.dependencies] +six = ">=1.5" + +[[package]] +name = "six" +version = "1.16.0" +description = "Python 2 and 3 compatibility utilities" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +files = [ + {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, + {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, +] + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] + +[[package]] +name = "tox" +version = "3.28.0" +description = "tox is a generic virtualenv management and test command line tool" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" +files = [ + {file = "tox-3.28.0-py2.py3-none-any.whl", hash = "sha256:57b5ab7e8bb3074edc3c0c0b4b192a4f3799d3723b2c5b76f1fa9f2d40316eea"}, + {file = "tox-3.28.0.tar.gz", hash = "sha256:d0d28f3fe6d6d7195c27f8b054c3e99d5451952b54abdae673b71609a581f640"}, +] + +[package.dependencies] +colorama = {version = ">=0.4.1", markers = "platform_system == \"Windows\""} +filelock = ">=3.0.0" +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} +packaging = ">=14" +pluggy = ">=0.12.0" +py = ">=1.4.17" +six = ">=1.14.0" +tomli = {version = ">=2.0.1", markers = "python_version >= \"3.7\" and python_version < \"3.11\""} +virtualenv = ">=16.0.0,<20.0.0 || >20.0.0,<20.0.1 || >20.0.1,<20.0.2 || >20.0.2,<20.0.3 || >20.0.3,<20.0.4 || >20.0.4,<20.0.5 || >20.0.5,<20.0.6 || >20.0.6,<20.0.7 || >20.0.7" + +[package.extras] +docs = ["pygments-github-lexers (>=0.0.5)", "sphinx (>=2.0.0)", "sphinxcontrib-autoprogram (>=0.1.5)", "towncrier (>=18.5.0)"] +testing = ["flaky (>=3.4.0)", "freezegun (>=0.3.11)", "pathlib2 (>=2.3.3)", "psutil (>=5.6.1)", "pytest (>=4.0.0)", "pytest-cov (>=2.5.1)", "pytest-mock (>=1.10.0)", "pytest-randomly (>=1.0.0)"] + +[[package]] +name = "typed-ast" +version = "1.5.5" +description = "a fork of Python 2 and 3 ast modules with type comment support" +optional = false +python-versions = ">=3.6" +files = [ + {file = "typed_ast-1.5.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:4bc1efe0ce3ffb74784e06460f01a223ac1f6ab31c6bc0376a21184bf5aabe3b"}, + {file = "typed_ast-1.5.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5f7a8c46a8b333f71abd61d7ab9255440d4a588f34a21f126bbfc95f6049e686"}, + {file = "typed_ast-1.5.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:597fc66b4162f959ee6a96b978c0435bd63791e31e4f410622d19f1686d5e769"}, + {file = "typed_ast-1.5.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d41b7a686ce653e06c2609075d397ebd5b969d821b9797d029fccd71fdec8e04"}, + {file = "typed_ast-1.5.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:5fe83a9a44c4ce67c796a1b466c270c1272e176603d5e06f6afbc101a572859d"}, + {file = "typed_ast-1.5.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:d5c0c112a74c0e5db2c75882a0adf3133adedcdbfd8cf7c9d6ed77365ab90a1d"}, + {file = "typed_ast-1.5.5-cp310-cp310-win_amd64.whl", hash = "sha256:e1a976ed4cc2d71bb073e1b2a250892a6e968ff02aa14c1f40eba4f365ffec02"}, + {file = "typed_ast-1.5.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c631da9710271cb67b08bd3f3813b7af7f4c69c319b75475436fcab8c3d21bee"}, + {file = "typed_ast-1.5.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b445c2abfecab89a932b20bd8261488d574591173d07827c1eda32c457358b18"}, + {file = "typed_ast-1.5.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cc95ffaaab2be3b25eb938779e43f513e0e538a84dd14a5d844b8f2932593d88"}, + {file = "typed_ast-1.5.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:61443214d9b4c660dcf4b5307f15c12cb30bdfe9588ce6158f4a005baeb167b2"}, + {file = "typed_ast-1.5.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:6eb936d107e4d474940469e8ec5b380c9b329b5f08b78282d46baeebd3692dc9"}, + {file = "typed_ast-1.5.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e48bf27022897577d8479eaed64701ecaf0467182448bd95759883300ca818c8"}, + {file = "typed_ast-1.5.5-cp311-cp311-win_amd64.whl", hash = "sha256:83509f9324011c9a39faaef0922c6f720f9623afe3fe220b6d0b15638247206b"}, + {file = "typed_ast-1.5.5-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:44f214394fc1af23ca6d4e9e744804d890045d1643dd7e8229951e0ef39429b5"}, + {file = "typed_ast-1.5.5-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:118c1ce46ce58fda78503eae14b7664163aa735b620b64b5b725453696f2a35c"}, + {file = "typed_ast-1.5.5-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:be4919b808efa61101456e87f2d4c75b228f4e52618621c77f1ddcaae15904fa"}, + {file = "typed_ast-1.5.5-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:fc2b8c4e1bc5cd96c1a823a885e6b158f8451cf6f5530e1829390b4d27d0807f"}, + {file = "typed_ast-1.5.5-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:16f7313e0a08c7de57f2998c85e2a69a642e97cb32f87eb65fbfe88381a5e44d"}, + {file = "typed_ast-1.5.5-cp36-cp36m-win_amd64.whl", hash = "sha256:2b946ef8c04f77230489f75b4b5a4a6f24c078be4aed241cfabe9cbf4156e7e5"}, + {file = "typed_ast-1.5.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:2188bc33d85951ea4ddad55d2b35598b2709d122c11c75cffd529fbc9965508e"}, + {file = "typed_ast-1.5.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0635900d16ae133cab3b26c607586131269f88266954eb04ec31535c9a12ef1e"}, + {file = "typed_ast-1.5.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:57bfc3cf35a0f2fdf0a88a3044aafaec1d2f24d8ae8cd87c4f58d615fb5b6311"}, + {file = "typed_ast-1.5.5-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:fe58ef6a764de7b4b36edfc8592641f56e69b7163bba9f9c8089838ee596bfb2"}, + {file = "typed_ast-1.5.5-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:d09d930c2d1d621f717bb217bf1fe2584616febb5138d9b3e8cdd26506c3f6d4"}, + {file = "typed_ast-1.5.5-cp37-cp37m-win_amd64.whl", hash = "sha256:d40c10326893ecab8a80a53039164a224984339b2c32a6baf55ecbd5b1df6431"}, + {file = "typed_ast-1.5.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:fd946abf3c31fb50eee07451a6aedbfff912fcd13cf357363f5b4e834cc5e71a"}, + {file = "typed_ast-1.5.5-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ed4a1a42df8a3dfb6b40c3d2de109e935949f2f66b19703eafade03173f8f437"}, + {file = "typed_ast-1.5.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:045f9930a1550d9352464e5149710d56a2aed23a2ffe78946478f7b5416f1ede"}, + {file = "typed_ast-1.5.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:381eed9c95484ceef5ced626355fdc0765ab51d8553fec08661dce654a935db4"}, + {file = "typed_ast-1.5.5-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:bfd39a41c0ef6f31684daff53befddae608f9daf6957140228a08e51f312d7e6"}, + {file = "typed_ast-1.5.5-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:8c524eb3024edcc04e288db9541fe1f438f82d281e591c548903d5b77ad1ddd4"}, + {file = "typed_ast-1.5.5-cp38-cp38-win_amd64.whl", hash = "sha256:7f58fabdde8dcbe764cef5e1a7fcb440f2463c1bbbec1cf2a86ca7bc1f95184b"}, + {file = "typed_ast-1.5.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:042eb665ff6bf020dd2243307d11ed626306b82812aba21836096d229fdc6a10"}, + {file = "typed_ast-1.5.5-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:622e4a006472b05cf6ef7f9f2636edc51bda670b7bbffa18d26b255269d3d814"}, + {file = "typed_ast-1.5.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1efebbbf4604ad1283e963e8915daa240cb4bf5067053cf2f0baadc4d4fb51b8"}, + {file = "typed_ast-1.5.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f0aefdd66f1784c58f65b502b6cf8b121544680456d1cebbd300c2c813899274"}, + {file = "typed_ast-1.5.5-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:48074261a842acf825af1968cd912f6f21357316080ebaca5f19abbb11690c8a"}, + {file = "typed_ast-1.5.5-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:429ae404f69dc94b9361bb62291885894b7c6fb4640d561179548c849f8492ba"}, + {file = "typed_ast-1.5.5-cp39-cp39-win_amd64.whl", hash = "sha256:335f22ccb244da2b5c296e6f96b06ee9bed46526db0de38d2f0e5a6597b81155"}, + {file = "typed_ast-1.5.5.tar.gz", hash = "sha256:94282f7a354f36ef5dbce0ef3467ebf6a258e370ab33d5b40c249fa996e590dd"}, +] + +[[package]] +name = "types-python-dateutil" +version = "2.8.19.14" +description = "Typing stubs for python-dateutil" +optional = false +python-versions = "*" +files = [ + {file = "types-python-dateutil-2.8.19.14.tar.gz", hash = "sha256:1f4f10ac98bb8b16ade9dbee3518d9ace017821d94b057a425b069f834737f4b"}, + {file = "types_python_dateutil-2.8.19.14-py3-none-any.whl", hash = "sha256:f977b8de27787639986b4e28963263fd0e5158942b3ecef91b9335c130cb1ce9"}, +] + +[[package]] +name = "typing-extensions" +version = "4.7.1" +description = "Backported and Experimental Type Hints for Python 3.7+" +optional = false +python-versions = ">=3.7" +files = [ + {file = "typing_extensions-4.7.1-py3-none-any.whl", hash = "sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36"}, + {file = "typing_extensions-4.7.1.tar.gz", hash = "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2"}, +] + +[[package]] +name = "urllib3" +version = "2.0.7" +description = "HTTP library with thread-safe connection pooling, file post, and more." +optional = false +python-versions = ">=3.7" +files = [ + {file = "urllib3-2.0.7-py3-none-any.whl", hash = "sha256:fdb6d215c776278489906c2f8916e6e7d4f5a9b602ccbcfdf7f016fc8da0596e"}, + {file = "urllib3-2.0.7.tar.gz", hash = "sha256:c97dfde1f7bd43a71c8d2a58e369e9b2bf692d1334ea9f9cae55add7d0dd0f84"}, +] + +[package.extras] +brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] +secure = ["certifi", "cryptography (>=1.9)", "idna (>=2.0.0)", "pyopenssl (>=17.1.0)", "urllib3-secure-extra"] +socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] +zstd = ["zstandard (>=0.18.0)"] + +[[package]] +name = "virtualenv" +version = "20.16.2" +description = "Virtual Python Environment builder" +optional = false +python-versions = ">=3.6" +files = [ + {file = "virtualenv-20.16.2-py2.py3-none-any.whl", hash = "sha256:635b272a8e2f77cb051946f46c60a54ace3cb5e25568228bd6b57fc70eca9ff3"}, + {file = "virtualenv-20.16.2.tar.gz", hash = "sha256:0ef5be6d07181946891f5abc8047fda8bc2f0b4b9bf222c64e6e8963baee76db"}, +] + +[package.dependencies] +distlib = ">=0.3.1,<1" +filelock = ">=3.2,<4" +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} +platformdirs = ">=2,<3" + +[package.extras] +docs = ["proselint (>=0.10.2)", "sphinx (>=3)", "sphinx-argparse (>=0.2.5)", "sphinx-rtd-theme (>=0.4.3)", "towncrier (>=21.3)"] +testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "packaging (>=20.0)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)"] + +[[package]] +name = "zipp" +version = "3.15.0" +description = "Backport of pathlib-compatible object wrapper for zip files" +optional = false +python-versions = ">=3.7" +files = [ + {file = "zipp-3.15.0-py3-none-any.whl", hash = "sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556"}, + {file = "zipp-3.15.0.tar.gz", hash = "sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b"}, +] + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"] + +[metadata] +lock-version = "2.0" +python-versions = "^3.7" +content-hash = "e3db4fda1f09507e7001e5eccf6e0827b049b9384dba0fe21c7e1ff0a118503d" diff --git a/samples/client/echo_api/python/pyproject.toml b/samples/client/echo_api/python/pyproject.toml index af471ab63148..1d4cc5350dc8 100644 --- a/samples/client/echo_api/python/pyproject.toml +++ b/samples/client/echo_api/python/pyproject.toml @@ -21,6 +21,9 @@ typing-extensions = ">=4.7.1" pytest = ">=7.2.1" tox = ">=3.9.0" flake8 = ">=4.0.0" +types-python-dateutil = ">=2.8.19.14" +mypy = "1.4.1" + [build-system] requires = ["setuptools"] @@ -28,3 +31,6 @@ build-backend = "setuptools.build_meta" [tool.pylint.'MESSAGES CONTROL'] extension-pkg-whitelist = "pydantic" + +[tool.mypy] +files = ["openapi_client"] diff --git a/samples/client/echo_api/python/test-requirements.txt b/samples/client/echo_api/python/test-requirements.txt index 3a0d0b939a1e..8e6d8cb13749 100644 --- a/samples/client/echo_api/python/test-requirements.txt +++ b/samples/client/echo_api/python/test-requirements.txt @@ -1,3 +1,5 @@ pytest~=7.1.3 pytest-cov>=2.8.1 pytest-randomly>=3.12.0 +mypy>=1.4.1 +types-python-dateutil>=2.8.19 diff --git a/samples/openapi3/client/petstore/python-aiohttp/docs/PropertyNameCollision.md b/samples/openapi3/client/petstore/python-aiohttp/docs/PropertyNameCollision.md index cd80b65dc0c0..0893df6055d0 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/PropertyNameCollision.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/PropertyNameCollision.md @@ -5,9 +5,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**underscore_type** | **str** | | [optional] **type** | **str** | | [optional] -**type** | **str** | | [optional] -**type_** | **str** | | [optional] +**type_with_underscore** | **str** | | [optional] ## Example diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py index 72d39b9c55e6..112f8a4abdaa 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py @@ -26,7 +26,7 @@ from petstore_api.api.user_api import UserApi # import ApiClient -from petstore_api.api_response import ApiResponse +#from petstore_api.api_response import ApiResponse from petstore_api.api_client import ApiClient from petstore_api.configuration import Configuration from petstore_api.exceptions import OpenApiException diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/another_fake_api.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/another_fake_api.py index 1ee8d84e833f..664305726fd1 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/another_fake_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/another_fake_api.py @@ -16,19 +16,15 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import Field from typing_extensions import Annotated from petstore_api.models.client import Client from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse +from petstore_api.api_response import ApiResponse as _ApiResponse from petstore_api.rest import RESTResponseType @@ -128,7 +124,7 @@ async def call_123_test_special_tags_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Client]: + ) -> _ApiResponse[Client]: """To test special tags To test special tags and operation ID starting with number diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/default_api.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/default_api.py index 3693f1c58e84..d4265c6c32b0 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/default_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/default_api.py @@ -16,17 +16,13 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from petstore_api.models.foo_get_default_response import FooGetDefaultResponse from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse +from petstore_api.api_response import ApiResponse as _ApiResponse from petstore_api.rest import RESTResponseType @@ -119,7 +115,7 @@ async def foo_get_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[FooGetDefaultResponse]: + ) -> _ApiResponse[FooGetDefaultResponse]: """foo_get diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py index f996f4125633..69babf6fb1ac 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py @@ -16,12 +16,8 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import Field from typing_extensions import Annotated @@ -43,7 +39,7 @@ from petstore_api.models.user import User from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse +from petstore_api.api_response import ApiResponse as _ApiResponse from petstore_api.rest import RESTResponseType @@ -142,7 +138,7 @@ async def fake_any_type_request_body_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test any type request body @@ -403,7 +399,7 @@ async def fake_enum_ref_query_parameter_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test enum reference query parameter @@ -648,7 +644,7 @@ async def fake_health_get_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[HealthCheckResult]: + ) -> _ApiResponse[HealthCheckResult]: """Health check endpoint @@ -902,7 +898,7 @@ async def fake_http_signature_test_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test http signature authentication @@ -1188,7 +1184,7 @@ async def fake_outer_boolean_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[bool]: + ) -> _ApiResponse[bool]: """fake_outer_boolean_serialize Test serialization of outer boolean types @@ -1458,7 +1454,7 @@ async def fake_outer_composite_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[OuterComposite]: + ) -> _ApiResponse[OuterComposite]: """fake_outer_composite_serialize Test serialization of object with outer number type @@ -1728,7 +1724,7 @@ async def fake_outer_number_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[float]: + ) -> _ApiResponse[float]: """fake_outer_number_serialize Test serialization of outer number types @@ -1998,7 +1994,7 @@ async def fake_outer_string_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """fake_outer_string_serialize Test serialization of outer string types @@ -2268,7 +2264,7 @@ async def fake_property_enum_integer_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[OuterObjectWithEnumProperty]: + ) -> _ApiResponse[OuterObjectWithEnumProperty]: """fake_property_enum_integer_serialize Test serialization of enum (int) properties with examples @@ -2532,7 +2528,7 @@ async def fake_ref_enum_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[EnumClass]: + ) -> _ApiResponse[EnumClass]: """test ref to enum string @@ -2771,7 +2767,7 @@ async def fake_return_list_of_objects_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[List[Tag]]]: + ) -> _ApiResponse[List[List[Tag]]]: """test returning list of objects @@ -3015,7 +3011,7 @@ async def fake_uuid_example_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test uuid example @@ -3266,7 +3262,7 @@ async def test_body_with_binary_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test_body_with_binary For this test, the body has to be a binary file. @@ -3535,7 +3531,7 @@ async def test_body_with_file_schema_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test_body_with_file_schema For this test, the body for this request must reference a schema named `File`. @@ -3803,7 +3799,7 @@ async def test_body_with_query_params_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test_body_with_query_params @@ -4077,7 +4073,7 @@ async def test_client_model_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Client]: + ) -> _ApiResponse[Client]: """To test \"client\" model To test \"client\" model @@ -4351,7 +4347,7 @@ async def test_date_time_query_parameter_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test_date_time_query_parameter @@ -4619,7 +4615,7 @@ async def test_empty_and_non_empty_responses_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test empty and non-empty responses @@ -4939,7 +4935,7 @@ async def test_endpoint_parameters_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -5342,7 +5338,7 @@ async def test_error_responses_with_model_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test error responses with model @@ -5616,7 +5612,7 @@ async def test_group_parameters_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) @@ -5926,7 +5922,7 @@ async def test_inline_additional_properties_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test inline additionalProperties @@ -6190,7 +6186,7 @@ async def test_inline_freeform_additional_properties_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test inline free-form additionalProperties @@ -6459,7 +6455,7 @@ async def test_json_form_data_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test json serialization of form data @@ -6763,7 +6759,7 @@ async def test_query_parameter_collection_format_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test_query_parameter_collection_format To test the collection format in query parameters diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_classname_tags123_api.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_classname_tags123_api.py index a7c2ebcc4023..db3ad254b24e 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_classname_tags123_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_classname_tags123_api.py @@ -16,19 +16,15 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import Field from typing_extensions import Annotated from petstore_api.models.client import Client from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse +from petstore_api.api_response import ApiResponse as _ApiResponse from petstore_api.rest import RESTResponseType @@ -128,7 +124,7 @@ async def test_classname_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Client]: + ) -> _ApiResponse[Client]: """To test class name in snake case To test class name in snake case diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/pet_api.py index d9d939b6baba..2d6288078ba1 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/pet_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/pet_api.py @@ -16,12 +16,8 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import Field from typing_extensions import Annotated @@ -33,7 +29,7 @@ from petstore_api.models.pet import Pet from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse +from petstore_api.api_response import ApiResponse as _ApiResponse from petstore_api.rest import RESTResponseType @@ -134,7 +130,7 @@ async def add_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Add a new pet to the store @@ -409,7 +405,7 @@ async def delete_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Deletes a pet @@ -674,7 +670,7 @@ async def find_pets_by_status_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[Pet]]: + ) -> _ApiResponse[List[Pet]]: """Finds Pets by status Multiple status values can be provided with comma separated strings @@ -941,7 +937,7 @@ async def find_pets_by_tags_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[Pet]]: + ) -> _ApiResponse[List[Pet]]: """(Deprecated) Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -1210,7 +1206,7 @@ async def get_pet_by_id_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Pet]: + ) -> _ApiResponse[Pet]: """Find pet by ID Returns a single pet @@ -1476,7 +1472,7 @@ async def update_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Update an existing pet @@ -1760,7 +1756,7 @@ async def update_pet_with_form_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Updates a pet in the store with form data @@ -2057,7 +2053,7 @@ async def upload_file_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ApiResponse]: + ) -> _ApiResponse[ApiResponse]: """uploads an image @@ -2358,7 +2354,7 @@ async def upload_file_with_required_file_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ApiResponse]: + ) -> _ApiResponse[ApiResponse]: """uploads an image (required) diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/store_api.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/store_api.py index 90066b44b28b..0a7a69757333 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/store_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/store_api.py @@ -16,12 +16,8 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import Field from typing_extensions import Annotated @@ -32,7 +28,7 @@ from petstore_api.models.order import Order from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse +from petstore_api.api_response import ApiResponse as _ApiResponse from petstore_api.rest import RESTResponseType @@ -133,7 +129,7 @@ async def delete_order_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -381,7 +377,7 @@ async def get_inventory_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Dict[str, int]]: + ) -> _ApiResponse[Dict[str, int]]: """Returns pet inventories by status Returns a map of status codes to quantities @@ -631,7 +627,7 @@ async def get_order_by_id_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Order]: + ) -> _ApiResponse[Order]: """Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -894,7 +890,7 @@ async def place_order_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Order]: + ) -> _ApiResponse[Order]: """Place an order for a pet diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/user_api.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/user_api.py index beaf3bbaca47..c11bf6503887 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/user_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/user_api.py @@ -16,12 +16,8 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import Field from typing_extensions import Annotated @@ -32,7 +28,7 @@ from petstore_api.models.user import User from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse +from petstore_api.api_response import ApiResponse as _ApiResponse from petstore_api.rest import RESTResponseType @@ -131,7 +127,7 @@ async def create_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=3)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Create user This can only be done by the logged in user. @@ -397,7 +393,7 @@ async def create_users_with_array_input_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Creates list of users with given input array @@ -659,7 +655,7 @@ async def create_users_with_list_input_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Creates list of users with given input array @@ -923,7 +919,7 @@ async def delete_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Delete user This can only be done by the logged in user. @@ -1178,7 +1174,7 @@ async def get_user_by_name_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[User]: + ) -> _ApiResponse[User]: """Get user by user name @@ -1446,7 +1442,7 @@ async def login_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Logs user into the system @@ -1714,7 +1710,7 @@ async def logout_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Logs out current logged in user session @@ -1959,7 +1955,7 @@ async def update_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Updated user This can only be done by the logged in user. diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py index fe0b6e141bfb..10307e7732d0 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py @@ -276,15 +276,13 @@ async def call_api( ) except ApiException as e: - if e.body: - e.body = e.body.decode('utf-8') raise e return response_data def response_deserialize( self, - response_data: rest.RESTResponse = None, + response_data: rest.RESTResponse, response_types_map=None ) -> ApiResponse: """Deserializes response into an object. @@ -313,7 +311,10 @@ def response_deserialize( 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_text = response_data.data.decode(encoding) + if response_data.data is None: # should not happen + response_text = "" + else: + response_text = response_data.data.decode(encoding) return_data = self.deserialize(response_text, response_type) finally: if not 200 <= response_data.status <= 299: @@ -326,7 +327,7 @@ def response_deserialize( return ApiResponse( status_code = response_data.status, data = return_data, - headers = response_data.getheaders(), + headers = dict(response_data.getheaders()), raw_data = response_data.data ) diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_response.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_response.py index 2ac1ada6e9b3..393bb5a42425 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_response.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_response.py @@ -14,7 +14,7 @@ class ApiResponse(BaseModel, Generic[T]): status_code: StrictInt = Field(description="HTTP status code") headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") data: T = Field(description="Deserialized data given the data type") - raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + raw_data: Optional[StrictBytes] = Field(description="Raw data (HTTP response body)") model_config = { "arbitrary_types_allowed": True diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/exceptions.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/exceptions.py index 363d0d9f8744..0cb484becbdb 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/exceptions.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/exceptions.py @@ -12,7 +12,6 @@ """ # noqa: E501 from typing import Any, Optional - from typing_extensions import Self class OpenApiException(Exception): diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_any_type.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_any_type.py index 2ce4d17e9577..22a5e075260c 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_any_type.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_any_type.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class AdditionalPropertiesAnyType(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AdditionalPropertiesAnyType from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,11 +63,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of AdditionalPropertiesAnyType from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_class.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_class.py index 89990769e8bb..3c80b1b05277 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_class.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class AdditionalPropertiesClass(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AdditionalPropertiesClass from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,16 +62,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of AdditionalPropertiesClass from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_object.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_object.py index 6d6fd8daf5f1..6d718e075b65 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_object.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_object.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class AdditionalPropertiesObject(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AdditionalPropertiesObject from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,11 +63,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of AdditionalPropertiesObject from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_with_description_only.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_with_description_only.py index 9a41a8257f1b..6fb089f7329c 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_with_description_only.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_with_description_only.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class AdditionalPropertiesWithDescriptionOnly(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AdditionalPropertiesWithDescriptionOnly from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,11 +63,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of AdditionalPropertiesWithDescriptionOnly from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/all_of_with_single_ref.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/all_of_with_single_ref.py index 5113e44ff6b6..5c676cd38a87 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/all_of_with_single_ref.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/all_of_with_single_ref.py @@ -22,10 +22,8 @@ from pydantic import BaseModel, StrictStr from pydantic import Field from petstore_api.models.single_ref_type import SingleRefType -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class AllOfWithSingleRef(BaseModel): """ @@ -52,7 +50,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AllOfWithSingleRef from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,16 +64,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of AllOfWithSingleRef from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/animal.py index 7fbe4d9e3784..dc64c3b7fb67 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/animal.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/animal.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional, Union from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Animal(BaseModel): """ @@ -42,7 +40,7 @@ class Animal(BaseModel): # JSON field name that stores the object type - __discriminator_property_name: ClassVar[List[str]] = 'className' + __discriminator_property_name: ClassVar[str] = 'className' # discriminator mappings __discriminator_value_class_map: ClassVar[Dict[str, str]] = { @@ -50,7 +48,7 @@ class Animal(BaseModel): } @classmethod - def get_discriminator_value(cls, obj: Dict) -> str: + def get_discriminator_value(cls, obj: Dict) -> Optional[str]: """Returns the discriminator value (object type) of the data""" discriminator_value = obj[cls.__discriminator_property_name] if discriminator_value: @@ -68,7 +66,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Union[Self, Self]: + def from_json(cls, json_str: str) -> Optional[Union[Self, Self]]: """Create an instance of Animal from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -82,16 +80,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Union[Self, Self]: + def from_dict(cls, obj: Dict) -> Optional[Union[Self, Self]]: """Create an instance of Animal from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/any_of_color.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/any_of_color.py index 7e8e6976ebc8..e47be4dc9539 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/any_of_color.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/any_of_color.py @@ -23,12 +23,8 @@ from pydantic import Field from typing_extensions import Annotated from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict -from typing_extensions import Literal +from typing_extensions import Literal, Self from pydantic import StrictStr, Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self ANYOFCOLOR_ANY_OF_SCHEMAS = ["List[int]", "str"] @@ -47,7 +43,7 @@ class AnyOfColor(BaseModel): actual_instance: Optional[Union[List[int], str]] = None else: actual_instance: Any = None - any_of_schemas: List[str] = Literal[ANYOFCOLOR_ANY_OF_SCHEMAS] + #any_of_schemas: List[str] = Literal[ANYOFCOLOR_ANY_OF_SCHEMAS] model_config = { "validate_assignment": True, @@ -140,22 +136,20 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> Dict: + def to_dict(self) -> Optional[Union[Dict, List[int], str]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: - return "null" + return None - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: - return json.dumps(self.actual_instance) + return self.actual_instance def to_str(self) -> str: """Returns the string representation of the actual instance""" diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/any_of_pig.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/any_of_pig.py index 4abe31fc06fc..917567c88d39 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/any_of_pig.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/any_of_pig.py @@ -23,12 +23,8 @@ from petstore_api.models.basque_pig import BasquePig from petstore_api.models.danish_pig import DanishPig from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict -from typing_extensions import Literal +from typing_extensions import Literal, Self from pydantic import StrictStr, Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self ANYOFPIG_ANY_OF_SCHEMAS = ["BasquePig", "DanishPig"] @@ -45,7 +41,7 @@ class AnyOfPig(BaseModel): actual_instance: Optional[Union[BasquePig, DanishPig]] = None else: actual_instance: Any = None - any_of_schemas: List[str] = Literal[ANYOFPIG_ANY_OF_SCHEMAS] + #any_of_schemas: List[str] = Literal[ANYOFPIG_ANY_OF_SCHEMAS] model_config = { "validate_assignment": True, @@ -117,22 +113,20 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> Dict: + def to_dict(self) -> Optional[Union[Dict, BasquePig, DanishPig]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: - return "null" + return None - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: - return json.dumps(self.actual_instance) + return self.actual_instance def to_str(self) -> str: """Returns the string representation of the actual instance""" diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/api_response.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/api_response.py index e358f2a5fdb2..90e05a8d1b0a 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/api_response.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/api_response.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ApiResponse(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ApiResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,16 +63,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ApiResponse from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_array_of_model.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_array_of_model.py index de1c55eb1ac5..53ce2b5403af 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_array_of_model.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_array_of_model.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from petstore_api.models.tag import Tag -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ArrayOfArrayOfModel(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ArrayOfArrayOfModel from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,10 +62,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of each item in another_property (list of list) @@ -82,7 +82,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ArrayOfArrayOfModel from a dict""" if obj is None: return None @@ -93,7 +93,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "another_property": [ [Tag.from_dict(_inner_item) for _inner_item in _item] - for _item in obj.get("another_property") + for _item in obj["another_property"] ] if obj.get("another_property") is not None else None }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_array_of_number_only.py index c1817cdf4f16..a382e2ced704 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_array_of_number_only.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ArrayOfArrayOfNumberOnly(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ArrayOfArrayOfNumberOnly from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,16 +62,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ArrayOfArrayOfNumberOnly from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_number_only.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_number_only.py index 653279be0ad3..e78f63d1c9b5 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_number_only.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ArrayOfNumberOnly(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ArrayOfNumberOnly from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,16 +62,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ArrayOfNumberOnly from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_test.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_test.py index 51ea20fca905..99120096c8ae 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_test.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_test.py @@ -23,10 +23,8 @@ from pydantic import Field from typing_extensions import Annotated from petstore_api.models.read_only_first import ReadOnlyFirst -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ArrayTest(BaseModel): """ @@ -54,7 +52,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ArrayTest from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -68,10 +66,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of each item in array_array_of_model (list of list) @@ -86,7 +86,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ArrayTest from a dict""" if obj is None: return None @@ -99,7 +99,7 @@ def from_dict(cls, obj: Dict) -> Self: "array_array_of_integer": obj.get("array_array_of_integer"), "array_array_of_model": [ [ReadOnlyFirst.from_dict(_inner_item) for _inner_item in _item] - for _item in obj.get("array_array_of_model") + for _item in obj["array_array_of_model"] ] if obj.get("array_array_of_model") is not None else None }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/basque_pig.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/basque_pig.py index 9f53a04d9f15..f5b2fe415977 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/basque_pig.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/basque_pig.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class BasquePig(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BasquePig from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,16 +63,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of BasquePig from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/capitalization.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/capitalization.py index d5499384d475..0657b73b5ab3 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/capitalization.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/capitalization.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Capitalization(BaseModel): """ @@ -55,7 +53,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Capitalization from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -69,16 +67,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Capitalization from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/cat.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/cat.py index 01dcacf9ca4e..f34d1c7cfa63 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/cat.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/cat.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import StrictBool from petstore_api.models.animal import Animal -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Cat(Animal): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Cat from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,16 +62,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Cat from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/category.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/category.py index 5d7c648d5fb1..e2e269c2ce4d 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/category.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/category.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Category(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Category from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,16 +62,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Category from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/circular_reference_model.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/circular_reference_model.py index 6ce8fec888c6..19a3ce031515 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/circular_reference_model.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/circular_reference_model.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class CircularReferenceModel(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CircularReferenceModel from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,10 +62,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of nested @@ -76,7 +76,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of CircularReferenceModel from a dict""" if obj is None: return None @@ -86,7 +86,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "size": obj.get("size"), - "nested": FirstRef.from_dict(obj.get("nested")) if obj.get("nested") is not None else None + "nested": FirstRef.from_dict(obj["nested"]) if obj.get("nested") is not None else None }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/class_model.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/class_model.py index 633147cd5bdb..7dbbe5ed5248 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/class_model.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/class_model.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ClassModel(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ClassModel from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,16 +62,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ClassModel from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/client.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/client.py index 5f516b120ec4..5ad1430ef647 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/client.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/client.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Client(BaseModel): """ @@ -49,7 +47,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Client from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -63,16 +61,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Client from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/color.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/color.py index 638d942a34e7..f71a5cb4e333 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/color.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/color.py @@ -23,12 +23,8 @@ from pydantic import Field from typing_extensions import Annotated from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict -from typing_extensions import Literal +from typing_extensions import Literal, Self from pydantic import StrictStr, Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self COLOR_ONE_OF_SCHEMAS = ["List[int]", "str"] @@ -43,7 +39,7 @@ class Color(BaseModel): # data type: str oneof_schema_3_validator: Optional[Annotated[str, Field(min_length=7, strict=True, max_length=7)]] = Field(default=None, description="Hex color string, such as #00FF00.") actual_instance: Optional[Union[List[int], str]] = None - one_of_schemas: List[str] = Literal["List[int]", "str"] + #one_of_schemas = Literal["List[int]", "str"] model_config = { "validate_assignment": True, @@ -152,19 +148,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> Dict: + def to_dict(self) -> Optional[Union[Dict, List[int], str]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/creature.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/creature.py index 4c868095a25b..8c94e08b5666 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/creature.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/creature.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List from pydantic import BaseModel, StrictStr from petstore_api.models.creature_info import CreatureInfo -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Creature(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Creature from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,10 +63,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of info @@ -77,7 +77,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Creature from a dict""" if obj is None: return None @@ -86,7 +86,7 @@ def from_dict(cls, obj: Dict) -> Self: return cls.model_validate(obj) _obj = cls.model_validate({ - "info": CreatureInfo.from_dict(obj.get("info")) if obj.get("info") is not None else None, + "info": CreatureInfo.from_dict(obj["info"]) if obj.get("info") is not None else None, "type": obj.get("type") }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/creature_info.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/creature_info.py index 3b80ab51ae8b..7b9c2e0913d0 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/creature_info.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/creature_info.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class CreatureInfo(BaseModel): """ @@ -49,7 +47,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CreatureInfo from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -63,16 +61,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of CreatureInfo from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/danish_pig.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/danish_pig.py index 0dd8bfb9b0a6..8736aa63dcf4 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/danish_pig.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/danish_pig.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List from pydantic import BaseModel, StrictInt, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class DanishPig(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DanishPig from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,16 +63,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of DanishPig from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/deprecated_object.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/deprecated_object.py index 6d0e0f1a892d..fa4a13ea1301 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/deprecated_object.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/deprecated_object.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class DeprecatedObject(BaseModel): """ @@ -49,7 +47,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DeprecatedObject from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -63,16 +61,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of DeprecatedObject from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dog.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dog.py index 9c491abfe3c2..d8964c5efcc5 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dog.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dog.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import StrictStr from petstore_api.models.animal import Animal -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Dog(Animal): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Dog from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,16 +62,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Dog from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dummy_model.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dummy_model.py index ed7b3c13f9d9..5ae306b8a986 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dummy_model.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dummy_model.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class DummyModel(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DummyModel from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,10 +62,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of self_ref @@ -76,7 +76,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of DummyModel from a dict""" if obj is None: return None @@ -86,7 +86,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "category": obj.get("category"), - "self_ref": SelfReferenceModel.from_dict(obj.get("self_ref")) if obj.get("self_ref") is not None else None + "self_ref": SelfReferenceModel.from_dict(obj["self_ref"]) if obj.get("self_ref") is not None else None }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_arrays.py index b6e22b939326..0544c222e5a4 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_arrays.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_arrays.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr, field_validator -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class EnumArrays(BaseModel): """ @@ -71,7 +69,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of EnumArrays from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -85,16 +83,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of EnumArrays from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_class.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_class.py index 11255f418979..2da054deef79 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_class.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_class.py @@ -20,10 +20,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class EnumClass(str, Enum): diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string1.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string1.py index efe9a6056218..c0cbc113487a 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string1.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string1.py @@ -20,10 +20,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class EnumString1(str, Enum): diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string2.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string2.py index 222c5dc6b824..8fb75eb65a63 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string2.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string2.py @@ -20,10 +20,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class EnumString2(str, Enum): diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_test.py index d60899377444..84664d5cf909 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_test.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_test.py @@ -25,10 +25,8 @@ from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue from petstore_api.models.outer_enum_integer import OuterEnumInteger from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class EnumTest(BaseModel): """ @@ -109,7 +107,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of EnumTest from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -123,10 +121,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # set to None if outer_enum (nullable) is None @@ -137,7 +137,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of EnumTest from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file.py index 418a72f7cb3e..eaf0e814600d 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class File(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of File from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,16 +62,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of File from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file_schema_test_class.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file_schema_test_class.py index 63ff3bcd8c8b..66000227a609 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file_schema_test_class.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from petstore_api.models.file import File -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class FileSchemaTestClass(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FileSchemaTestClass from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,10 +63,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of file @@ -84,7 +84,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of FileSchemaTestClass from a dict""" if obj is None: return None @@ -93,8 +93,8 @@ def from_dict(cls, obj: Dict) -> Self: return cls.model_validate(obj) _obj = cls.model_validate({ - "file": File.from_dict(obj.get("file")) if obj.get("file") is not None else None, - "files": [File.from_dict(_item) for _item in obj.get("files")] if obj.get("files") is not None else None + "file": File.from_dict(obj["file"]) if obj.get("file") is not None else None, + "files": [File.from_dict(_item) for _item in obj["files"]] if obj.get("files") is not None else None }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/first_ref.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/first_ref.py index ca94567dafc0..380ee83df6c3 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/first_ref.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/first_ref.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class FirstRef(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FirstRef from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,10 +62,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of self_ref @@ -76,7 +76,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of FirstRef from a dict""" if obj is None: return None @@ -86,7 +86,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "category": obj.get("category"), - "self_ref": SecondRef.from_dict(obj.get("self_ref")) if obj.get("self_ref") is not None else None + "self_ref": SecondRef.from_dict(obj["self_ref"]) if obj.get("self_ref") is not None else None }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/foo.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/foo.py index 134af2ba41b0..0b070de35234 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/foo.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/foo.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Foo(BaseModel): """ @@ -49,7 +47,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Foo from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -63,16 +61,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Foo from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/foo_get_default_response.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/foo_get_default_response.py index caa929d4ea81..db3dbf2ce177 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/foo_get_default_response.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/foo_get_default_response.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from petstore_api.models.foo import Foo -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class FooGetDefaultResponse(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FooGetDefaultResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,10 +62,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of string @@ -76,7 +76,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of FooGetDefaultResponse from a dict""" if obj is None: return None @@ -85,7 +85,7 @@ def from_dict(cls, obj: Dict) -> Self: return cls.model_validate(obj) _obj = cls.model_validate({ - "string": Foo.from_dict(obj.get("string")) if obj.get("string") is not None else None + "string": Foo.from_dict(obj["string"]) if obj.get("string") is not None else None }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/format_test.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/format_test.py index cf0d05f9e618..7f4ab3dd971a 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/format_test.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/format_test.py @@ -23,10 +23,8 @@ from decimal import Decimal from pydantic import Field from typing_extensions import Annotated -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class FormatTest(BaseModel): """ @@ -108,7 +106,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FormatTest from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -122,16 +120,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of FormatTest from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/has_only_read_only.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/has_only_read_only.py index 567237d61a81..175eb5b1f927 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/has_only_read_only.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/has_only_read_only.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class HasOnlyReadOnly(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of HasOnlyReadOnly from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,18 +64,20 @@ def to_dict(self) -> Dict[str, Any]: * OpenAPI `readOnly` fields are excluded. * OpenAPI `readOnly` fields are excluded. """ + excluded_fields: Set[str] = set([ + "bar", + "foo", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "bar", - "foo", - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of HasOnlyReadOnly from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/health_check_result.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/health_check_result.py index 9b9ccf00c936..9e603d3d4f77 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/health_check_result.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/health_check_result.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class HealthCheckResult(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of HealthCheckResult from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,10 +62,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # set to None if nullable_message (nullable) is None @@ -78,7 +78,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of HealthCheckResult from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/inner_dict_with_property.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/inner_dict_with_property.py index f93d19de93c2..e117a979f259 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/inner_dict_with_property.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/inner_dict_with_property.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class InnerDictWithProperty(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of InnerDictWithProperty from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,16 +62,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of InnerDictWithProperty from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/int_or_string.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/int_or_string.py index a7203af4ac52..489820634d84 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/int_or_string.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/int_or_string.py @@ -23,12 +23,8 @@ from pydantic import Field from typing_extensions import Annotated from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict -from typing_extensions import Literal +from typing_extensions import Literal, Self from pydantic import StrictStr, Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self INTORSTRING_ONE_OF_SCHEMAS = ["int", "str"] @@ -41,7 +37,7 @@ class IntOrString(BaseModel): # data type: str oneof_schema_2_validator: Optional[StrictStr] = None actual_instance: Optional[Union[int, str]] = None - one_of_schemas: List[str] = Literal["int", "str"] + #one_of_schemas = Literal["int", "str"] model_config = { "validate_assignment": True, @@ -129,19 +125,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> Dict: + def to_dict(self) -> Optional[Union[Dict, int, str]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/list_class.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/list_class.py index bc8c47906e57..c193cbb0efb8 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/list_class.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/list_class.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ListClass(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ListClass from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,16 +62,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ListClass from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_of_array_of_model.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_of_array_of_model.py index 627602599750..0e7ea017e6d3 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_of_array_of_model.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_of_array_of_model.py @@ -22,10 +22,8 @@ from pydantic import BaseModel from pydantic import Field from petstore_api.models.tag import Tag -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class MapOfArrayOfModel(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MapOfArrayOfModel from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,10 +63,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of each value in shop_id_to_org_online_lip_map (dict of array) @@ -83,7 +83,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of MapOfArrayOfModel from a dict""" if obj is None: return None @@ -98,7 +98,7 @@ def from_dict(cls, obj: Dict) -> Self: if _v is not None else None ) - for _k, _v in obj.get("shopIdToOrgOnlineLipMap").items() + for _k, _v in obj.get("shopIdToOrgOnlineLipMap", {}).items() ) }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_test.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_test.py index c8f5ab914683..1cceafe6d57a 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_test.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_test.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool, StrictStr, field_validator -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class MapTest(BaseModel): """ @@ -62,7 +60,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MapTest from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -76,16 +74,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of MapTest from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py index f920ef230f74..9112910c1c5b 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -22,10 +22,8 @@ from pydantic import BaseModel, StrictStr from pydantic import Field from petstore_api.models.animal import Animal -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class MixedPropertiesAndAdditionalPropertiesClass(BaseModel): """ @@ -53,7 +51,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MixedPropertiesAndAdditionalPropertiesClass from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -67,10 +65,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of each value in map (dict) @@ -83,7 +83,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of MixedPropertiesAndAdditionalPropertiesClass from a dict""" if obj is None: return None @@ -96,7 +96,7 @@ def from_dict(cls, obj: Dict) -> Self: "dateTime": obj.get("dateTime"), "map": dict( (_k, Animal.from_dict(_v)) - for _k, _v in obj.get("map").items() + for _k, _v in obj["map"].items() ) if obj.get("map") is not None else None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model200_response.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model200_response.py index 1603076483e3..063ef9394df0 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model200_response.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model200_response.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Model200Response(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Model200Response from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,16 +63,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Model200Response from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model_return.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model_return.py index 87f9968d6a12..7b6453fb3f8c 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model_return.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model_return.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ModelReturn(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ModelReturn from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,16 +62,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ModelReturn from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/name.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/name.py index 23e0d049281c..2a5d00315be2 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/name.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/name.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Name(BaseModel): """ @@ -53,7 +51,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Name from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -69,18 +67,20 @@ def to_dict(self) -> Dict[str, Any]: * OpenAPI `readOnly` fields are excluded. * OpenAPI `readOnly` fields are excluded. """ + excluded_fields: Set[str] = set([ + "snake_case", + "var_123_number", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "snake_case", - "var_123_number", - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Name from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/nullable_class.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/nullable_class.py index d30916976ba2..e7ad73efd683 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/nullable_class.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/nullable_class.py @@ -20,10 +20,8 @@ from datetime import date, datetime from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool, StrictInt, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class NullableClass(BaseModel): """ @@ -62,7 +60,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of NullableClass from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -77,11 +75,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -147,7 +147,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of NullableClass from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/nullable_property.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/nullable_property.py index 14b8d8540239..76adb27eaca1 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/nullable_property.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/nullable_property.py @@ -22,10 +22,8 @@ from pydantic import BaseModel, StrictInt, field_validator from pydantic import Field from typing_extensions import Annotated -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class NullableProperty(BaseModel): """ @@ -62,7 +60,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of NullableProperty from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -76,10 +74,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # set to None if name (nullable) is None @@ -90,7 +90,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of NullableProperty from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/number_only.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/number_only.py index cf9be7a51a6d..66f641643e10 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/number_only.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/number_only.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class NumberOnly(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of NumberOnly from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,16 +62,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of NumberOnly from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_to_test_additional_properties.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_to_test_additional_properties.py index e036dbf5a2e4..d9089bd29699 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_to_test_additional_properties.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_to_test_additional_properties.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ObjectToTestAdditionalProperties(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ObjectToTestAdditionalProperties from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,16 +62,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ObjectToTestAdditionalProperties from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_with_deprecated_fields.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_with_deprecated_fields.py index 9acbb113b6c2..238f18854176 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_with_deprecated_fields.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_with_deprecated_fields.py @@ -22,10 +22,8 @@ from pydantic import BaseModel, StrictStr from pydantic import Field from petstore_api.models.deprecated_object import DeprecatedObject -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ObjectWithDeprecatedFields(BaseModel): """ @@ -54,7 +52,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ObjectWithDeprecatedFields from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -68,10 +66,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of deprecated_ref @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ObjectWithDeprecatedFields from a dict""" if obj is None: return None @@ -91,7 +91,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "uuid": obj.get("uuid"), "id": obj.get("id"), - "deprecatedRef": DeprecatedObject.from_dict(obj.get("deprecatedRef")) if obj.get("deprecatedRef") is not None else None, + "deprecatedRef": DeprecatedObject.from_dict(obj["deprecatedRef"]) if obj.get("deprecatedRef") is not None else None, "bars": obj.get("bars") }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/one_of_enum_string.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/one_of_enum_string.py index b099c7bab578..36dc89230d95 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/one_of_enum_string.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/one_of_enum_string.py @@ -23,12 +23,8 @@ from petstore_api.models.enum_string1 import EnumString1 from petstore_api.models.enum_string2 import EnumString2 from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict -from typing_extensions import Literal +from typing_extensions import Literal, Self from pydantic import StrictStr, Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self ONEOFENUMSTRING_ONE_OF_SCHEMAS = ["EnumString1", "EnumString2"] @@ -41,7 +37,7 @@ class OneOfEnumString(BaseModel): # data type: EnumString2 oneof_schema_2_validator: Optional[EnumString2] = None actual_instance: Optional[Union[EnumString1, EnumString2]] = None - one_of_schemas: List[str] = Literal["EnumString1", "EnumString2"] + #one_of_schemas = Literal["EnumString1", "EnumString2"] model_config = { "validate_assignment": True, @@ -121,19 +117,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> Dict: + def to_dict(self) -> Optional[Union[Dict, EnumString1, EnumString2]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/order.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/order.py index a28b93ab9ae1..f571eaab7b65 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/order.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/order.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool, StrictInt, StrictStr, field_validator from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Order(BaseModel): """ @@ -65,7 +63,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Order from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -79,16 +77,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Order from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_composite.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_composite.py index 1fae7664463c..90402acfa06f 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_composite.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_composite.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class OuterComposite(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of OuterComposite from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,16 +63,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of OuterComposite from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum.py index 89b19cbcf664..9e347e5714b8 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum.py @@ -20,10 +20,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class OuterEnum(str, Enum): diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_default_value.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_default_value.py index 51ca91443e27..55ab85308117 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_default_value.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_default_value.py @@ -20,10 +20,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class OuterEnumDefaultValue(str, Enum): diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_integer.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_integer.py index 8947df650469..f16c2948f0ef 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_integer.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_integer.py @@ -20,10 +20,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class OuterEnumInteger(int, Enum): diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_integer_default_value.py index 970487bb0c4d..da4b3a1049d9 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_integer_default_value.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_integer_default_value.py @@ -20,10 +20,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class OuterEnumIntegerDefaultValue(int, Enum): diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_object_with_enum_property.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_object_with_enum_property.py index a9771c1d8a1f..66ff0007e6b2 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_object_with_enum_property.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_object_with_enum_property.py @@ -22,10 +22,8 @@ from pydantic import BaseModel from petstore_api.models.outer_enum import OuterEnum from petstore_api.models.outer_enum_integer import OuterEnumInteger -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class OuterObjectWithEnumProperty(BaseModel): """ @@ -52,7 +50,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of OuterObjectWithEnumProperty from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,10 +64,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # set to None if str_value (nullable) is None @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of OuterObjectWithEnumProperty from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/parent.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/parent.py index a7ea11a992b5..383aced59678 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/parent.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/parent.py @@ -22,10 +22,8 @@ from pydantic import BaseModel from pydantic import Field from petstore_api.models.inner_dict_with_property import InnerDictWithProperty -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Parent(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Parent from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,10 +63,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of each value in optional_dict (dict) @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Parent from a dict""" if obj is None: return None @@ -92,7 +92,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "optionalDict": dict( (_k, InnerDictWithProperty.from_dict(_v)) - for _k, _v in obj.get("optionalDict").items() + for _k, _v in obj["optionalDict"].items() ) if obj.get("optionalDict") is not None else None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/parent_with_optional_dict.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/parent_with_optional_dict.py index a8753b9dc07c..fc1c65a40a53 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/parent_with_optional_dict.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/parent_with_optional_dict.py @@ -22,10 +22,8 @@ from pydantic import BaseModel from pydantic import Field from petstore_api.models.inner_dict_with_property import InnerDictWithProperty -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ParentWithOptionalDict(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ParentWithOptionalDict from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,10 +63,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of each value in optional_dict (dict) @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ParentWithOptionalDict from a dict""" if obj is None: return None @@ -92,7 +92,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "optionalDict": dict( (_k, InnerDictWithProperty.from_dict(_v)) - for _k, _v in obj.get("optionalDict").items() + for _k, _v in obj["optionalDict"].items() ) if obj.get("optionalDict") is not None else None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pet.py index 92b9f77bc620..2ba940dbe727 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pet.py @@ -24,10 +24,8 @@ from typing_extensions import Annotated from petstore_api.models.category import Category from petstore_api.models.tag import Tag -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Pet(BaseModel): """ @@ -68,7 +66,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Pet from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -82,10 +80,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of category @@ -101,7 +101,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Pet from a dict""" if obj is None: return None @@ -111,10 +111,10 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "id": obj.get("id"), - "category": Category.from_dict(obj.get("category")) if obj.get("category") is not None else None, + "category": Category.from_dict(obj["category"]) if obj.get("category") is not None else None, "name": obj.get("name"), "photoUrls": obj.get("photoUrls"), - "tags": [Tag.from_dict(_item) for _item in obj.get("tags")] if obj.get("tags") is not None else None, + "tags": [Tag.from_dict(_item) for _item in obj["tags"]] if obj.get("tags") is not None else None, "status": obj.get("status") }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pig.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pig.py index f63458cd46e5..af0a3faf5f80 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pig.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pig.py @@ -23,12 +23,8 @@ from petstore_api.models.basque_pig import BasquePig from petstore_api.models.danish_pig import DanishPig from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict -from typing_extensions import Literal +from typing_extensions import Literal, Self from pydantic import StrictStr, Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self PIG_ONE_OF_SCHEMAS = ["BasquePig", "DanishPig"] @@ -41,7 +37,7 @@ class Pig(BaseModel): # data type: DanishPig oneof_schema_2_validator: Optional[DanishPig] = None actual_instance: Optional[Union[BasquePig, DanishPig]] = None - one_of_schemas: List[str] = Literal["BasquePig", "DanishPig"] + #one_of_schemas = Literal["BasquePig", "DanishPig"] model_config = { "validate_assignment": True, @@ -124,19 +120,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> Dict: + def to_dict(self) -> Optional[Union[Dict, BasquePig, DanishPig]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/property_name_collision.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/property_name_collision.py index 0db7bfbc3105..7b078bfccbf8 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/property_name_collision.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/property_name_collision.py @@ -21,18 +21,16 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class PropertyNameCollision(BaseModel): """ PropertyNameCollision """ # noqa: E501 - type: Optional[StrictStr] = Field(default=None, alias="_type") + underscore_type: Optional[StrictStr] = Field(default=None, alias="_type") type: Optional[StrictStr] = None - type_: Optional[StrictStr] = None + type_with_underscore: Optional[StrictStr] = Field(default=None, alias="type_") __properties: ClassVar[List[str]] = ["_type", "type", "type_"] model_config = { @@ -52,7 +50,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PropertyNameCollision from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,16 +64,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of PropertyNameCollision from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/read_only_first.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/read_only_first.py index 3e19a45c3d27..c9a7750fd2c3 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/read_only_first.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/read_only_first.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ReadOnlyFirst(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ReadOnlyFirst from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,17 +63,19 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * OpenAPI `readOnly` fields are excluded. """ + excluded_fields: Set[str] = set([ + "bar", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "bar", - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ReadOnlyFirst from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/second_ref.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/second_ref.py index b62a2b70f8a7..4419c5cfc5dd 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/second_ref.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/second_ref.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class SecondRef(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SecondRef from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,10 +62,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of circular_ref @@ -76,7 +76,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of SecondRef from a dict""" if obj is None: return None @@ -86,7 +86,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "category": obj.get("category"), - "circular_ref": CircularReferenceModel.from_dict(obj.get("circular_ref")) if obj.get("circular_ref") is not None else None + "circular_ref": CircularReferenceModel.from_dict(obj["circular_ref"]) if obj.get("circular_ref") is not None else None }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/self_reference_model.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/self_reference_model.py index eb6f112f5725..8828311819f7 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/self_reference_model.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/self_reference_model.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class SelfReferenceModel(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SelfReferenceModel from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,10 +62,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of nested @@ -76,7 +76,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of SelfReferenceModel from a dict""" if obj is None: return None @@ -86,7 +86,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "size": obj.get("size"), - "nested": DummyModel.from_dict(obj.get("nested")) if obj.get("nested") is not None else None + "nested": DummyModel.from_dict(obj["nested"]) if obj.get("nested") is not None else None }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/single_ref_type.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/single_ref_type.py index 3c41c4118654..1144dbc90755 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/single_ref_type.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/single_ref_type.py @@ -20,10 +20,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class SingleRefType(str, Enum): diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_character_enum.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_character_enum.py index 77ed288a94b4..35086cfe923c 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_character_enum.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_character_enum.py @@ -20,10 +20,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class SpecialCharacterEnum(str, Enum): diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_model_name.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_model_name.py index 582effc78e16..53b1cf6a74b8 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_model_name.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_model_name.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class SpecialModelName(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpecialModelName from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,16 +62,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of SpecialModelName from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_name.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_name.py index ac035dded90a..0458b5c93266 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_name.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_name.py @@ -22,10 +22,8 @@ from pydantic import BaseModel, StrictInt, StrictStr, field_validator from pydantic import Field from petstore_api.models.category import Category -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class SpecialName(BaseModel): """ @@ -63,7 +61,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpecialName from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -77,10 +75,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of var_async @@ -89,7 +89,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of SpecialName from a dict""" if obj is None: return None @@ -99,7 +99,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "property": obj.get("property"), - "async": Category.from_dict(obj.get("async")) if obj.get("async") is not None else None, + "async": Category.from_dict(obj["async"]) if obj.get("async") is not None else None, "schema": obj.get("schema") }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/tag.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/tag.py index cbbc6c635d50..f474d6f89539 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/tag.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/tag.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Tag(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Tag from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,16 +62,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Tag from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_error_responses_with_model400_response.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_error_responses_with_model400_response.py index bc6b9ea992fd..57a54b024da3 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_error_responses_with_model400_response.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_error_responses_with_model400_response.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class TestErrorResponsesWithModel400Response(BaseModel): """ @@ -49,7 +47,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TestErrorResponsesWithModel400Response from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -63,16 +61,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of TestErrorResponsesWithModel400Response from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_error_responses_with_model404_response.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_error_responses_with_model404_response.py index 14afd3b169ff..f0c5c2e5c2dd 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_error_responses_with_model404_response.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_error_responses_with_model404_response.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class TestErrorResponsesWithModel404Response(BaseModel): """ @@ -49,7 +47,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TestErrorResponsesWithModel404Response from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -63,16 +61,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of TestErrorResponsesWithModel404Response from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_inline_freeform_additional_properties_request.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_inline_freeform_additional_properties_request.py index c8d66e9d6389..1f42eec81b5b 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_inline_freeform_additional_properties_request.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_inline_freeform_additional_properties_request.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class TestInlineFreeformAdditionalPropertiesRequest(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TestInlineFreeformAdditionalPropertiesRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of TestInlineFreeformAdditionalPropertiesRequest from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/tiger.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/tiger.py index a84c01011291..09e65d5a037a 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/tiger.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/tiger.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Tiger(BaseModel): """ @@ -49,7 +47,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Tiger from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -63,16 +61,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Tiger from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/unnamed_dict_with_additional_model_list_properties.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/unnamed_dict_with_additional_model_list_properties.py index af26ad30973d..7d2c6c058742 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/unnamed_dict_with_additional_model_list_properties.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/unnamed_dict_with_additional_model_list_properties.py @@ -22,10 +22,8 @@ from pydantic import BaseModel from pydantic import Field from petstore_api.models.creature_info import CreatureInfo -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class UnnamedDictWithAdditionalModelListProperties(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of UnnamedDictWithAdditionalModelListProperties from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,10 +63,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of each value in dict_property (dict of array) @@ -83,7 +83,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of UnnamedDictWithAdditionalModelListProperties from a dict""" if obj is None: return None @@ -98,7 +98,7 @@ def from_dict(cls, obj: Dict) -> Self: if _v is not None else None ) - for _k, _v in obj.get("dictProperty").items() + for _k, _v in obj.get("dictProperty", {}).items() ) }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/unnamed_dict_with_additional_string_list_properties.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/unnamed_dict_with_additional_string_list_properties.py index aee8e999daf2..c2017b57b844 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/unnamed_dict_with_additional_string_list_properties.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/unnamed_dict_with_additional_string_list_properties.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class UnnamedDictWithAdditionalStringListProperties(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of UnnamedDictWithAdditionalStringListProperties from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -64,16 +62,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of UnnamedDictWithAdditionalStringListProperties from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/user.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/user.py index e2f5bb9c4893..8b99fab0cad0 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/user.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/user.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class User(BaseModel): """ @@ -57,7 +55,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of User from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -71,16 +69,18 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of User from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/with_nested_one_of.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/with_nested_one_of.py index ccafcd94afaa..ca4726454e5e 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/with_nested_one_of.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/with_nested_one_of.py @@ -22,10 +22,8 @@ from pydantic import BaseModel, StrictInt from petstore_api.models.one_of_enum_string import OneOfEnumString from petstore_api.models.pig import Pig -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class WithNestedOneOf(BaseModel): """ @@ -53,7 +51,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WithNestedOneOf from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -67,10 +65,12 @@ def to_dict(self) -> Dict[str, Any]: were set at model initialization. Other fields with value `None` are ignored. """ + excluded_fields: Set[str] = set([ + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of nested_pig @@ -82,7 +82,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of WithNestedOneOf from a dict""" if obj is None: return None @@ -92,8 +92,8 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "size": obj.get("size"), - "nested_pig": Pig.from_dict(obj.get("nested_pig")) if obj.get("nested_pig") is not None else None, - "nested_oneof_enum_string": OneOfEnumString.from_dict(obj.get("nested_oneof_enum_string")) if obj.get("nested_oneof_enum_string") is not None else None + "nested_pig": Pig.from_dict(obj["nested_pig"]) if obj.get("nested_pig") is not None else None, + "nested_oneof_enum_string": OneOfEnumString.from_dict(obj["nested_oneof_enum_string"]) if obj.get("nested_oneof_enum_string") is not None else None }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/rest.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/rest.py index 0d4d999ee59d..0f09db5bcb99 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/rest.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/rest.py @@ -16,6 +16,7 @@ import json import re import ssl +from typing import Optional import aiohttp import aiohttp_retry @@ -82,6 +83,7 @@ def __init__(self, configuration) -> None: ) retries = configuration.retries + self.retry_client: Optional[aiohttp_retry.RetryClient] if retries is not None: self.retry_client = aiohttp_retry.RetryClient( client_session=self.pool_manager, diff --git a/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml b/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml index 807b7380d910..01bb26be430c 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml +++ b/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml @@ -25,6 +25,9 @@ typing-extensions = ">=4.7.1" pytest = ">=7.2.1" tox = ">=3.9.0" flake8 = ">=4.0.0" +types-python-dateutil = ">=2.8.19.14" +mypy = "1.4.1" + [build-system] requires = ["setuptools"] @@ -32,3 +35,6 @@ build-backend = "setuptools.build_meta" [tool.pylint.'MESSAGES CONTROL'] extension-pkg-whitelist = "pydantic" + +[tool.mypy] +files = ["petstore_api"] diff --git a/samples/openapi3/client/petstore/python-aiohttp/test-requirements.txt b/samples/openapi3/client/petstore/python-aiohttp/test-requirements.txt index 3a0d0b939a1e..8e6d8cb13749 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/test-requirements.txt +++ b/samples/openapi3/client/petstore/python-aiohttp/test-requirements.txt @@ -1,3 +1,5 @@ pytest~=7.1.3 pytest-cov>=2.8.1 pytest-randomly>=3.12.0 +mypy>=1.4.1 +types-python-dateutil>=2.8.19 diff --git a/samples/openapi3/client/petstore/python/petstore_api/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/__init__.py index 72d39b9c55e6..112f8a4abdaa 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python/petstore_api/__init__.py @@ -26,7 +26,7 @@ from petstore_api.api.user_api import UserApi # import ApiClient -from petstore_api.api_response import ApiResponse +#from petstore_api.api_response import ApiResponse from petstore_api.api_client import ApiClient from petstore_api.configuration import Configuration from petstore_api.exceptions import OpenApiException diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py index 6e02e2089ebf..91b14d67fed4 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py @@ -16,19 +16,15 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import Field from typing_extensions import Annotated from petstore_api.models.client import Client from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse +from petstore_api.api_response import ApiResponse as _ApiResponse from petstore_api.rest import RESTResponseType @@ -128,7 +124,7 @@ def call_123_test_special_tags_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Client]: + ) -> _ApiResponse[Client]: """To test special tags To test special tags and operation ID starting with number diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py index 3f662edd5c8c..892981cfd240 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py @@ -16,17 +16,13 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from petstore_api.models.foo_get_default_response import FooGetDefaultResponse from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse +from petstore_api.api_response import ApiResponse as _ApiResponse from petstore_api.rest import RESTResponseType @@ -119,7 +115,7 @@ def foo_get_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[FooGetDefaultResponse]: + ) -> _ApiResponse[FooGetDefaultResponse]: """foo_get diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py index 20e85ac2ac9a..4868dc660f64 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py @@ -16,12 +16,8 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import Field from typing_extensions import Annotated @@ -43,7 +39,7 @@ from petstore_api.models.user import User from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse +from petstore_api.api_response import ApiResponse as _ApiResponse from petstore_api.rest import RESTResponseType @@ -142,7 +138,7 @@ def fake_any_type_request_body_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test any type request body @@ -403,7 +399,7 @@ def fake_enum_ref_query_parameter_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test enum reference query parameter @@ -648,7 +644,7 @@ def fake_health_get_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[HealthCheckResult]: + ) -> _ApiResponse[HealthCheckResult]: """Health check endpoint @@ -902,7 +898,7 @@ def fake_http_signature_test_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test http signature authentication @@ -1188,7 +1184,7 @@ def fake_outer_boolean_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[bool]: + ) -> _ApiResponse[bool]: """fake_outer_boolean_serialize Test serialization of outer boolean types @@ -1458,7 +1454,7 @@ def fake_outer_composite_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[OuterComposite]: + ) -> _ApiResponse[OuterComposite]: """fake_outer_composite_serialize Test serialization of object with outer number type @@ -1728,7 +1724,7 @@ def fake_outer_number_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[float]: + ) -> _ApiResponse[float]: """fake_outer_number_serialize Test serialization of outer number types @@ -1998,7 +1994,7 @@ def fake_outer_string_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """fake_outer_string_serialize Test serialization of outer string types @@ -2268,7 +2264,7 @@ def fake_property_enum_integer_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[OuterObjectWithEnumProperty]: + ) -> _ApiResponse[OuterObjectWithEnumProperty]: """fake_property_enum_integer_serialize Test serialization of enum (int) properties with examples @@ -2532,7 +2528,7 @@ def fake_ref_enum_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[EnumClass]: + ) -> _ApiResponse[EnumClass]: """test ref to enum string @@ -2771,7 +2767,7 @@ def fake_return_list_of_objects_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[List[Tag]]]: + ) -> _ApiResponse[List[List[Tag]]]: """test returning list of objects @@ -3015,7 +3011,7 @@ def fake_uuid_example_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test uuid example @@ -3266,7 +3262,7 @@ def test_body_with_binary_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test_body_with_binary For this test, the body has to be a binary file. @@ -3535,7 +3531,7 @@ def test_body_with_file_schema_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test_body_with_file_schema For this test, the body for this request must reference a schema named `File`. @@ -3803,7 +3799,7 @@ def test_body_with_query_params_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test_body_with_query_params @@ -4077,7 +4073,7 @@ def test_client_model_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Client]: + ) -> _ApiResponse[Client]: """To test \"client\" model To test \"client\" model @@ -4351,7 +4347,7 @@ def test_date_time_query_parameter_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test_date_time_query_parameter @@ -4619,7 +4615,7 @@ def test_empty_and_non_empty_responses_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test empty and non-empty responses @@ -4939,7 +4935,7 @@ def test_endpoint_parameters_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -5342,7 +5338,7 @@ def test_error_responses_with_model_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test error responses with model @@ -5616,7 +5612,7 @@ def test_group_parameters_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) @@ -5926,7 +5922,7 @@ def test_inline_additional_properties_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test inline additionalProperties @@ -6190,7 +6186,7 @@ def test_inline_freeform_additional_properties_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test inline free-form additionalProperties @@ -6459,7 +6455,7 @@ def test_json_form_data_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test json serialization of form data @@ -6763,7 +6759,7 @@ def test_query_parameter_collection_format_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """test_query_parameter_collection_format To test the collection format in query parameters diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags123_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags123_api.py index 04cc040e6fa4..ac4f851d3086 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags123_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags123_api.py @@ -16,19 +16,15 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import Field from typing_extensions import Annotated from petstore_api.models.client import Client from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse +from petstore_api.api_response import ApiResponse as _ApiResponse from petstore_api.rest import RESTResponseType @@ -128,7 +124,7 @@ def test_classname_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Client]: + ) -> _ApiResponse[Client]: """To test class name in snake case To test class name in snake case diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py index fba079f8bce9..d8a99e70527c 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py @@ -16,12 +16,8 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import Field from typing_extensions import Annotated @@ -33,7 +29,7 @@ from petstore_api.models.pet import Pet from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse +from petstore_api.api_response import ApiResponse as _ApiResponse from petstore_api.rest import RESTResponseType @@ -134,7 +130,7 @@ def add_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Add a new pet to the store @@ -409,7 +405,7 @@ def delete_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Deletes a pet @@ -674,7 +670,7 @@ def find_pets_by_status_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[Pet]]: + ) -> _ApiResponse[List[Pet]]: """Finds Pets by status Multiple status values can be provided with comma separated strings @@ -941,7 +937,7 @@ def find_pets_by_tags_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[List[Pet]]: + ) -> _ApiResponse[List[Pet]]: """(Deprecated) Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -1210,7 +1206,7 @@ def get_pet_by_id_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Pet]: + ) -> _ApiResponse[Pet]: """Find pet by ID Returns a single pet @@ -1476,7 +1472,7 @@ def update_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Update an existing pet @@ -1760,7 +1756,7 @@ def update_pet_with_form_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Updates a pet in the store with form data @@ -2057,7 +2053,7 @@ def upload_file_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ApiResponse]: + ) -> _ApiResponse[ApiResponse]: """uploads an image @@ -2358,7 +2354,7 @@ def upload_file_with_required_file_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ApiResponse]: + ) -> _ApiResponse[ApiResponse]: """uploads an image (required) diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py index 81b53840a274..481af9f78f70 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py @@ -16,12 +16,8 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import Field from typing_extensions import Annotated @@ -32,7 +28,7 @@ from petstore_api.models.order import Order from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse +from petstore_api.api_response import ApiResponse as _ApiResponse from petstore_api.rest import RESTResponseType @@ -133,7 +129,7 @@ def delete_order_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -381,7 +377,7 @@ def get_inventory_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Dict[str, int]]: + ) -> _ApiResponse[Dict[str, int]]: """Returns pet inventories by status Returns a map of status codes to quantities @@ -631,7 +627,7 @@ def get_order_by_id_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Order]: + ) -> _ApiResponse[Order]: """Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -894,7 +890,7 @@ def place_order_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[Order]: + ) -> _ApiResponse[Order]: """Place an order for a pet diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py index 2331c7fb56db..622a473377f3 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py @@ -16,12 +16,8 @@ import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt -from typing import Dict, List, Optional, Tuple, Union, Any - -try: - from typing import Annotated -except ImportError: - from typing_extensions import Annotated +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated from pydantic import Field from typing_extensions import Annotated @@ -32,7 +28,7 @@ from petstore_api.models.user import User from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse +from petstore_api.api_response import ApiResponse as _ApiResponse from petstore_api.rest import RESTResponseType @@ -131,7 +127,7 @@ def create_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=3)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Create user This can only be done by the logged in user. @@ -397,7 +393,7 @@ def create_users_with_array_input_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Creates list of users with given input array @@ -659,7 +655,7 @@ def create_users_with_list_input_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Creates list of users with given input array @@ -923,7 +919,7 @@ def delete_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Delete user This can only be done by the logged in user. @@ -1178,7 +1174,7 @@ def get_user_by_name_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[User]: + ) -> _ApiResponse[User]: """Get user by user name @@ -1446,7 +1442,7 @@ def login_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[str]: + ) -> _ApiResponse[str]: """Logs user into the system @@ -1714,7 +1710,7 @@ def logout_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Logs out current logged in user session @@ -1959,7 +1955,7 @@ def update_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[None]: + ) -> _ApiResponse[None]: """Updated user This can only be done by the logged in user. diff --git a/samples/openapi3/client/petstore/python/petstore_api/api_client.py b/samples/openapi3/client/petstore/python/petstore_api/api_client.py index f0b4714a03c0..77daa96b83e1 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_client.py @@ -273,15 +273,13 @@ def call_api( ) except ApiException as e: - if e.body: - e.body = e.body.decode('utf-8') raise e return response_data def response_deserialize( self, - response_data: rest.RESTResponse = None, + response_data: rest.RESTResponse, response_types_map=None ) -> ApiResponse: """Deserializes response into an object. @@ -310,7 +308,10 @@ def response_deserialize( 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_text = response_data.data.decode(encoding) + if response_data.data is None: # should not happen + response_text = "" + else: + response_text = response_data.data.decode(encoding) return_data = self.deserialize(response_text, response_type) finally: if not 200 <= response_data.status <= 299: @@ -323,7 +324,7 @@ def response_deserialize( return ApiResponse( status_code = response_data.status, data = return_data, - headers = response_data.getheaders(), + headers = dict(response_data.getheaders()), raw_data = response_data.data ) diff --git a/samples/openapi3/client/petstore/python/petstore_api/api_response.py b/samples/openapi3/client/petstore/python/petstore_api/api_response.py index 2ac1ada6e9b3..393bb5a42425 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api_response.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_response.py @@ -14,7 +14,7 @@ class ApiResponse(BaseModel, Generic[T]): status_code: StrictInt = Field(description="HTTP status code") headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") data: T = Field(description="Deserialized data given the data type") - raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + raw_data: Optional[StrictBytes] = Field(description="Raw data (HTTP response body)") model_config = { "arbitrary_types_allowed": True diff --git a/samples/openapi3/client/petstore/python/petstore_api/exceptions.py b/samples/openapi3/client/petstore/python/petstore_api/exceptions.py index 363d0d9f8744..0cb484becbdb 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/exceptions.py +++ b/samples/openapi3/client/petstore/python/petstore_api/exceptions.py @@ -12,7 +12,6 @@ """ # noqa: E501 from typing import Any, Optional - from typing_extensions import Self class OpenApiException(Exception): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_any_type.py b/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_any_type.py index 2ce4d17e9577..22a5e075260c 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_any_type.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_any_type.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class AdditionalPropertiesAnyType(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AdditionalPropertiesAnyType from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,11 +63,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of AdditionalPropertiesAnyType from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_class.py b/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_class.py index 4704d56b5d13..d2c5efe24ef3 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_class.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_class.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class AdditionalPropertiesClass(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AdditionalPropertiesClass from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of AdditionalPropertiesClass from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_object.py b/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_object.py index 6d6fd8daf5f1..6d718e075b65 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_object.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_object.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class AdditionalPropertiesObject(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AdditionalPropertiesObject from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,11 +63,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of AdditionalPropertiesObject from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_with_description_only.py b/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_with_description_only.py index 9a41a8257f1b..6fb089f7329c 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_with_description_only.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_with_description_only.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class AdditionalPropertiesWithDescriptionOnly(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AdditionalPropertiesWithDescriptionOnly from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,11 +63,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of AdditionalPropertiesWithDescriptionOnly from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/all_of_with_single_ref.py b/samples/openapi3/client/petstore/python/petstore_api/models/all_of_with_single_ref.py index 7a7e76b88df4..6e1cf1a2a3f3 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/all_of_with_single_ref.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/all_of_with_single_ref.py @@ -22,10 +22,8 @@ from pydantic import BaseModel, StrictStr from pydantic import Field from petstore_api.models.single_ref_type import SingleRefType -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class AllOfWithSingleRef(BaseModel): """ @@ -53,7 +51,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of AllOfWithSingleRef from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -68,11 +66,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -83,7 +83,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of AllOfWithSingleRef from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python/petstore_api/models/animal.py index 0851ecd14239..89f7964d27d8 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/animal.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/animal.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional, Union from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Animal(BaseModel): """ @@ -43,7 +41,7 @@ class Animal(BaseModel): # JSON field name that stores the object type - __discriminator_property_name: ClassVar[List[str]] = 'className' + __discriminator_property_name: ClassVar[str] = 'className' # discriminator mappings __discriminator_value_class_map: ClassVar[Dict[str, str]] = { @@ -51,7 +49,7 @@ class Animal(BaseModel): } @classmethod - def get_discriminator_value(cls, obj: Dict) -> str: + def get_discriminator_value(cls, obj: Dict) -> Optional[str]: """Returns the discriminator value (object type) of the data""" discriminator_value = obj[cls.__discriminator_property_name] if discriminator_value: @@ -69,7 +67,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Union[Self, Self]: + def from_json(cls, json_str: str) -> Optional[Union[Self, Self]]: """Create an instance of Animal from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -84,11 +82,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -99,7 +99,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Union[Self, Self]: + def from_dict(cls, obj: Dict) -> Optional[Union[Self, Self]]: """Create an instance of Animal from a dict""" # look up the object type based on discriminator mapping object_type = cls.get_discriminator_value(obj) diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/any_of_color.py b/samples/openapi3/client/petstore/python/petstore_api/models/any_of_color.py index 7e8e6976ebc8..e47be4dc9539 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/any_of_color.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/any_of_color.py @@ -23,12 +23,8 @@ from pydantic import Field from typing_extensions import Annotated from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict -from typing_extensions import Literal +from typing_extensions import Literal, Self from pydantic import StrictStr, Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self ANYOFCOLOR_ANY_OF_SCHEMAS = ["List[int]", "str"] @@ -47,7 +43,7 @@ class AnyOfColor(BaseModel): actual_instance: Optional[Union[List[int], str]] = None else: actual_instance: Any = None - any_of_schemas: List[str] = Literal[ANYOFCOLOR_ANY_OF_SCHEMAS] + #any_of_schemas: List[str] = Literal[ANYOFCOLOR_ANY_OF_SCHEMAS] model_config = { "validate_assignment": True, @@ -140,22 +136,20 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> Dict: + def to_dict(self) -> Optional[Union[Dict, List[int], str]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: - return "null" + return None - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: - return json.dumps(self.actual_instance) + return self.actual_instance def to_str(self) -> str: """Returns the string representation of the actual instance""" diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/any_of_pig.py b/samples/openapi3/client/petstore/python/petstore_api/models/any_of_pig.py index 4abe31fc06fc..917567c88d39 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/any_of_pig.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/any_of_pig.py @@ -23,12 +23,8 @@ from petstore_api.models.basque_pig import BasquePig from petstore_api.models.danish_pig import DanishPig from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict -from typing_extensions import Literal +from typing_extensions import Literal, Self from pydantic import StrictStr, Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self ANYOFPIG_ANY_OF_SCHEMAS = ["BasquePig", "DanishPig"] @@ -45,7 +41,7 @@ class AnyOfPig(BaseModel): actual_instance: Optional[Union[BasquePig, DanishPig]] = None else: actual_instance: Any = None - any_of_schemas: List[str] = Literal[ANYOFPIG_ANY_OF_SCHEMAS] + #any_of_schemas: List[str] = Literal[ANYOFPIG_ANY_OF_SCHEMAS] model_config = { "validate_assignment": True, @@ -117,22 +113,20 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> Dict: + def to_dict(self) -> Optional[Union[Dict, BasquePig, DanishPig]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: - return "null" + return None - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: - return json.dumps(self.actual_instance) + return self.actual_instance def to_str(self) -> str: """Returns the string representation of the actual instance""" diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/api_response.py b/samples/openapi3/client/petstore/python/petstore_api/models/api_response.py index eac66acfb573..efd9710840f2 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/api_response.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/api_response.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ApiResponse(BaseModel): """ @@ -52,7 +50,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ApiResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -67,11 +65,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -82,7 +82,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ApiResponse from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/array_of_array_of_model.py b/samples/openapi3/client/petstore/python/petstore_api/models/array_of_array_of_model.py index 772e428b2829..0ac21596bed5 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/array_of_array_of_model.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/array_of_array_of_model.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from petstore_api.models.tag import Tag -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ArrayOfArrayOfModel(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ArrayOfArrayOfModel from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of each item in another_property (list of list) @@ -90,7 +90,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ArrayOfArrayOfModel from a dict""" if obj is None: return None @@ -101,7 +101,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "another_property": [ [Tag.from_dict(_inner_item) for _inner_item in _item] - for _item in obj.get("another_property") + for _item in obj["another_property"] ] if obj.get("another_property") is not None else None }) # store additional fields in additional_properties diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python/petstore_api/models/array_of_array_of_number_only.py index d801b0cda6b5..62d0107556fe 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/array_of_array_of_number_only.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictFloat from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ArrayOfArrayOfNumberOnly(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ArrayOfArrayOfNumberOnly from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ArrayOfArrayOfNumberOnly from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/array_of_number_only.py b/samples/openapi3/client/petstore/python/petstore_api/models/array_of_number_only.py index 96ce0f69f2fd..13367e96f3bc 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/array_of_number_only.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/array_of_number_only.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictFloat from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ArrayOfNumberOnly(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ArrayOfNumberOnly from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ArrayOfNumberOnly from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/array_test.py b/samples/openapi3/client/petstore/python/petstore_api/models/array_test.py index cbb543e5cfe4..5a4bf4ef3c0f 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/array_test.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/array_test.py @@ -23,10 +23,8 @@ from pydantic import Field from typing_extensions import Annotated from petstore_api.models.read_only_first import ReadOnlyFirst -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ArrayTest(BaseModel): """ @@ -55,7 +53,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ArrayTest from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -70,11 +68,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of each item in array_array_of_model (list of list) @@ -94,7 +94,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ArrayTest from a dict""" if obj is None: return None @@ -107,7 +107,7 @@ def from_dict(cls, obj: Dict) -> Self: "array_array_of_integer": obj.get("array_array_of_integer"), "array_array_of_model": [ [ReadOnlyFirst.from_dict(_inner_item) for _inner_item in _item] - for _item in obj.get("array_array_of_model") + for _item in obj["array_array_of_model"] ] if obj.get("array_array_of_model") is not None else None }) # store additional fields in additional_properties diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/basque_pig.py b/samples/openapi3/client/petstore/python/petstore_api/models/basque_pig.py index 6d03a549ec00..966c7c2371cf 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/basque_pig.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/basque_pig.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class BasquePig(BaseModel): """ @@ -52,7 +50,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of BasquePig from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -67,11 +65,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -82,7 +82,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of BasquePig from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/capitalization.py b/samples/openapi3/client/petstore/python/petstore_api/models/capitalization.py index 9f0eaab95acc..a8c850cb3374 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/capitalization.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/capitalization.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Capitalization(BaseModel): """ @@ -56,7 +54,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Capitalization from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -71,11 +69,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -86,7 +86,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Capitalization from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/cat.py b/samples/openapi3/client/petstore/python/petstore_api/models/cat.py index 931554c725ad..593212027500 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/cat.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/cat.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import StrictBool from petstore_api.models.animal import Animal -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Cat(Animal): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Cat from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Cat from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/category.py b/samples/openapi3/client/petstore/python/petstore_api/models/category.py index 38daeb84aa38..a48c241ae8b4 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/category.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/category.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Category(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Category from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Category from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/circular_reference_model.py b/samples/openapi3/client/petstore/python/petstore_api/models/circular_reference_model.py index d4171cbe4d2c..6e08ef16c645 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/circular_reference_model.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/circular_reference_model.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class CircularReferenceModel(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CircularReferenceModel from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of nested @@ -84,7 +84,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of CircularReferenceModel from a dict""" if obj is None: return None @@ -94,7 +94,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "size": obj.get("size"), - "nested": FirstRef.from_dict(obj.get("nested")) if obj.get("nested") is not None else None + "nested": FirstRef.from_dict(obj["nested"]) if obj.get("nested") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/class_model.py b/samples/openapi3/client/petstore/python/petstore_api/models/class_model.py index 601e5353de6f..a62383db7036 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/class_model.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/class_model.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ClassModel(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ClassModel from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ClassModel from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/client.py b/samples/openapi3/client/petstore/python/petstore_api/models/client.py index 7dd00901d946..af60b3fedfac 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/client.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Client(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Client from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,11 +63,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Client from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/color.py b/samples/openapi3/client/petstore/python/petstore_api/models/color.py index 638d942a34e7..f71a5cb4e333 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/color.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/color.py @@ -23,12 +23,8 @@ from pydantic import Field from typing_extensions import Annotated from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict -from typing_extensions import Literal +from typing_extensions import Literal, Self from pydantic import StrictStr, Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self COLOR_ONE_OF_SCHEMAS = ["List[int]", "str"] @@ -43,7 +39,7 @@ class Color(BaseModel): # data type: str oneof_schema_3_validator: Optional[Annotated[str, Field(min_length=7, strict=True, max_length=7)]] = Field(default=None, description="Hex color string, such as #00FF00.") actual_instance: Optional[Union[List[int], str]] = None - one_of_schemas: List[str] = Literal["List[int]", "str"] + #one_of_schemas = Literal["List[int]", "str"] model_config = { "validate_assignment": True, @@ -152,19 +148,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> Dict: + def to_dict(self) -> Optional[Union[Dict, List[int], str]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/creature.py b/samples/openapi3/client/petstore/python/petstore_api/models/creature.py index 60421bb1ae6b..2af760d0f19a 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/creature.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/creature.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List from pydantic import BaseModel, StrictStr from petstore_api.models.creature_info import CreatureInfo -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Creature(BaseModel): """ @@ -52,7 +50,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Creature from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -67,11 +65,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of info @@ -85,7 +85,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Creature from a dict""" if obj is None: return None @@ -94,7 +94,7 @@ def from_dict(cls, obj: Dict) -> Self: return cls.model_validate(obj) _obj = cls.model_validate({ - "info": CreatureInfo.from_dict(obj.get("info")) if obj.get("info") is not None else None, + "info": CreatureInfo.from_dict(obj["info"]) if obj.get("info") is not None else None, "type": obj.get("type") }) # store additional fields in additional_properties diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/creature_info.py b/samples/openapi3/client/petstore/python/petstore_api/models/creature_info.py index 33841c6305e8..c74b576a9fd3 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/creature_info.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/creature_info.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class CreatureInfo(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of CreatureInfo from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,11 +63,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of CreatureInfo from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/danish_pig.py b/samples/openapi3/client/petstore/python/petstore_api/models/danish_pig.py index a89183607b36..f8dd263020ae 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/danish_pig.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/danish_pig.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List from pydantic import BaseModel, StrictInt, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class DanishPig(BaseModel): """ @@ -52,7 +50,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DanishPig from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -67,11 +65,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -82,7 +82,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of DanishPig from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/deprecated_object.py b/samples/openapi3/client/petstore/python/petstore_api/models/deprecated_object.py index f75a9da44907..c0e0adfc33f5 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/deprecated_object.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/deprecated_object.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class DeprecatedObject(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DeprecatedObject from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,11 +63,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of DeprecatedObject from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/dog.py b/samples/openapi3/client/petstore/python/petstore_api/models/dog.py index 1b7b61dd1783..5da2e55804f3 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/dog.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/dog.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import StrictStr from petstore_api.models.animal import Animal -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Dog(Animal): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Dog from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Dog from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/dummy_model.py b/samples/openapi3/client/petstore/python/petstore_api/models/dummy_model.py index 321eef90ce64..c5b9cbdca935 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/dummy_model.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/dummy_model.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class DummyModel(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of DummyModel from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of self_ref @@ -84,7 +84,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of DummyModel from a dict""" if obj is None: return None @@ -94,7 +94,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "category": obj.get("category"), - "self_ref": SelfReferenceModel.from_dict(obj.get("self_ref")) if obj.get("self_ref") is not None else None + "self_ref": SelfReferenceModel.from_dict(obj["self_ref"]) if obj.get("self_ref") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python/petstore_api/models/enum_arrays.py index 5ed06a50d00d..bdeb612dcd86 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/enum_arrays.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/enum_arrays.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr, field_validator -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class EnumArrays(BaseModel): """ @@ -72,7 +70,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of EnumArrays from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -87,11 +85,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -102,7 +102,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of EnumArrays from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/enum_class.py b/samples/openapi3/client/petstore/python/petstore_api/models/enum_class.py index 11255f418979..2da054deef79 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/enum_class.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/enum_class.py @@ -20,10 +20,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class EnumClass(str, Enum): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/enum_string1.py b/samples/openapi3/client/petstore/python/petstore_api/models/enum_string1.py index efe9a6056218..c0cbc113487a 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/enum_string1.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/enum_string1.py @@ -20,10 +20,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class EnumString1(str, Enum): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/enum_string2.py b/samples/openapi3/client/petstore/python/petstore_api/models/enum_string2.py index 222c5dc6b824..8fb75eb65a63 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/enum_string2.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/enum_string2.py @@ -20,10 +20,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class EnumString2(str, Enum): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python/petstore_api/models/enum_test.py index 71bf3c4413e4..bc8321f5f0c7 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/enum_test.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/enum_test.py @@ -25,10 +25,8 @@ from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue from petstore_api.models.outer_enum_integer import OuterEnumInteger from petstore_api.models.outer_enum_integer_default_value import OuterEnumIntegerDefaultValue -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class EnumTest(BaseModel): """ @@ -110,7 +108,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of EnumTest from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -125,11 +123,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -145,7 +145,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of EnumTest from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/file.py b/samples/openapi3/client/petstore/python/petstore_api/models/file.py index 7d84e5190069..81e46952bc33 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/file.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/file.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class File(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of File from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of File from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/file_schema_test_class.py b/samples/openapi3/client/petstore/python/petstore_api/models/file_schema_test_class.py index d52e09861a67..9267315e8629 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/file_schema_test_class.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from petstore_api.models.file import File -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class FileSchemaTestClass(BaseModel): """ @@ -52,7 +50,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FileSchemaTestClass from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -67,11 +65,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of file @@ -92,7 +92,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of FileSchemaTestClass from a dict""" if obj is None: return None @@ -101,8 +101,8 @@ def from_dict(cls, obj: Dict) -> Self: return cls.model_validate(obj) _obj = cls.model_validate({ - "file": File.from_dict(obj.get("file")) if obj.get("file") is not None else None, - "files": [File.from_dict(_item) for _item in obj.get("files")] if obj.get("files") is not None else None + "file": File.from_dict(obj["file"]) if obj.get("file") is not None else None, + "files": [File.from_dict(_item) for _item in obj["files"]] if obj.get("files") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/first_ref.py b/samples/openapi3/client/petstore/python/petstore_api/models/first_ref.py index 5542541c95fb..e823e888c17a 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/first_ref.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/first_ref.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class FirstRef(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FirstRef from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of self_ref @@ -84,7 +84,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of FirstRef from a dict""" if obj is None: return None @@ -94,7 +94,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "category": obj.get("category"), - "self_ref": SecondRef.from_dict(obj.get("self_ref")) if obj.get("self_ref") is not None else None + "self_ref": SecondRef.from_dict(obj["self_ref"]) if obj.get("self_ref") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/foo.py b/samples/openapi3/client/petstore/python/petstore_api/models/foo.py index 9d8160318a06..f07a433bdf99 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/foo.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/foo.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Foo(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Foo from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,11 +63,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Foo from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/foo_get_default_response.py b/samples/openapi3/client/petstore/python/petstore_api/models/foo_get_default_response.py index b242b602212c..8c4d92cbd151 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/foo_get_default_response.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/foo_get_default_response.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from petstore_api.models.foo import Foo -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class FooGetDefaultResponse(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FooGetDefaultResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of string @@ -84,7 +84,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of FooGetDefaultResponse from a dict""" if obj is None: return None @@ -93,7 +93,7 @@ def from_dict(cls, obj: Dict) -> Self: return cls.model_validate(obj) _obj = cls.model_validate({ - "string": Foo.from_dict(obj.get("string")) if obj.get("string") is not None else None + "string": Foo.from_dict(obj["string"]) if obj.get("string") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/format_test.py b/samples/openapi3/client/petstore/python/petstore_api/models/format_test.py index 12f3f5885d42..ab4a71718e6e 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/format_test.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/format_test.py @@ -23,10 +23,8 @@ from decimal import Decimal from pydantic import Field from typing_extensions import Annotated -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class FormatTest(BaseModel): """ @@ -109,7 +107,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of FormatTest from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -124,11 +122,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -139,7 +139,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of FormatTest from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/has_only_read_only.py b/samples/openapi3/client/petstore/python/petstore_api/models/has_only_read_only.py index d422c8a17338..7acb0623cd0d 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/has_only_read_only.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/has_only_read_only.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class HasOnlyReadOnly(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of HasOnlyReadOnly from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -68,13 +66,15 @@ def to_dict(self) -> Dict[str, Any]: * OpenAPI `readOnly` fields are excluded. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "bar", + "foo", + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "bar", - "foo", - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -85,7 +85,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of HasOnlyReadOnly from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/health_check_result.py b/samples/openapi3/client/petstore/python/petstore_api/models/health_check_result.py index 4b5c69f5f8a3..0326c1407c7f 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/health_check_result.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/health_check_result.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class HealthCheckResult(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of HealthCheckResult from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -86,7 +86,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of HealthCheckResult from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/inner_dict_with_property.py b/samples/openapi3/client/petstore/python/petstore_api/models/inner_dict_with_property.py index c4e52c32e4d7..1cbae502b29d 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/inner_dict_with_property.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/inner_dict_with_property.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class InnerDictWithProperty(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of InnerDictWithProperty from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of InnerDictWithProperty from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/int_or_string.py b/samples/openapi3/client/petstore/python/petstore_api/models/int_or_string.py index a7203af4ac52..489820634d84 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/int_or_string.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/int_or_string.py @@ -23,12 +23,8 @@ from pydantic import Field from typing_extensions import Annotated from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict -from typing_extensions import Literal +from typing_extensions import Literal, Self from pydantic import StrictStr, Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self INTORSTRING_ONE_OF_SCHEMAS = ["int", "str"] @@ -41,7 +37,7 @@ class IntOrString(BaseModel): # data type: str oneof_schema_2_validator: Optional[StrictStr] = None actual_instance: Optional[Union[int, str]] = None - one_of_schemas: List[str] = Literal["int", "str"] + #one_of_schemas = Literal["int", "str"] model_config = { "validate_assignment": True, @@ -129,19 +125,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> Dict: + def to_dict(self) -> Optional[Union[Dict, int, str]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/list_class.py b/samples/openapi3/client/petstore/python/petstore_api/models/list_class.py index cb9f9cbd54d1..d0d5db6b4322 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/list_class.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/list_class.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ListClass(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ListClass from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ListClass from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/map_of_array_of_model.py b/samples/openapi3/client/petstore/python/petstore_api/models/map_of_array_of_model.py index 4d5d5a875c2b..852ff34779cd 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/map_of_array_of_model.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/map_of_array_of_model.py @@ -22,10 +22,8 @@ from pydantic import BaseModel from pydantic import Field from petstore_api.models.tag import Tag -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class MapOfArrayOfModel(BaseModel): """ @@ -52,7 +50,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MapOfArrayOfModel from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -67,11 +65,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of each value in shop_id_to_org_online_lip_map (dict of array) @@ -91,7 +91,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of MapOfArrayOfModel from a dict""" if obj is None: return None @@ -106,7 +106,7 @@ def from_dict(cls, obj: Dict) -> Self: if _v is not None else None ) - for _k, _v in obj.get("shopIdToOrgOnlineLipMap").items() + for _k, _v in obj.get("shopIdToOrgOnlineLipMap", {}).items() ) }) # store additional fields in additional_properties diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/map_test.py b/samples/openapi3/client/petstore/python/petstore_api/models/map_test.py index 562647339a30..0b775ede3f65 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/map_test.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/map_test.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool, StrictStr, field_validator -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class MapTest(BaseModel): """ @@ -63,7 +61,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MapTest from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -78,11 +76,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -93,7 +93,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of MapTest from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py index 138501aef5fd..8d2576ca4e7e 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -22,10 +22,8 @@ from pydantic import BaseModel, StrictStr from pydantic import Field from petstore_api.models.animal import Animal -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class MixedPropertiesAndAdditionalPropertiesClass(BaseModel): """ @@ -54,7 +52,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of MixedPropertiesAndAdditionalPropertiesClass from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -69,11 +67,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of each value in map (dict) @@ -91,7 +91,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of MixedPropertiesAndAdditionalPropertiesClass from a dict""" if obj is None: return None @@ -104,7 +104,7 @@ def from_dict(cls, obj: Dict) -> Self: "dateTime": obj.get("dateTime"), "map": dict( (_k, Animal.from_dict(_v)) - for _k, _v in obj.get("map").items() + for _k, _v in obj["map"].items() ) if obj.get("map") is not None else None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/model200_response.py b/samples/openapi3/client/petstore/python/petstore_api/models/model200_response.py index db0d6c82d6eb..c020f1313769 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/model200_response.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/model200_response.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Model200Response(BaseModel): """ @@ -52,7 +50,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Model200Response from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -67,11 +65,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -82,7 +82,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Model200Response from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/model_return.py b/samples/openapi3/client/petstore/python/petstore_api/models/model_return.py index e5dda1933348..f74e58c4a21f 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/model_return.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/model_return.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ModelReturn(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ModelReturn from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ModelReturn from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/name.py b/samples/openapi3/client/petstore/python/petstore_api/models/name.py index 84340c8acd4f..26b9c51f7837 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/name.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/name.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Name(BaseModel): """ @@ -54,7 +52,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Name from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -71,13 +69,15 @@ def to_dict(self) -> Dict[str, Any]: * OpenAPI `readOnly` fields are excluded. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "snake_case", + "var_123_number", + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "snake_case", - "var_123_number", - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -88,7 +88,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Name from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/nullable_class.py b/samples/openapi3/client/petstore/python/petstore_api/models/nullable_class.py index 88c5ee219988..8325b7cc9765 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/nullable_class.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/nullable_class.py @@ -20,10 +20,8 @@ from datetime import date, datetime from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class NullableClass(BaseModel): """ @@ -62,7 +60,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of NullableClass from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -77,11 +75,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -147,7 +147,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of NullableClass from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/nullable_property.py b/samples/openapi3/client/petstore/python/petstore_api/models/nullable_property.py index f44ae9253bb9..5d033e8f1f1f 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/nullable_property.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/nullable_property.py @@ -22,10 +22,8 @@ from pydantic import BaseModel, StrictInt, field_validator from pydantic import Field from typing_extensions import Annotated -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class NullableProperty(BaseModel): """ @@ -63,7 +61,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of NullableProperty from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -78,11 +76,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -98,7 +98,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of NullableProperty from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/number_only.py b/samples/openapi3/client/petstore/python/petstore_api/models/number_only.py index bf460b8efc5f..f7fb58595f60 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/number_only.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/number_only.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictFloat from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class NumberOnly(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of NumberOnly from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of NumberOnly from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/object_to_test_additional_properties.py b/samples/openapi3/client/petstore/python/petstore_api/models/object_to_test_additional_properties.py index 69efac6a9d63..8f3fc2614342 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/object_to_test_additional_properties.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/object_to_test_additional_properties.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ObjectToTestAdditionalProperties(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ObjectToTestAdditionalProperties from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ObjectToTestAdditionalProperties from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/object_with_deprecated_fields.py b/samples/openapi3/client/petstore/python/petstore_api/models/object_with_deprecated_fields.py index 6200d54f77f3..dab7ff8d1c4d 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/object_with_deprecated_fields.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/object_with_deprecated_fields.py @@ -22,10 +22,8 @@ from pydantic import BaseModel, StrictFloat, StrictStr from pydantic import Field from petstore_api.models.deprecated_object import DeprecatedObject -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ObjectWithDeprecatedFields(BaseModel): """ @@ -55,7 +53,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ObjectWithDeprecatedFields from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -70,11 +68,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of deprecated_ref @@ -88,7 +88,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ObjectWithDeprecatedFields from a dict""" if obj is None: return None @@ -99,7 +99,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "uuid": obj.get("uuid"), "id": obj.get("id"), - "deprecatedRef": DeprecatedObject.from_dict(obj.get("deprecatedRef")) if obj.get("deprecatedRef") is not None else None, + "deprecatedRef": DeprecatedObject.from_dict(obj["deprecatedRef"]) if obj.get("deprecatedRef") is not None else None, "bars": obj.get("bars") }) # store additional fields in additional_properties diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/one_of_enum_string.py b/samples/openapi3/client/petstore/python/petstore_api/models/one_of_enum_string.py index b099c7bab578..36dc89230d95 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/one_of_enum_string.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/one_of_enum_string.py @@ -23,12 +23,8 @@ from petstore_api.models.enum_string1 import EnumString1 from petstore_api.models.enum_string2 import EnumString2 from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict -from typing_extensions import Literal +from typing_extensions import Literal, Self from pydantic import StrictStr, Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self ONEOFENUMSTRING_ONE_OF_SCHEMAS = ["EnumString1", "EnumString2"] @@ -41,7 +37,7 @@ class OneOfEnumString(BaseModel): # data type: EnumString2 oneof_schema_2_validator: Optional[EnumString2] = None actual_instance: Optional[Union[EnumString1, EnumString2]] = None - one_of_schemas: List[str] = Literal["EnumString1", "EnumString2"] + #one_of_schemas = Literal["EnumString1", "EnumString2"] model_config = { "validate_assignment": True, @@ -121,19 +117,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> Dict: + def to_dict(self) -> Optional[Union[Dict, EnumString1, EnumString2]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/order.py b/samples/openapi3/client/petstore/python/petstore_api/models/order.py index 2543b6c79e75..208d17f12067 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/order.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/order.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool, StrictInt, StrictStr, field_validator from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Order(BaseModel): """ @@ -66,7 +64,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Order from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -81,11 +79,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -96,7 +96,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Order from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/outer_composite.py b/samples/openapi3/client/petstore/python/petstore_api/models/outer_composite.py index 452462bc9ca9..cb2fb62cd048 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/outer_composite.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/outer_composite.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool, StrictFloat, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class OuterComposite(BaseModel): """ @@ -52,7 +50,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of OuterComposite from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -67,11 +65,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -82,7 +82,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of OuterComposite from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum.py b/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum.py index 89b19cbcf664..9e347e5714b8 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum.py @@ -20,10 +20,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class OuterEnum(str, Enum): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_default_value.py b/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_default_value.py index 51ca91443e27..55ab85308117 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_default_value.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_default_value.py @@ -20,10 +20,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class OuterEnumDefaultValue(str, Enum): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_integer.py b/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_integer.py index 8947df650469..f16c2948f0ef 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_integer.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_integer.py @@ -20,10 +20,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class OuterEnumInteger(int, Enum): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_integer_default_value.py index 970487bb0c4d..da4b3a1049d9 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_integer_default_value.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/outer_enum_integer_default_value.py @@ -20,10 +20,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class OuterEnumIntegerDefaultValue(int, Enum): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/outer_object_with_enum_property.py b/samples/openapi3/client/petstore/python/petstore_api/models/outer_object_with_enum_property.py index f3aeef5e06c7..fd8b462918bb 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/outer_object_with_enum_property.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/outer_object_with_enum_property.py @@ -22,10 +22,8 @@ from pydantic import BaseModel from petstore_api.models.outer_enum import OuterEnum from petstore_api.models.outer_enum_integer import OuterEnumInteger -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class OuterObjectWithEnumProperty(BaseModel): """ @@ -53,7 +51,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of OuterObjectWithEnumProperty from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -68,11 +66,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -88,7 +88,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of OuterObjectWithEnumProperty from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/parent.py b/samples/openapi3/client/petstore/python/petstore_api/models/parent.py index 8409e17062df..0b90159abc58 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/parent.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/parent.py @@ -22,10 +22,8 @@ from pydantic import BaseModel from pydantic import Field from petstore_api.models.inner_dict_with_property import InnerDictWithProperty -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Parent(BaseModel): """ @@ -52,7 +50,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Parent from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -67,11 +65,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of each value in optional_dict (dict) @@ -89,7 +89,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Parent from a dict""" if obj is None: return None @@ -100,7 +100,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "optionalDict": dict( (_k, InnerDictWithProperty.from_dict(_v)) - for _k, _v in obj.get("optionalDict").items() + for _k, _v in obj["optionalDict"].items() ) if obj.get("optionalDict") is not None else None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/parent_with_optional_dict.py b/samples/openapi3/client/petstore/python/petstore_api/models/parent_with_optional_dict.py index f02d65b50444..de159ec0d480 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/parent_with_optional_dict.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/parent_with_optional_dict.py @@ -22,10 +22,8 @@ from pydantic import BaseModel from pydantic import Field from petstore_api.models.inner_dict_with_property import InnerDictWithProperty -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ParentWithOptionalDict(BaseModel): """ @@ -52,7 +50,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ParentWithOptionalDict from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -67,11 +65,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of each value in optional_dict (dict) @@ -89,7 +89,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ParentWithOptionalDict from a dict""" if obj is None: return None @@ -100,7 +100,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "optionalDict": dict( (_k, InnerDictWithProperty.from_dict(_v)) - for _k, _v in obj.get("optionalDict").items() + for _k, _v in obj["optionalDict"].items() ) if obj.get("optionalDict") is not None else None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python/petstore_api/models/pet.py index a8da57a35278..5b360aa4cd24 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/pet.py @@ -24,10 +24,8 @@ from typing_extensions import Annotated from petstore_api.models.category import Category from petstore_api.models.tag import Tag -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Pet(BaseModel): """ @@ -69,7 +67,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Pet from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -84,11 +82,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of category @@ -109,7 +109,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Pet from a dict""" if obj is None: return None @@ -119,10 +119,10 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "id": obj.get("id"), - "category": Category.from_dict(obj.get("category")) if obj.get("category") is not None else None, + "category": Category.from_dict(obj["category"]) if obj.get("category") is not None else None, "name": obj.get("name"), "photoUrls": obj.get("photoUrls"), - "tags": [Tag.from_dict(_item) for _item in obj.get("tags")] if obj.get("tags") is not None else None, + "tags": [Tag.from_dict(_item) for _item in obj["tags"]] if obj.get("tags") is not None else None, "status": obj.get("status") }) # store additional fields in additional_properties diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/pig.py b/samples/openapi3/client/petstore/python/petstore_api/models/pig.py index 31a6571cbeb2..51a14fe1e9e4 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/pig.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/pig.py @@ -23,12 +23,8 @@ from petstore_api.models.basque_pig import BasquePig from petstore_api.models.danish_pig import DanishPig from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict -from typing_extensions import Literal +from typing_extensions import Literal, Self from pydantic import StrictStr, Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self PIG_ONE_OF_SCHEMAS = ["BasquePig", "DanishPig"] @@ -41,7 +37,7 @@ class Pig(BaseModel): # data type: DanishPig oneof_schema_2_validator: Optional[DanishPig] = None actual_instance: Optional[Union[BasquePig, DanishPig]] = None - one_of_schemas: List[str] = Literal["BasquePig", "DanishPig"] + #one_of_schemas = Literal["BasquePig", "DanishPig"] model_config = { "validate_assignment": True, @@ -139,19 +135,17 @@ def to_json(self) -> str: if self.actual_instance is None: return "null" - to_json = getattr(self.actual_instance, "to_json", None) - if callable(to_json): + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): return self.actual_instance.to_json() else: return json.dumps(self.actual_instance) - def to_dict(self) -> Dict: + def to_dict(self) -> Optional[Union[Dict, BasquePig, DanishPig]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None - to_dict = getattr(self.actual_instance, "to_dict", None) - if callable(to_dict): + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): return self.actual_instance.to_dict() else: # primitive type diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/property_name_collision.py b/samples/openapi3/client/petstore/python/petstore_api/models/property_name_collision.py index f3869d330ab3..1acb7c8863d9 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/property_name_collision.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/property_name_collision.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class PropertyNameCollision(BaseModel): """ @@ -53,7 +51,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of PropertyNameCollision from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -68,11 +66,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -83,7 +83,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of PropertyNameCollision from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/read_only_first.py b/samples/openapi3/client/petstore/python/petstore_api/models/read_only_first.py index 76329755f6d3..7c39d83719e5 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/read_only_first.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/read_only_first.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class ReadOnlyFirst(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of ReadOnlyFirst from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -67,12 +65,14 @@ def to_dict(self) -> Dict[str, Any]: * OpenAPI `readOnly` fields are excluded. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "bar", + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "bar", - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -83,7 +83,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of ReadOnlyFirst from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/second_ref.py b/samples/openapi3/client/petstore/python/petstore_api/models/second_ref.py index e16421deca5d..f8ba6df72b6d 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/second_ref.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/second_ref.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class SecondRef(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SecondRef from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of circular_ref @@ -84,7 +84,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of SecondRef from a dict""" if obj is None: return None @@ -94,7 +94,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "category": obj.get("category"), - "circular_ref": CircularReferenceModel.from_dict(obj.get("circular_ref")) if obj.get("circular_ref") is not None else None + "circular_ref": CircularReferenceModel.from_dict(obj["circular_ref"]) if obj.get("circular_ref") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/self_reference_model.py b/samples/openapi3/client/petstore/python/petstore_api/models/self_reference_model.py index 9508408b5d35..c76f8d5e8436 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/self_reference_model.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/self_reference_model.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class SelfReferenceModel(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SelfReferenceModel from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of nested @@ -84,7 +84,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of SelfReferenceModel from a dict""" if obj is None: return None @@ -94,7 +94,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "size": obj.get("size"), - "nested": DummyModel.from_dict(obj.get("nested")) if obj.get("nested") is not None else None + "nested": DummyModel.from_dict(obj["nested"]) if obj.get("nested") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/single_ref_type.py b/samples/openapi3/client/petstore/python/petstore_api/models/single_ref_type.py index 3c41c4118654..1144dbc90755 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/single_ref_type.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/single_ref_type.py @@ -20,10 +20,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class SingleRefType(str, Enum): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/special_character_enum.py b/samples/openapi3/client/petstore/python/petstore_api/models/special_character_enum.py index 77ed288a94b4..35086cfe923c 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/special_character_enum.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/special_character_enum.py @@ -20,10 +20,7 @@ -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing_extensions import Self class SpecialCharacterEnum(str, Enum): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/special_model_name.py b/samples/openapi3/client/petstore/python/petstore_api/models/special_model_name.py index ac2256a25435..62759671a771 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/special_model_name.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/special_model_name.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class SpecialModelName(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpecialModelName from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of SpecialModelName from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/special_name.py b/samples/openapi3/client/petstore/python/petstore_api/models/special_name.py index 540f75c8059a..0d790bddd8d3 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/special_name.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/special_name.py @@ -22,10 +22,8 @@ from pydantic import BaseModel, StrictInt, StrictStr, field_validator from pydantic import Field from petstore_api.models.category import Category -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class SpecialName(BaseModel): """ @@ -64,7 +62,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of SpecialName from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -79,11 +77,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of var_async @@ -97,7 +97,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of SpecialName from a dict""" if obj is None: return None @@ -107,7 +107,7 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "property": obj.get("property"), - "async": Category.from_dict(obj.get("async")) if obj.get("async") is not None else None, + "async": Category.from_dict(obj["async"]) if obj.get("async") is not None else None, "schema": obj.get("schema") }) # store additional fields in additional_properties diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/tag.py b/samples/openapi3/client/petstore/python/petstore_api/models/tag.py index d53d642ef7fd..d48b9d2a74ca 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/tag.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/tag.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Tag(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Tag from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Tag from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/test_error_responses_with_model400_response.py b/samples/openapi3/client/petstore/python/petstore_api/models/test_error_responses_with_model400_response.py index cf0098df56c3..ccdec37e5461 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/test_error_responses_with_model400_response.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/test_error_responses_with_model400_response.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class TestErrorResponsesWithModel400Response(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TestErrorResponsesWithModel400Response from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,11 +63,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of TestErrorResponsesWithModel400Response from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/test_error_responses_with_model404_response.py b/samples/openapi3/client/petstore/python/petstore_api/models/test_error_responses_with_model404_response.py index aa8d6232defd..dbfdfa33e191 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/test_error_responses_with_model404_response.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/test_error_responses_with_model404_response.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class TestErrorResponsesWithModel404Response(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TestErrorResponsesWithModel404Response from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,11 +63,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of TestErrorResponsesWithModel404Response from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/test_inline_freeform_additional_properties_request.py b/samples/openapi3/client/petstore/python/petstore_api/models/test_inline_freeform_additional_properties_request.py index c8d66e9d6389..1f42eec81b5b 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/test_inline_freeform_additional_properties_request.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/test_inline_freeform_additional_properties_request.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class TestInlineFreeformAdditionalPropertiesRequest(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of TestInlineFreeformAdditionalPropertiesRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of TestInlineFreeformAdditionalPropertiesRequest from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/tiger.py b/samples/openapi3/client/petstore/python/petstore_api/models/tiger.py index 1bd884664e0d..1424216486b9 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/tiger.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/tiger.py @@ -20,10 +20,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class Tiger(BaseModel): """ @@ -50,7 +48,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of Tiger from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -65,11 +63,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -80,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of Tiger from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/unnamed_dict_with_additional_model_list_properties.py b/samples/openapi3/client/petstore/python/petstore_api/models/unnamed_dict_with_additional_model_list_properties.py index 9c840503bca9..6468f03a5546 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/unnamed_dict_with_additional_model_list_properties.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/unnamed_dict_with_additional_model_list_properties.py @@ -22,10 +22,8 @@ from pydantic import BaseModel from pydantic import Field from petstore_api.models.creature_info import CreatureInfo -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class UnnamedDictWithAdditionalModelListProperties(BaseModel): """ @@ -52,7 +50,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of UnnamedDictWithAdditionalModelListProperties from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -67,11 +65,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of each value in dict_property (dict of array) @@ -91,7 +91,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of UnnamedDictWithAdditionalModelListProperties from a dict""" if obj is None: return None @@ -106,7 +106,7 @@ def from_dict(cls, obj: Dict) -> Self: if _v is not None else None ) - for _k, _v in obj.get("dictProperty").items() + for _k, _v in obj.get("dictProperty", {}).items() ) }) # store additional fields in additional_properties diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/unnamed_dict_with_additional_string_list_properties.py b/samples/openapi3/client/petstore/python/petstore_api/models/unnamed_dict_with_additional_string_list_properties.py index 469f2e4b2ce0..483c694c2dda 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/unnamed_dict_with_additional_string_list_properties.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/unnamed_dict_with_additional_string_list_properties.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class UnnamedDictWithAdditionalStringListProperties(BaseModel): """ @@ -51,7 +49,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of UnnamedDictWithAdditionalStringListProperties from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -66,11 +64,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -81,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of UnnamedDictWithAdditionalStringListProperties from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/user.py b/samples/openapi3/client/petstore/python/petstore_api/models/user.py index f5ad26584e9e..1516d382e1d0 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/user.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/user.py @@ -21,10 +21,8 @@ from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr from pydantic import Field -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class User(BaseModel): """ @@ -58,7 +56,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of User from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -73,11 +71,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # puts key-value pairs in additional_properties in the top level @@ -88,7 +88,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of User from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/with_nested_one_of.py b/samples/openapi3/client/petstore/python/petstore_api/models/with_nested_one_of.py index a1401068f566..34101877f7be 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/with_nested_one_of.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/with_nested_one_of.py @@ -22,10 +22,8 @@ from pydantic import BaseModel, StrictInt from petstore_api.models.one_of_enum_string import OneOfEnumString from petstore_api.models.pig import Pig -try: - from typing import Self -except ImportError: - from typing_extensions import Self +from typing import Optional, Set +from typing_extensions import Self class WithNestedOneOf(BaseModel): """ @@ -54,7 +52,7 @@ def to_json(self) -> str: return json.dumps(self.to_dict()) @classmethod - def from_json(cls, json_str: str) -> Self: + def from_json(cls, json_str: str) -> Optional[Self]: """Create an instance of WithNestedOneOf from a JSON string""" return cls.from_dict(json.loads(json_str)) @@ -69,11 +67,13 @@ def to_dict(self) -> Dict[str, Any]: are ignored. * Fields in `self.additional_properties` are added to the output dict. """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + _dict = self.model_dump( by_alias=True, - exclude={ - "additional_properties", - }, + exclude=excluded_fields, exclude_none=True, ) # override the default output from pydantic by calling `to_dict()` of nested_pig @@ -90,7 +90,7 @@ def to_dict(self) -> Dict[str, Any]: return _dict @classmethod - def from_dict(cls, obj: Dict) -> Self: + def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: """Create an instance of WithNestedOneOf from a dict""" if obj is None: return None @@ -100,8 +100,8 @@ def from_dict(cls, obj: Dict) -> Self: _obj = cls.model_validate({ "size": obj.get("size"), - "nested_pig": Pig.from_dict(obj.get("nested_pig")) if obj.get("nested_pig") is not None else None, - "nested_oneof_enum_string": OneOfEnumString.from_dict(obj.get("nested_oneof_enum_string")) if obj.get("nested_oneof_enum_string") is not None else None + "nested_pig": Pig.from_dict(obj["nested_pig"]) if obj.get("nested_pig") is not None else None, + "nested_oneof_enum_string": OneOfEnumString.from_dict(obj["nested_oneof_enum_string"]) if obj.get("nested_oneof_enum_string") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/samples/openapi3/client/petstore/python/petstore_api/rest.py b/samples/openapi3/client/petstore/python/petstore_api/rest.py index ff75022d695c..b53900b945b3 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/rest.py +++ b/samples/openapi3/client/petstore/python/petstore_api/rest.py @@ -71,56 +71,45 @@ def __init__(self, configuration) -> None: else: cert_reqs = ssl.CERT_NONE - addition_pool_args = {} + pool_args = { + "cert_reqs": cert_reqs, + "ca_certs": configuration.ssl_ca_cert, + "cert_file": configuration.cert_file, + "key_file": configuration.key_file, + } if configuration.assert_hostname is not None: - addition_pool_args['assert_hostname'] = ( + pool_args['assert_hostname'] = ( configuration.assert_hostname ) if configuration.retries is not None: - addition_pool_args['retries'] = configuration.retries + pool_args['retries'] = configuration.retries if configuration.tls_server_name: - addition_pool_args['server_hostname'] = configuration.tls_server_name + pool_args['server_hostname'] = configuration.tls_server_name if configuration.socket_options is not None: - addition_pool_args['socket_options'] = configuration.socket_options + pool_args['socket_options'] = configuration.socket_options if configuration.connection_pool_maxsize is not None: - addition_pool_args['maxsize'] = configuration.connection_pool_maxsize + pool_args['maxsize'] = configuration.connection_pool_maxsize # https pool manager + self.pool_manager: urllib3.PoolManager + if configuration.proxy: if is_socks_proxy_url(configuration.proxy): from urllib3.contrib.socks import SOCKSProxyManager - self.pool_manager = SOCKSProxyManager( - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - proxy_url=configuration.proxy, - headers=configuration.proxy_headers, - **addition_pool_args - ) + pool_args["proxy_url"] = configuration.proxy + pool_args["headers"] = configuration.proxy_headers + self.pool_manager = SOCKSProxyManager(**pool_args) else: - self.pool_manager = urllib3.ProxyManager( - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - proxy_url=configuration.proxy, - proxy_headers=configuration.proxy_headers, - **addition_pool_args - ) + pool_args["proxy_url"] = configuration.proxy + pool_args["proxy_headers"] = configuration.proxy_headers + self.pool_manager = urllib3.ProxyManager(**pool_args) else: - self.pool_manager = urllib3.PoolManager( - cert_reqs=cert_reqs, - ca_certs=configuration.ssl_ca_cert, - cert_file=configuration.cert_file, - key_file=configuration.key_file, - **addition_pool_args - ) + self.pool_manager = urllib3.PoolManager(**pool_args) def request( self, diff --git a/samples/openapi3/client/petstore/python/pyproject.toml b/samples/openapi3/client/petstore/python/pyproject.toml index 0d153fcb0c3d..0acd05db4ed9 100644 --- a/samples/openapi3/client/petstore/python/pyproject.toml +++ b/samples/openapi3/client/petstore/python/pyproject.toml @@ -23,6 +23,9 @@ typing-extensions = ">=4.7.1" pytest = ">=7.2.1" tox = ">=3.9.0" flake8 = ">=4.0.0" +types-python-dateutil = ">=2.8.19.14" +mypy = "1.4.1" + [build-system] requires = ["setuptools"] @@ -30,3 +33,6 @@ build-backend = "setuptools.build_meta" [tool.pylint.'MESSAGES CONTROL'] extension-pkg-whitelist = "pydantic" + +[tool.mypy] +files = ["petstore_api"] diff --git a/samples/openapi3/client/petstore/python/test-requirements.txt b/samples/openapi3/client/petstore/python/test-requirements.txt index 3a0d0b939a1e..8e6d8cb13749 100755 --- a/samples/openapi3/client/petstore/python/test-requirements.txt +++ b/samples/openapi3/client/petstore/python/test-requirements.txt @@ -1,3 +1,5 @@ pytest~=7.1.3 pytest-cov>=2.8.1 pytest-randomly>=3.12.0 +mypy>=1.4.1 +types-python-dateutil>=2.8.19 diff --git a/samples/openapi3/client/petstore/python/tests/test_color_model.py b/samples/openapi3/client/petstore/python/tests/test_color_model.py new file mode 100644 index 000000000000..cf31afce6e33 --- /dev/null +++ b/samples/openapi3/client/petstore/python/tests/test_color_model.py @@ -0,0 +1,151 @@ +# coding: utf-8 + +# flake8: noqa + +import json +import os +import time +import unittest + +from pydantic import ValidationError +import pytest + +import petstore_api +from petstore_api import InnerDictWithProperty + + +class ColorModelTests(unittest.TestCase): + def test_oneof_schema_2_validator(self): + array_of_integers = [12, 34, 56] + c = petstore_api.Color() + + try: + c.oneof_schema_2_validator = array_of_integers + self.fail(f"Should have failed: {c.oneof_schema_2_validator}") + except ValueError as e: + self.assertTrue("List should have at least 4 items after validation, not 3" in str(e)) + + def test_new_null(self): + c = petstore_api.Color() + self.assertEqual("null", c.to_json()) + self.assertEqual(None, c.actual_instance) + + def test_oneof_validator(self): + array_of_integers = [12, 34, 56] + c = petstore_api.Color() + + # no error should be thrown + c.oneof_schema_1_validator = array_of_integers + c.actual_instance = array_of_integers + c.actual_instance = None + + # test the oneof schema validator with invalid input + array_of_integers = [12,34,56120938] + try: + c.oneof_schema_1_validator = array_of_integers + self.fail(f"Should have failed: {c.oneof_schema_1_validator}") + except ValueError as e: + self.assertTrue("Input should be less than or equal to 255" in str(e)) + + try: + c.actual_instance = array_of_integers + self.fail(f"Should have failed: {c.actual_instance}") + except ValueError as e: + self.assertTrue("Input should be less than or equal to 255" in str(e)) + + def test_from_json(self): + json_str = '[12,34,56]' + c = petstore_api.Color.from_json(json_str) + self.assertEqual(c.actual_instance, [12, 34, 56]) + + try: + c = petstore_api.Color.from_json('[2342112,0,0,0]') + except ValueError as e: + self.assertTrue("Input should be less than or equal to 255" in str(e)) + + def test_to_json(self): + json_str = '[12,34,56]' + c = petstore_api.Color.from_json(json_str) + self.assertEqual(c.to_json(), "[12, 34, 56]") + + def test_to_dict(self): + json_str = '[12,34,56]' + c = petstore_api.Color.from_json(json_str) + self.assertEqual(c.to_dict(), [12, 34, 56]) + + def test_nullable(self): + c = petstore_api.Color.from_json(None) + self.assertEqual(c.actual_instance, None) + + def test_constraint_rgb(self): + rgb = [128, 128, 128] + color = petstore_api.Color(oneof_schema_1_validator=rgb) + self.assertEqual(rgb, color.oneof_schema_1_validator) + + try: + petstore_api.Color(oneof_schema_2_validator=rgb) + self.fail("invalid validation") + except ValidationError as e: + self.assertIn("List should have at least 4 items after validation, not 3", str(e)) + + def test_constraint_rgba(self): + rgba = [128, 128, 128, 128] + color = petstore_api.Color(oneof_schema_2_validator=rgba) + self.assertEqual(rgba, color.oneof_schema_2_validator) + + try: + petstore_api.Color(oneof_schema_1_validator=rgba) + self.fail("invalid validation") + except ValidationError as e: + self.assertIn("List should have at most 3 items after validation, not 4", str(e)) + + def test_constraint_hex(self): + hex_color = "#00FF00" + color = petstore_api.Color(oneof_schema_3_validator=hex_color) + self.assertEqual(hex_color, color.oneof_schema_3_validator) + + try: + petstore_api.Color(oneof_schema_3_validator="too long string") + self.fail("invalid validation") + except ValidationError as e: + self.assertIn("String should have at most 7 characters", str(e)) + + +class AnyOfColorModelTests(unittest.TestCase): + def test_new_null(self): + c = petstore_api.AnyOfColor() + self.assertEqual("null", c.to_json()) + self.assertEqual(None, c.actual_instance) + + def test_anyof_array_of_integers(self): + array_of_integers = [12,34,56] + c = petstore_api.AnyOfColor() + + # no error should be thrown + c.anyof_schema_1_validator = array_of_integers + c.actual_instance = array_of_integers + + # test the oneof schema validator with invalid input + array_of_integers = [12,34,56120938] + try: + c.anyof_schema_1_validator = array_of_integers + self.fail(f"Should have failed: {c.anyof_schema_1_validator}") + except ValueError as e: + self.assertIn("Input should be less than or equal to 255", str(e)) + + try: + c.actual_instance = array_of_integers + self.fail(f"Should have failed: {c.actual_instance}") + except ValueError as e: + self.assertIn("Input should be less than or equal to 255", str(e)) + + def test_from_json(self): + json_str = '[12,34,56]' + c = petstore_api.AnyOfColor.from_json(json_str) + self.assertEqual(c.actual_instance, [12, 34,56]) + + try: + c = petstore_api.AnyOfColor.from_json('[2342112,0,0,0]') + self.fail(f"Should have failed: {c.from_json}") + except ValueError as e: + self.assertIn("Input should be less than or equal to 255", str(e)) diff --git a/samples/openapi3/client/petstore/python/tests/test_model.py b/samples/openapi3/client/petstore/python/tests/test_model.py index b06eeaa0831f..83588a7aac3b 100644 --- a/samples/openapi3/client/petstore/python/tests/test_model.py +++ b/samples/openapi3/client/petstore/python/tests/test_model.py @@ -77,62 +77,6 @@ def test_equal(self): self.pet1.tags = [] self.assertFalse(self.pet1 == self.pet2) - def test_oneof_schema_2_validator(self): - new_color = petstore_api.Color() - array_of_integers = [12, 34, 56] - - try: - new_color.oneof_schema_2_validator = array_of_integers - self.fail(f"Should have failed: {new_color.oneof_schema_2_validator}") - except ValueError as e: - self.assertTrue("List should have at least 4 items after validation, not 3" in str(e)) - - def test_oneOf_array_of_integers(self): - # test new Color - new_color = petstore_api.Color() - self.assertEqual("null", new_color.to_json()) - self.assertEqual(None, new_color.actual_instance) - - # test the oneof schema validator - json_str = '[12,34,56]' - array_of_integers = json.loads(json_str) - # no error should be thrown - new_color.oneof_schema_1_validator = array_of_integers - new_color.actual_instance = array_of_integers - new_color.actual_instance = None - - # test the oneof schema validator with invalid input - json_str = '[12,34,56120938]' - array_of_integers = json.loads(json_str) - try: - new_color.oneof_schema_1_validator = array_of_integers - except ValueError as e: - self.assertTrue("Input should be less than or equal to 255" in str(e)) - - try: - new_color.actual_instance = array_of_integers - except ValueError as e: - self.assertTrue("Input should be less than or equal to 255" in str(e)) - - # test from_josn - json_str = '[12,34,56]' - p = petstore_api.Color.from_json(json_str) - self.assertEqual(p.actual_instance, [12, 34, 56]) - - try: - p = petstore_api.Color.from_json('[2342112,0,0,0]') - except ValueError as e: - self.assertTrue("Input should be less than or equal to 255" in str(e)) - - # test to_json, to_dict method - json_str = '[12,34,56]' - p = petstore_api.Color.from_json(json_str) - self.assertEqual(p.to_json(), "[12, 34, 56]") - self.assertEqual(p.to_dict(), [12, 34, 56]) - - # test nullable - p = petstore_api.Color.from_json(None) - self.assertEqual(p.actual_instance, None) def test_oneof_enum_string(self): enum_string1 = petstore_api.EnumString1('a') @@ -165,42 +109,6 @@ def test_oneof_enum_string(self): constructor3 = petstore_api.OneOfEnumString() self.assertEqual(constructor3.actual_instance, None) - def test_anyOf_array_of_integers(self): - # test new Color - new_color = petstore_api.AnyOfColor() - self.assertEqual("null", new_color.to_json()) - self.assertEqual(None, new_color.actual_instance) - - # test the oneof schema validator - json_str = '[12,34,56]' - array_of_integers = json.loads(json_str) - # no error should be thrown - new_color.anyof_schema_1_validator = array_of_integers - new_color.actual_instance = array_of_integers - - # test the oneof schema validator with invalid input - json_str = '[12,34,56120938]' - array_of_integers = json.loads(json_str) - try: - new_color.anyof_schema_1_validator = array_of_integers - except ValueError as e: - self.assertIn("Input should be less than or equal to 255", str(e)) - - try: - new_color.actual_instance = array_of_integers - except ValueError as e: - self.assertIn("Input should be less than or equal to 255", str(e)) - - # test from_josn - json_str = '[12,34,56]' - p = petstore_api.AnyOfColor.from_json(json_str) - self.assertEqual(p.actual_instance, [12, 34,56]) - - try: - p = petstore_api.AnyOfColor.from_json('[2342112,0,0,0]') - except ValueError as e: - self.assertIn("Input should be less than or equal to 255", str(e)) - def test_oneOf(self): # test new Pig bp = petstore_api.BasquePig.from_dict({"className": "BasquePig", "color": "red"}) @@ -393,7 +301,7 @@ def test_valdiator(self): self.assertEqual(a.pattern_with_digits_and_delimiter, "image_123") # test sanitize for serializaation with SecretStr (format: password) - self.assertEquals(petstore_api.ApiClient().sanitize_for_serialization(a), {'byte': b'string', 'date': '2013-09-17', 'number': 123.45, 'password': 'testing09876', 'pattern_with_digits_and_delimiter': 'image_123'}) + self.assertEqual(petstore_api.ApiClient().sanitize_for_serialization(a), {'byte': b'string', 'date': '2013-09-17', 'number': 123.45, 'password': 'testing09876', 'pattern_with_digits_and_delimiter': 'image_123'}) def test_inline_enum_validator(self): self.pet = petstore_api.Pet(name="test name", photoUrls=["string"]) @@ -404,39 +312,6 @@ def test_inline_enum_validator(self): except ValueError as e: self.assertTrue("must be one of enum values ('available', 'pending', 'sold')" in str(e)) - def test_constraints(self): - rgb = [128, 128, 128] - rgba = [128, 128, 128, 128] - hex_color = "#00FF00" - - # These should all pass - color = petstore_api.Color(oneof_schema_1_validator=rgb) - self.assertEqual(rgb, color.oneof_schema_1_validator) - - color = petstore_api.Color(oneof_schema_2_validator=rgba) - self.assertEqual(rgba, color.oneof_schema_2_validator) - - color = petstore_api.Color(oneof_schema_3_validator=hex_color) - self.assertEqual(hex_color, color.oneof_schema_3_validator) - - try: - petstore_api.Color(oneof_schema_1_validator=rgba) - self.fail("invalid validation") - except ValidationError as e: - self.assertIn("List should have at most 3 items after validation, not 4", str(e)) - - try: - petstore_api.Color(oneof_schema_2_validator=rgb) - self.fail("invalid validation") - except ValidationError as e: - self.assertIn("List should have at least 4 items after validation, not 3", str(e)) - - try: - petstore_api.Color(oneof_schema_3_validator="too long string") - self.fail("invalid validation") - except ValidationError as e: - self.assertIn("String should have at most 7 characters", str(e)) - def test_object_id(self): pet_ap = petstore_api.Pet(name="test name", photoUrls=["string"]) pet_ap2 = petstore_api.Pet(name="test name", photoUrls=["string"]) From 5e2c29558376aa11406cc05e370aa4cf2f978f9a Mon Sep 17 00:00:00 2001 From: Jonathan Ballet Date: Tue, 2 Jan 2024 12:48:27 +0100 Subject: [PATCH 2/8] ApiResponse's raw_data can't be None --- .../src/main/resources/python/api_client.mustache | 7 +++---- .../src/main/resources/python/api_response.mustache | 2 +- .../openapi_client/api_client.py | 7 +++---- .../openapi_client/api_response.py | 2 +- .../client/echo_api/python/openapi_client/api_client.py | 7 +++---- .../client/echo_api/python/openapi_client/api_response.py | 2 +- .../petstore/python-aiohttp/petstore_api/api_client.py | 7 +++---- .../petstore/python-aiohttp/petstore_api/api_response.py | 2 +- .../client/petstore/python/petstore_api/api_client.py | 7 +++---- .../client/petstore/python/petstore_api/api_response.py | 2 +- 10 files changed, 20 insertions(+), 25 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python/api_client.mustache b/modules/openapi-generator/src/main/resources/python/api_client.mustache index f77d3213d149..426992099d7e 100644 --- a/modules/openapi-generator/src/main/resources/python/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_client.mustache @@ -296,6 +296,8 @@ class ApiClient: :return: ApiResponse """ + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg response_type = response_types_map.get(str(response_data.status), None) if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: @@ -316,10 +318,7 @@ class ApiClient: 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" - if response_data.data is None: # should not happen - response_text = "" - else: - response_text = response_data.data.decode(encoding) + response_text = response_data.data.decode(encoding) return_data = self.deserialize(response_text, response_type) finally: if not 200 <= response_data.status <= 299: diff --git a/modules/openapi-generator/src/main/resources/python/api_response.mustache b/modules/openapi-generator/src/main/resources/python/api_response.mustache index 393bb5a42425..2ac1ada6e9b3 100644 --- a/modules/openapi-generator/src/main/resources/python/api_response.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_response.mustache @@ -14,7 +14,7 @@ class ApiResponse(BaseModel, Generic[T]): status_code: StrictInt = Field(description="HTTP status code") headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") data: T = Field(description="Deserialized data given the data type") - raw_data: Optional[StrictBytes] = Field(description="Raw data (HTTP response body)") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") model_config = { "arbitrary_types_allowed": True diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_client.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_client.py index 30d89d397037..5ca4547e5e38 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_client.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_client.py @@ -289,6 +289,8 @@ def response_deserialize( :return: ApiResponse """ + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg response_type = response_types_map.get(str(response_data.status), None) if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: @@ -309,10 +311,7 @@ def response_deserialize( 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" - if response_data.data is None: # should not happen - response_text = "" - else: - response_text = response_data.data.decode(encoding) + response_text = response_data.data.decode(encoding) return_data = self.deserialize(response_text, response_type) finally: if not 200 <= response_data.status <= 299: diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_response.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_response.py index 393bb5a42425..2ac1ada6e9b3 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_response.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_response.py @@ -14,7 +14,7 @@ class ApiResponse(BaseModel, Generic[T]): status_code: StrictInt = Field(description="HTTP status code") headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") data: T = Field(description="Deserialized data given the data type") - raw_data: Optional[StrictBytes] = Field(description="Raw data (HTTP response body)") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") model_config = { "arbitrary_types_allowed": True diff --git a/samples/client/echo_api/python/openapi_client/api_client.py b/samples/client/echo_api/python/openapi_client/api_client.py index 30d89d397037..5ca4547e5e38 100644 --- a/samples/client/echo_api/python/openapi_client/api_client.py +++ b/samples/client/echo_api/python/openapi_client/api_client.py @@ -289,6 +289,8 @@ def response_deserialize( :return: ApiResponse """ + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg response_type = response_types_map.get(str(response_data.status), None) if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: @@ -309,10 +311,7 @@ def response_deserialize( 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" - if response_data.data is None: # should not happen - response_text = "" - else: - response_text = response_data.data.decode(encoding) + response_text = response_data.data.decode(encoding) return_data = self.deserialize(response_text, response_type) finally: if not 200 <= response_data.status <= 299: diff --git a/samples/client/echo_api/python/openapi_client/api_response.py b/samples/client/echo_api/python/openapi_client/api_response.py index 393bb5a42425..2ac1ada6e9b3 100644 --- a/samples/client/echo_api/python/openapi_client/api_response.py +++ b/samples/client/echo_api/python/openapi_client/api_response.py @@ -14,7 +14,7 @@ class ApiResponse(BaseModel, Generic[T]): status_code: StrictInt = Field(description="HTTP status code") headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") data: T = Field(description="Deserialized data given the data type") - raw_data: Optional[StrictBytes] = Field(description="Raw data (HTTP response body)") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") model_config = { "arbitrary_types_allowed": True diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py index 10307e7732d0..4f70a6b0424a 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py @@ -291,6 +291,8 @@ def response_deserialize( :return: ApiResponse """ + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg response_type = response_types_map.get(str(response_data.status), None) if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: @@ -311,10 +313,7 @@ def response_deserialize( 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" - if response_data.data is None: # should not happen - response_text = "" - else: - response_text = response_data.data.decode(encoding) + response_text = response_data.data.decode(encoding) return_data = self.deserialize(response_text, response_type) finally: if not 200 <= response_data.status <= 299: diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_response.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_response.py index 393bb5a42425..2ac1ada6e9b3 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_response.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_response.py @@ -14,7 +14,7 @@ class ApiResponse(BaseModel, Generic[T]): status_code: StrictInt = Field(description="HTTP status code") headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") data: T = Field(description="Deserialized data given the data type") - raw_data: Optional[StrictBytes] = Field(description="Raw data (HTTP response body)") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") model_config = { "arbitrary_types_allowed": True diff --git a/samples/openapi3/client/petstore/python/petstore_api/api_client.py b/samples/openapi3/client/petstore/python/petstore_api/api_client.py index 77daa96b83e1..8ad4abde83f5 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_client.py @@ -288,6 +288,8 @@ def response_deserialize( :return: ApiResponse """ + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg response_type = response_types_map.get(str(response_data.status), None) if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: @@ -308,10 +310,7 @@ def response_deserialize( 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" - if response_data.data is None: # should not happen - response_text = "" - else: - response_text = response_data.data.decode(encoding) + response_text = response_data.data.decode(encoding) return_data = self.deserialize(response_text, response_type) finally: if not 200 <= response_data.status <= 299: diff --git a/samples/openapi3/client/petstore/python/petstore_api/api_response.py b/samples/openapi3/client/petstore/python/petstore_api/api_response.py index 393bb5a42425..2ac1ada6e9b3 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api_response.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_response.py @@ -14,7 +14,7 @@ class ApiResponse(BaseModel, Generic[T]): status_code: StrictInt = Field(description="HTTP status code") headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") data: T = Field(description="Deserialized data given the data type") - raw_data: Optional[StrictBytes] = Field(description="Raw data (HTTP response body)") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") model_config = { "arbitrary_types_allowed": True From 5861b4bf12487965a5a12185906a003e2f7aae97 Mon Sep 17 00:00:00 2001 From: Jonathan Ballet Date: Tue, 2 Jan 2024 14:03:39 +0100 Subject: [PATCH 3/8] Fix indentation --- .../src/main/resources/python/model_generic.mustache | 2 +- .../openapi_client/models/pet.py | 2 +- samples/client/echo_api/python/openapi_client/models/pet.py | 2 +- .../petstore_api/models/file_schema_test_class.py | 2 +- .../client/petstore/python-aiohttp/petstore_api/models/pet.py | 2 +- .../python/petstore_api/models/file_schema_test_class.py | 2 +- .../openapi3/client/petstore/python/petstore_api/models/pet.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python/model_generic.mustache b/modules/openapi-generator/src/main/resources/python/model_generic.mustache index dd8626777526..da978b15de1a 100644 --- a/modules/openapi-generator/src/main/resources/python/model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_generic.mustache @@ -293,7 +293,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} "{{{baseName}}}": obj.get("{{{baseName}}}"){{^-last}},{{/-last}} {{/items.isEnumOrRef}} {{^items.isEnumOrRef}} - "{{{baseName}}}": [{{{items.dataType}}}.from_dict(_item) for _item in obj["{{{baseName}}}"]] if obj.get("{{{baseName}}}") is not None else None{{^-last}},{{/-last}} + "{{{baseName}}}": [{{{items.dataType}}}.from_dict(_item) for _item in obj["{{{baseName}}}"]] if obj.get("{{{baseName}}}") is not None else None{{^-last}},{{/-last}} {{/items.isEnumOrRef}} {{/items.isPrimitiveType}} {{#items.isPrimitiveType}} diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/pet.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/pet.py index fb54cd096541..14f46778f9d2 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/pet.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/models/pet.py @@ -119,7 +119,7 @@ def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: "name": obj.get("name"), "category": Category.from_dict(obj["category"]) if obj.get("category") is not None else None, "photoUrls": obj.get("photoUrls"), - "tags": [Tag.from_dict(_item) for _item in obj["tags"]] if obj.get("tags") is not None else None, + "tags": [Tag.from_dict(_item) for _item in obj["tags"]] if obj.get("tags") is not None else None, "status": obj.get("status") }) return _obj diff --git a/samples/client/echo_api/python/openapi_client/models/pet.py b/samples/client/echo_api/python/openapi_client/models/pet.py index 8e92491cdf7d..f8450e7a15a4 100644 --- a/samples/client/echo_api/python/openapi_client/models/pet.py +++ b/samples/client/echo_api/python/openapi_client/models/pet.py @@ -114,7 +114,7 @@ def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: "name": obj.get("name"), "category": Category.from_dict(obj["category"]) if obj.get("category") is not None else None, "photoUrls": obj.get("photoUrls"), - "tags": [Tag.from_dict(_item) for _item in obj["tags"]] if obj.get("tags") is not None else None, + "tags": [Tag.from_dict(_item) for _item in obj["tags"]] if obj.get("tags") is not None else None, "status": obj.get("status") }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file_schema_test_class.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file_schema_test_class.py index 66000227a609..5b815fe87dad 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file_schema_test_class.py @@ -94,7 +94,7 @@ def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: _obj = cls.model_validate({ "file": File.from_dict(obj["file"]) if obj.get("file") is not None else None, - "files": [File.from_dict(_item) for _item in obj["files"]] if obj.get("files") is not None else None + "files": [File.from_dict(_item) for _item in obj["files"]] if obj.get("files") is not None else None }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pet.py index 2ba940dbe727..4b264c3402ef 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pet.py @@ -114,7 +114,7 @@ def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: "category": Category.from_dict(obj["category"]) if obj.get("category") is not None else None, "name": obj.get("name"), "photoUrls": obj.get("photoUrls"), - "tags": [Tag.from_dict(_item) for _item in obj["tags"]] if obj.get("tags") is not None else None, + "tags": [Tag.from_dict(_item) for _item in obj["tags"]] if obj.get("tags") is not None else None, "status": obj.get("status") }) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/file_schema_test_class.py b/samples/openapi3/client/petstore/python/petstore_api/models/file_schema_test_class.py index 9267315e8629..164781ac01bc 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/file_schema_test_class.py @@ -102,7 +102,7 @@ def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: _obj = cls.model_validate({ "file": File.from_dict(obj["file"]) if obj.get("file") is not None else None, - "files": [File.from_dict(_item) for _item in obj["files"]] if obj.get("files") is not None else None + "files": [File.from_dict(_item) for _item in obj["files"]] if obj.get("files") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python/petstore_api/models/pet.py index 5b360aa4cd24..5be0cac17012 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/pet.py @@ -122,7 +122,7 @@ def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: "category": Category.from_dict(obj["category"]) if obj.get("category") is not None else None, "name": obj.get("name"), "photoUrls": obj.get("photoUrls"), - "tags": [Tag.from_dict(_item) for _item in obj["tags"]] if obj.get("tags") is not None else None, + "tags": [Tag.from_dict(_item) for _item in obj["tags"]] if obj.get("tags") is not None else None, "status": obj.get("status") }) # store additional fields in additional_properties From 0c7b22ede34b34dea3e0111d74108f3bec7db256 Mon Sep 17 00:00:00 2001 From: Jonathan Ballet Date: Tue, 2 Jan 2024 14:05:02 +0100 Subject: [PATCH 4/8] Revert test changes --- .../petstore/python/tests/test_color_model.py | 151 ------------------ .../petstore/python/tests/test_model.py | 127 ++++++++++++++- 2 files changed, 126 insertions(+), 152 deletions(-) delete mode 100644 samples/openapi3/client/petstore/python/tests/test_color_model.py diff --git a/samples/openapi3/client/petstore/python/tests/test_color_model.py b/samples/openapi3/client/petstore/python/tests/test_color_model.py deleted file mode 100644 index cf31afce6e33..000000000000 --- a/samples/openapi3/client/petstore/python/tests/test_color_model.py +++ /dev/null @@ -1,151 +0,0 @@ -# coding: utf-8 - -# flake8: noqa - -import json -import os -import time -import unittest - -from pydantic import ValidationError -import pytest - -import petstore_api -from petstore_api import InnerDictWithProperty - - -class ColorModelTests(unittest.TestCase): - def test_oneof_schema_2_validator(self): - array_of_integers = [12, 34, 56] - c = petstore_api.Color() - - try: - c.oneof_schema_2_validator = array_of_integers - self.fail(f"Should have failed: {c.oneof_schema_2_validator}") - except ValueError as e: - self.assertTrue("List should have at least 4 items after validation, not 3" in str(e)) - - def test_new_null(self): - c = petstore_api.Color() - self.assertEqual("null", c.to_json()) - self.assertEqual(None, c.actual_instance) - - def test_oneof_validator(self): - array_of_integers = [12, 34, 56] - c = petstore_api.Color() - - # no error should be thrown - c.oneof_schema_1_validator = array_of_integers - c.actual_instance = array_of_integers - c.actual_instance = None - - # test the oneof schema validator with invalid input - array_of_integers = [12,34,56120938] - try: - c.oneof_schema_1_validator = array_of_integers - self.fail(f"Should have failed: {c.oneof_schema_1_validator}") - except ValueError as e: - self.assertTrue("Input should be less than or equal to 255" in str(e)) - - try: - c.actual_instance = array_of_integers - self.fail(f"Should have failed: {c.actual_instance}") - except ValueError as e: - self.assertTrue("Input should be less than or equal to 255" in str(e)) - - def test_from_json(self): - json_str = '[12,34,56]' - c = petstore_api.Color.from_json(json_str) - self.assertEqual(c.actual_instance, [12, 34, 56]) - - try: - c = petstore_api.Color.from_json('[2342112,0,0,0]') - except ValueError as e: - self.assertTrue("Input should be less than or equal to 255" in str(e)) - - def test_to_json(self): - json_str = '[12,34,56]' - c = petstore_api.Color.from_json(json_str) - self.assertEqual(c.to_json(), "[12, 34, 56]") - - def test_to_dict(self): - json_str = '[12,34,56]' - c = petstore_api.Color.from_json(json_str) - self.assertEqual(c.to_dict(), [12, 34, 56]) - - def test_nullable(self): - c = petstore_api.Color.from_json(None) - self.assertEqual(c.actual_instance, None) - - def test_constraint_rgb(self): - rgb = [128, 128, 128] - color = petstore_api.Color(oneof_schema_1_validator=rgb) - self.assertEqual(rgb, color.oneof_schema_1_validator) - - try: - petstore_api.Color(oneof_schema_2_validator=rgb) - self.fail("invalid validation") - except ValidationError as e: - self.assertIn("List should have at least 4 items after validation, not 3", str(e)) - - def test_constraint_rgba(self): - rgba = [128, 128, 128, 128] - color = petstore_api.Color(oneof_schema_2_validator=rgba) - self.assertEqual(rgba, color.oneof_schema_2_validator) - - try: - petstore_api.Color(oneof_schema_1_validator=rgba) - self.fail("invalid validation") - except ValidationError as e: - self.assertIn("List should have at most 3 items after validation, not 4", str(e)) - - def test_constraint_hex(self): - hex_color = "#00FF00" - color = petstore_api.Color(oneof_schema_3_validator=hex_color) - self.assertEqual(hex_color, color.oneof_schema_3_validator) - - try: - petstore_api.Color(oneof_schema_3_validator="too long string") - self.fail("invalid validation") - except ValidationError as e: - self.assertIn("String should have at most 7 characters", str(e)) - - -class AnyOfColorModelTests(unittest.TestCase): - def test_new_null(self): - c = petstore_api.AnyOfColor() - self.assertEqual("null", c.to_json()) - self.assertEqual(None, c.actual_instance) - - def test_anyof_array_of_integers(self): - array_of_integers = [12,34,56] - c = petstore_api.AnyOfColor() - - # no error should be thrown - c.anyof_schema_1_validator = array_of_integers - c.actual_instance = array_of_integers - - # test the oneof schema validator with invalid input - array_of_integers = [12,34,56120938] - try: - c.anyof_schema_1_validator = array_of_integers - self.fail(f"Should have failed: {c.anyof_schema_1_validator}") - except ValueError as e: - self.assertIn("Input should be less than or equal to 255", str(e)) - - try: - c.actual_instance = array_of_integers - self.fail(f"Should have failed: {c.actual_instance}") - except ValueError as e: - self.assertIn("Input should be less than or equal to 255", str(e)) - - def test_from_json(self): - json_str = '[12,34,56]' - c = petstore_api.AnyOfColor.from_json(json_str) - self.assertEqual(c.actual_instance, [12, 34,56]) - - try: - c = petstore_api.AnyOfColor.from_json('[2342112,0,0,0]') - self.fail(f"Should have failed: {c.from_json}") - except ValueError as e: - self.assertIn("Input should be less than or equal to 255", str(e)) diff --git a/samples/openapi3/client/petstore/python/tests/test_model.py b/samples/openapi3/client/petstore/python/tests/test_model.py index 83588a7aac3b..b06eeaa0831f 100644 --- a/samples/openapi3/client/petstore/python/tests/test_model.py +++ b/samples/openapi3/client/petstore/python/tests/test_model.py @@ -77,6 +77,62 @@ def test_equal(self): self.pet1.tags = [] self.assertFalse(self.pet1 == self.pet2) + def test_oneof_schema_2_validator(self): + new_color = petstore_api.Color() + array_of_integers = [12, 34, 56] + + try: + new_color.oneof_schema_2_validator = array_of_integers + self.fail(f"Should have failed: {new_color.oneof_schema_2_validator}") + except ValueError as e: + self.assertTrue("List should have at least 4 items after validation, not 3" in str(e)) + + def test_oneOf_array_of_integers(self): + # test new Color + new_color = petstore_api.Color() + self.assertEqual("null", new_color.to_json()) + self.assertEqual(None, new_color.actual_instance) + + # test the oneof schema validator + json_str = '[12,34,56]' + array_of_integers = json.loads(json_str) + # no error should be thrown + new_color.oneof_schema_1_validator = array_of_integers + new_color.actual_instance = array_of_integers + new_color.actual_instance = None + + # test the oneof schema validator with invalid input + json_str = '[12,34,56120938]' + array_of_integers = json.loads(json_str) + try: + new_color.oneof_schema_1_validator = array_of_integers + except ValueError as e: + self.assertTrue("Input should be less than or equal to 255" in str(e)) + + try: + new_color.actual_instance = array_of_integers + except ValueError as e: + self.assertTrue("Input should be less than or equal to 255" in str(e)) + + # test from_josn + json_str = '[12,34,56]' + p = petstore_api.Color.from_json(json_str) + self.assertEqual(p.actual_instance, [12, 34, 56]) + + try: + p = petstore_api.Color.from_json('[2342112,0,0,0]') + except ValueError as e: + self.assertTrue("Input should be less than or equal to 255" in str(e)) + + # test to_json, to_dict method + json_str = '[12,34,56]' + p = petstore_api.Color.from_json(json_str) + self.assertEqual(p.to_json(), "[12, 34, 56]") + self.assertEqual(p.to_dict(), [12, 34, 56]) + + # test nullable + p = petstore_api.Color.from_json(None) + self.assertEqual(p.actual_instance, None) def test_oneof_enum_string(self): enum_string1 = petstore_api.EnumString1('a') @@ -109,6 +165,42 @@ def test_oneof_enum_string(self): constructor3 = petstore_api.OneOfEnumString() self.assertEqual(constructor3.actual_instance, None) + def test_anyOf_array_of_integers(self): + # test new Color + new_color = petstore_api.AnyOfColor() + self.assertEqual("null", new_color.to_json()) + self.assertEqual(None, new_color.actual_instance) + + # test the oneof schema validator + json_str = '[12,34,56]' + array_of_integers = json.loads(json_str) + # no error should be thrown + new_color.anyof_schema_1_validator = array_of_integers + new_color.actual_instance = array_of_integers + + # test the oneof schema validator with invalid input + json_str = '[12,34,56120938]' + array_of_integers = json.loads(json_str) + try: + new_color.anyof_schema_1_validator = array_of_integers + except ValueError as e: + self.assertIn("Input should be less than or equal to 255", str(e)) + + try: + new_color.actual_instance = array_of_integers + except ValueError as e: + self.assertIn("Input should be less than or equal to 255", str(e)) + + # test from_josn + json_str = '[12,34,56]' + p = petstore_api.AnyOfColor.from_json(json_str) + self.assertEqual(p.actual_instance, [12, 34,56]) + + try: + p = petstore_api.AnyOfColor.from_json('[2342112,0,0,0]') + except ValueError as e: + self.assertIn("Input should be less than or equal to 255", str(e)) + def test_oneOf(self): # test new Pig bp = petstore_api.BasquePig.from_dict({"className": "BasquePig", "color": "red"}) @@ -301,7 +393,7 @@ def test_valdiator(self): self.assertEqual(a.pattern_with_digits_and_delimiter, "image_123") # test sanitize for serializaation with SecretStr (format: password) - self.assertEqual(petstore_api.ApiClient().sanitize_for_serialization(a), {'byte': b'string', 'date': '2013-09-17', 'number': 123.45, 'password': 'testing09876', 'pattern_with_digits_and_delimiter': 'image_123'}) + self.assertEquals(petstore_api.ApiClient().sanitize_for_serialization(a), {'byte': b'string', 'date': '2013-09-17', 'number': 123.45, 'password': 'testing09876', 'pattern_with_digits_and_delimiter': 'image_123'}) def test_inline_enum_validator(self): self.pet = petstore_api.Pet(name="test name", photoUrls=["string"]) @@ -312,6 +404,39 @@ def test_inline_enum_validator(self): except ValueError as e: self.assertTrue("must be one of enum values ('available', 'pending', 'sold')" in str(e)) + def test_constraints(self): + rgb = [128, 128, 128] + rgba = [128, 128, 128, 128] + hex_color = "#00FF00" + + # These should all pass + color = petstore_api.Color(oneof_schema_1_validator=rgb) + self.assertEqual(rgb, color.oneof_schema_1_validator) + + color = petstore_api.Color(oneof_schema_2_validator=rgba) + self.assertEqual(rgba, color.oneof_schema_2_validator) + + color = petstore_api.Color(oneof_schema_3_validator=hex_color) + self.assertEqual(hex_color, color.oneof_schema_3_validator) + + try: + petstore_api.Color(oneof_schema_1_validator=rgba) + self.fail("invalid validation") + except ValidationError as e: + self.assertIn("List should have at most 3 items after validation, not 4", str(e)) + + try: + petstore_api.Color(oneof_schema_2_validator=rgb) + self.fail("invalid validation") + except ValidationError as e: + self.assertIn("List should have at least 4 items after validation, not 3", str(e)) + + try: + petstore_api.Color(oneof_schema_3_validator="too long string") + self.fail("invalid validation") + except ValidationError as e: + self.assertIn("String should have at most 7 characters", str(e)) + def test_object_id(self): pet_ap = petstore_api.Pet(name="test name", photoUrls=["string"]) pet_ap2 = petstore_api.Pet(name="test name", photoUrls=["string"]) From 545a200896508cff93ee1a39e3c46fc091c1c75c Mon Sep 17 00:00:00 2001 From: Jonathan Ballet Date: Tue, 2 Jan 2024 18:25:37 +0100 Subject: [PATCH 5/8] run mypy on tests/ directory --- .../main/resources/python/pyproject.mustache | 6 +- .../pyproject.toml | 6 +- .../tests/__init__.py | 0 .../{test => tests}/test_manual.py | 0 samples/client/echo_api/python/pyproject.toml | 6 +- .../client/echo_api/python/tests/__init__.py | 0 .../python/{test => tests}/test_manual.py | 0 .../petstore/python-aiohttp/pyproject.toml | 6 +- .../client/petstore/python/poetry.lock | 671 ++++++++++++++++++ .../client/petstore/python/pyproject.toml | 6 +- .../petstore/python/tests/test_model.py | 4 +- 11 files changed, 699 insertions(+), 6 deletions(-) create mode 100644 samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/tests/__init__.py rename samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/{test => tests}/test_manual.py (100%) create mode 100644 samples/client/echo_api/python/tests/__init__.py rename samples/client/echo_api/python/{test => tests}/test_manual.py (100%) create mode 100644 samples/openapi3/client/petstore/python/poetry.lock diff --git a/modules/openapi-generator/src/main/resources/python/pyproject.mustache b/modules/openapi-generator/src/main/resources/python/pyproject.mustache index 8c8116cff622..2adaca6a3150 100644 --- a/modules/openapi-generator/src/main/resources/python/pyproject.mustache +++ b/modules/openapi-generator/src/main/resources/python/pyproject.mustache @@ -44,4 +44,8 @@ build-backend = "setuptools.build_meta" extension-pkg-whitelist = "pydantic" [tool.mypy] -files = ["{{{packageName}}}"] +files = [ + "{{{packageName}}}", + #"test", # auto-generated tests + "tests", # hand-written tests +] diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/pyproject.toml b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/pyproject.toml index 1d4cc5350dc8..9f72c3560d68 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/pyproject.toml +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/pyproject.toml @@ -33,4 +33,8 @@ build-backend = "setuptools.build_meta" extension-pkg-whitelist = "pydantic" [tool.mypy] -files = ["openapi_client"] +files = [ + "openapi_client", + #"test", # auto-generated tests + "tests", # hand-written tests +] diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/tests/__init__.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/tests/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/test/test_manual.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/tests/test_manual.py similarity index 100% rename from samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/test/test_manual.py rename to samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/tests/test_manual.py diff --git a/samples/client/echo_api/python/pyproject.toml b/samples/client/echo_api/python/pyproject.toml index 1d4cc5350dc8..9f72c3560d68 100644 --- a/samples/client/echo_api/python/pyproject.toml +++ b/samples/client/echo_api/python/pyproject.toml @@ -33,4 +33,8 @@ build-backend = "setuptools.build_meta" extension-pkg-whitelist = "pydantic" [tool.mypy] -files = ["openapi_client"] +files = [ + "openapi_client", + #"test", # auto-generated tests + "tests", # hand-written tests +] diff --git a/samples/client/echo_api/python/tests/__init__.py b/samples/client/echo_api/python/tests/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/samples/client/echo_api/python/test/test_manual.py b/samples/client/echo_api/python/tests/test_manual.py similarity index 100% rename from samples/client/echo_api/python/test/test_manual.py rename to samples/client/echo_api/python/tests/test_manual.py diff --git a/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml b/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml index 01bb26be430c..8a61c2d138aa 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml +++ b/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml @@ -37,4 +37,8 @@ build-backend = "setuptools.build_meta" extension-pkg-whitelist = "pydantic" [tool.mypy] -files = ["petstore_api"] +files = [ + "petstore_api", + #"test", # auto-generated tests + "tests", # hand-written tests +] diff --git a/samples/openapi3/client/petstore/python/poetry.lock b/samples/openapi3/client/petstore/python/poetry.lock new file mode 100644 index 000000000000..2e5a00ee1120 --- /dev/null +++ b/samples/openapi3/client/petstore/python/poetry.lock @@ -0,0 +1,671 @@ +# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. + +[[package]] +name = "annotated-types" +version = "0.5.0" +description = "Reusable constraint types to use with typing.Annotated" +optional = false +python-versions = ">=3.7" +files = [ + {file = "annotated_types-0.5.0-py3-none-any.whl", hash = "sha256:58da39888f92c276ad970249761ebea80ba544b77acddaa1a4d6cf78287d45fd"}, + {file = "annotated_types-0.5.0.tar.gz", hash = "sha256:47cdc3490d9ac1506ce92c7aaa76c579dc3509ff11e098fc867e5130ab7be802"}, +] + +[package.dependencies] +typing-extensions = {version = ">=4.0.0", markers = "python_version < \"3.9\""} + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "distlib" +version = "0.3.8" +description = "Distribution utilities" +optional = false +python-versions = "*" +files = [ + {file = "distlib-0.3.8-py2.py3-none-any.whl", hash = "sha256:034db59a0b96f8ca18035f36290806a9a6e6bd9d1ff91e45a7f172eb17e51784"}, + {file = "distlib-0.3.8.tar.gz", hash = "sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64"}, +] + +[[package]] +name = "exceptiongroup" +version = "1.2.0" +description = "Backport of PEP 654 (exception groups)" +optional = false +python-versions = ">=3.7" +files = [ + {file = "exceptiongroup-1.2.0-py3-none-any.whl", hash = "sha256:4bfd3996ac73b41e9b9628b04e079f193850720ea5945fc96a08633c66912f14"}, + {file = "exceptiongroup-1.2.0.tar.gz", hash = "sha256:91f5c769735f051a4290d52edd0858999b57e5876e9f85937691bd4c9fa3ed68"}, +] + +[package.extras] +test = ["pytest (>=6)"] + +[[package]] +name = "filelock" +version = "3.12.2" +description = "A platform independent file lock." +optional = false +python-versions = ">=3.7" +files = [ + {file = "filelock-3.12.2-py3-none-any.whl", hash = "sha256:cbb791cdea2a72f23da6ac5b5269ab0a0d161e9ef0100e653b69049a7706d1ec"}, + {file = "filelock-3.12.2.tar.gz", hash = "sha256:002740518d8aa59a26b0c76e10fb8c6e15eae825d34b6fdf670333fd7b938d81"}, +] + +[package.extras] +docs = ["furo (>=2023.5.20)", "sphinx (>=7.0.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "diff-cover (>=7.5)", "pytest (>=7.3.1)", "pytest-cov (>=4.1)", "pytest-mock (>=3.10)", "pytest-timeout (>=2.1)"] + +[[package]] +name = "flake8" +version = "5.0.4" +description = "the modular source code checker: pep8 pyflakes and co" +optional = false +python-versions = ">=3.6.1" +files = [ + {file = "flake8-5.0.4-py2.py3-none-any.whl", hash = "sha256:7a1cf6b73744f5806ab95e526f6f0d8c01c66d7bbe349562d22dfca20610b248"}, + {file = "flake8-5.0.4.tar.gz", hash = "sha256:6fbe320aad8d6b95cec8b8e47bc933004678dc63095be98528b7bdd2a9f510db"}, +] + +[package.dependencies] +importlib-metadata = {version = ">=1.1.0,<4.3", markers = "python_version < \"3.8\""} +mccabe = ">=0.7.0,<0.8.0" +pycodestyle = ">=2.9.0,<2.10.0" +pyflakes = ">=2.5.0,<2.6.0" + +[[package]] +name = "importlib-metadata" +version = "4.2.0" +description = "Read metadata from Python packages" +optional = false +python-versions = ">=3.6" +files = [ + {file = "importlib_metadata-4.2.0-py3-none-any.whl", hash = "sha256:057e92c15bc8d9e8109738a48db0ccb31b4d9d5cfbee5a8670879a30be66304b"}, + {file = "importlib_metadata-4.2.0.tar.gz", hash = "sha256:b7e52a1f8dec14a75ea73e0891f3060099ca1d8e6a462a4dff11c3e119ea1b31"}, +] + +[package.dependencies] +typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} +zipp = ">=0.5" + +[package.extras] +docs = ["jaraco.packaging (>=8.2)", "rst.linker (>=1.9)", "sphinx"] +testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pep517", "pyfakefs", "pytest (>=4.6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-flake8", "pytest-mypy"] + +[[package]] +name = "iniconfig" +version = "2.0.0" +description = "brain-dead simple config-ini parsing" +optional = false +python-versions = ">=3.7" +files = [ + {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, + {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, +] + +[[package]] +name = "mccabe" +version = "0.7.0" +description = "McCabe checker, plugin for flake8" +optional = false +python-versions = ">=3.6" +files = [ + {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, + {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, +] + +[[package]] +name = "mypy" +version = "1.4.1" +description = "Optional static typing for Python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "mypy-1.4.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:566e72b0cd6598503e48ea610e0052d1b8168e60a46e0bfd34b3acf2d57f96a8"}, + {file = "mypy-1.4.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:ca637024ca67ab24a7fd6f65d280572c3794665eaf5edcc7e90a866544076878"}, + {file = "mypy-1.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0dde1d180cd84f0624c5dcaaa89c89775550a675aff96b5848de78fb11adabcd"}, + {file = "mypy-1.4.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:8c4d8e89aa7de683e2056a581ce63c46a0c41e31bd2b6d34144e2c80f5ea53dc"}, + {file = "mypy-1.4.1-cp310-cp310-win_amd64.whl", hash = "sha256:bfdca17c36ae01a21274a3c387a63aa1aafe72bff976522886869ef131b937f1"}, + {file = "mypy-1.4.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7549fbf655e5825d787bbc9ecf6028731973f78088fbca3a1f4145c39ef09462"}, + {file = "mypy-1.4.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:98324ec3ecf12296e6422939e54763faedbfcc502ea4a4c38502082711867258"}, + {file = "mypy-1.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:141dedfdbfe8a04142881ff30ce6e6653c9685b354876b12e4fe6c78598b45e2"}, + {file = "mypy-1.4.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:8207b7105829eca6f3d774f64a904190bb2231de91b8b186d21ffd98005f14a7"}, + {file = "mypy-1.4.1-cp311-cp311-win_amd64.whl", hash = "sha256:16f0db5b641ba159eff72cff08edc3875f2b62b2fa2bc24f68c1e7a4e8232d01"}, + {file = "mypy-1.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:470c969bb3f9a9efcedbadcd19a74ffb34a25f8e6b0e02dae7c0e71f8372f97b"}, + {file = "mypy-1.4.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e5952d2d18b79f7dc25e62e014fe5a23eb1a3d2bc66318df8988a01b1a037c5b"}, + {file = "mypy-1.4.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:190b6bab0302cec4e9e6767d3eb66085aef2a1cc98fe04936d8a42ed2ba77bb7"}, + {file = "mypy-1.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:9d40652cc4fe33871ad3338581dca3297ff5f2213d0df345bcfbde5162abf0c9"}, + {file = "mypy-1.4.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:01fd2e9f85622d981fd9063bfaef1aed6e336eaacca00892cd2d82801ab7c042"}, + {file = "mypy-1.4.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:2460a58faeea905aeb1b9b36f5065f2dc9a9c6e4c992a6499a2360c6c74ceca3"}, + {file = "mypy-1.4.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a2746d69a8196698146a3dbe29104f9eb6a2a4d8a27878d92169a6c0b74435b6"}, + {file = "mypy-1.4.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:ae704dcfaa180ff7c4cfbad23e74321a2b774f92ca77fd94ce1049175a21c97f"}, + {file = "mypy-1.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:43d24f6437925ce50139a310a64b2ab048cb2d3694c84c71c3f2a1626d8101dc"}, + {file = "mypy-1.4.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c482e1246726616088532b5e964e39765b6d1520791348e6c9dc3af25b233828"}, + {file = "mypy-1.4.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:43b592511672017f5b1a483527fd2684347fdffc041c9ef53428c8dc530f79a3"}, + {file = "mypy-1.4.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:34a9239d5b3502c17f07fd7c0b2ae6b7dd7d7f6af35fbb5072c6208e76295816"}, + {file = "mypy-1.4.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5703097c4936bbb9e9bce41478c8d08edd2865e177dc4c52be759f81ee4dd26c"}, + {file = "mypy-1.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:e02d700ec8d9b1859790c0475df4e4092c7bf3272a4fd2c9f33d87fac4427b8f"}, + {file = "mypy-1.4.1-py3-none-any.whl", hash = "sha256:45d32cec14e7b97af848bddd97d85ea4f0db4d5a149ed9676caa4eb2f7402bb4"}, + {file = "mypy-1.4.1.tar.gz", hash = "sha256:9bbcd9ab8ea1f2e1c8031c21445b511442cc45c89951e49bbf852cbb70755b1b"}, +] + +[package.dependencies] +mypy-extensions = ">=1.0.0" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typed-ast = {version = ">=1.4.0,<2", markers = "python_version < \"3.8\""} +typing-extensions = ">=4.1.0" + +[package.extras] +dmypy = ["psutil (>=4.0)"] +install-types = ["pip"] +python2 = ["typed-ast (>=1.4.0,<2)"] +reports = ["lxml"] + +[[package]] +name = "mypy-extensions" +version = "1.0.0" +description = "Type system extensions for programs checked with the mypy type checker." +optional = false +python-versions = ">=3.5" +files = [ + {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, + {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, +] + +[[package]] +name = "packaging" +version = "23.2" +description = "Core utilities for Python packages" +optional = false +python-versions = ">=3.7" +files = [ + {file = "packaging-23.2-py3-none-any.whl", hash = "sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7"}, + {file = "packaging-23.2.tar.gz", hash = "sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5"}, +] + +[[package]] +name = "pem" +version = "21.2.0" +description = "Easy PEM file parsing in Python." +optional = false +python-versions = "*" +files = [ + {file = "pem-21.2.0-py2.py3-none-any.whl", hash = "sha256:64afb669f05502c071d0706ee66e51471718ae248ba39624919da7b4ea73506e"}, + {file = "pem-21.2.0.tar.gz", hash = "sha256:c491833b092662626fd58a87375d450637d4ee94996ad9bbbd42593428e93e5a"}, +] + +[package.extras] +dev = ["certifi", "coverage[toml] (>=5.0.2)", "furo", "pre-commit", "pretend", "pyopenssl", "pytest", "sphinx", "twisted[tls]"] +docs = ["furo", "sphinx"] +tests = ["certifi", "coverage[toml] (>=5.0.2)", "pretend", "pyopenssl", "pytest"] + +[[package]] +name = "platformdirs" +version = "2.6.2" +description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +optional = false +python-versions = ">=3.7" +files = [ + {file = "platformdirs-2.6.2-py3-none-any.whl", hash = "sha256:83c8f6d04389165de7c9b6f0c682439697887bca0aa2f1c87ef1826be3584490"}, + {file = "platformdirs-2.6.2.tar.gz", hash = "sha256:e1fea1fe471b9ff8332e229df3cb7de4f53eeea4998d3b6bfff542115e998bd2"}, +] + +[package.dependencies] +typing-extensions = {version = ">=4.4", markers = "python_version < \"3.8\""} + +[package.extras] +docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=5.3)", "sphinx-autodoc-typehints (>=1.19.5)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.2.2)", "pytest (>=7.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] + +[[package]] +name = "pluggy" +version = "1.2.0" +description = "plugin and hook calling mechanisms for python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pluggy-1.2.0-py3-none-any.whl", hash = "sha256:c2fd55a7d7a3863cba1a013e4e2414658b1d07b6bc57b3919e0c63c9abb99849"}, + {file = "pluggy-1.2.0.tar.gz", hash = "sha256:d12f0c4b579b15f5e054301bb226ee85eeeba08ffec228092f8defbaa3a4c4b3"}, +] + +[package.dependencies] +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} + +[package.extras] +dev = ["pre-commit", "tox"] +testing = ["pytest", "pytest-benchmark"] + +[[package]] +name = "py" +version = "1.11.0" +description = "library with cross-python path, ini-parsing, io, code, log facilities" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +files = [ + {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, + {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, +] + +[[package]] +name = "pycodestyle" +version = "2.9.1" +description = "Python style guide checker" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pycodestyle-2.9.1-py2.py3-none-any.whl", hash = "sha256:d1735fc58b418fd7c5f658d28d943854f8a849b01a5d0a1e6f3f3fdd0166804b"}, + {file = "pycodestyle-2.9.1.tar.gz", hash = "sha256:2c9607871d58c76354b697b42f5d57e1ada7d261c261efac224b664affdc5785"}, +] + +[[package]] +name = "pycryptodome" +version = "3.19.1" +description = "Cryptographic library for Python" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +files = [ + {file = "pycryptodome-3.19.1-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:694020d2ff985cd714381b9da949a21028c24b86f562526186f6af7c7547e986"}, + {file = "pycryptodome-3.19.1-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:4464b0e8fd5508bff9baf18e6fd4c6548b1ac2ce9862d6965ff6a84ec9cb302a"}, + {file = "pycryptodome-3.19.1-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:420972f9c62978e852c74055d81c354079ce3c3a2213a92c9d7e37bbc63a26e2"}, + {file = "pycryptodome-3.19.1-cp27-cp27m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c1bc0c49d986a1491d66d2a56570f12e960b12508b7e71f2423f532e28857f36"}, + {file = "pycryptodome-3.19.1-cp27-cp27m-musllinux_1_1_aarch64.whl", hash = "sha256:e038ab77fec0956d7aa989a3c647652937fc142ef41c9382c2ebd13c127d5b4a"}, + {file = "pycryptodome-3.19.1-cp27-cp27m-win32.whl", hash = "sha256:a991f8ffe8dfe708f86690948ae46442eebdd0fff07dc1b605987939a34ec979"}, + {file = "pycryptodome-3.19.1-cp27-cp27m-win_amd64.whl", hash = "sha256:2c16426ef49d9cba018be2340ea986837e1dfa25c2ea181787971654dd49aadd"}, + {file = "pycryptodome-3.19.1-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:6d0d2b97758ebf2f36c39060520447c26455acb3bcff309c28b1c816173a6ff5"}, + {file = "pycryptodome-3.19.1-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:b8b80ff92049fd042177282917d994d344365ab7e8ec2bc03e853d93d2401786"}, + {file = "pycryptodome-3.19.1-cp27-cp27mu-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cd4e7e8bf0fc1ada854688b9b309ee607e2aa85a8b44180f91021a4dd330a928"}, + {file = "pycryptodome-3.19.1-cp27-cp27mu-musllinux_1_1_aarch64.whl", hash = "sha256:8cf5d3d6cf921fa81acd1f632f6cedcc03f5f68fc50c364cd39490ba01d17c49"}, + {file = "pycryptodome-3.19.1-cp35-abi3-macosx_10_9_universal2.whl", hash = "sha256:67939a3adbe637281c611596e44500ff309d547e932c449337649921b17b6297"}, + {file = "pycryptodome-3.19.1-cp35-abi3-macosx_10_9_x86_64.whl", hash = "sha256:11ddf6c9b52116b62223b6a9f4741bc4f62bb265392a4463282f7f34bb287180"}, + {file = "pycryptodome-3.19.1-cp35-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e3e6f89480616781d2a7f981472d0cdb09b9da9e8196f43c1234eff45c915766"}, + {file = "pycryptodome-3.19.1-cp35-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:27e1efcb68993b7ce5d1d047a46a601d41281bba9f1971e6be4aa27c69ab8065"}, + {file = "pycryptodome-3.19.1-cp35-abi3-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1c6273ca5a03b672e504995529b8bae56da0ebb691d8ef141c4aa68f60765700"}, + {file = "pycryptodome-3.19.1-cp35-abi3-musllinux_1_1_aarch64.whl", hash = "sha256:b0bfe61506795877ff974f994397f0c862d037f6f1c0bfc3572195fc00833b96"}, + {file = "pycryptodome-3.19.1-cp35-abi3-musllinux_1_1_i686.whl", hash = "sha256:f34976c5c8eb79e14c7d970fb097482835be8d410a4220f86260695ede4c3e17"}, + {file = "pycryptodome-3.19.1-cp35-abi3-musllinux_1_1_x86_64.whl", hash = "sha256:7c9e222d0976f68d0cf6409cfea896676ddc1d98485d601e9508f90f60e2b0a2"}, + {file = "pycryptodome-3.19.1-cp35-abi3-win32.whl", hash = "sha256:4805e053571140cb37cf153b5c72cd324bb1e3e837cbe590a19f69b6cf85fd03"}, + {file = "pycryptodome-3.19.1-cp35-abi3-win_amd64.whl", hash = "sha256:a470237ee71a1efd63f9becebc0ad84b88ec28e6784a2047684b693f458f41b7"}, + {file = "pycryptodome-3.19.1-pp27-pypy_73-manylinux2010_x86_64.whl", hash = "sha256:ed932eb6c2b1c4391e166e1a562c9d2f020bfff44a0e1b108f67af38b390ea89"}, + {file = "pycryptodome-3.19.1-pp27-pypy_73-win32.whl", hash = "sha256:81e9d23c0316fc1b45d984a44881b220062336bbdc340aa9218e8d0656587934"}, + {file = "pycryptodome-3.19.1-pp310-pypy310_pp73-macosx_10_9_x86_64.whl", hash = "sha256:37e531bf896b70fe302f003d3be5a0a8697737a8d177967da7e23eff60d6483c"}, + {file = "pycryptodome-3.19.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cd4e95b0eb4b28251c825fe7aa941fe077f993e5ca9b855665935b86fbb1cc08"}, + {file = "pycryptodome-3.19.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c22c80246c3c880c6950d2a8addf156cee74ec0dc5757d01e8e7067a3c7da015"}, + {file = "pycryptodome-3.19.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:e70f5c839c7798743a948efa2a65d1fe96bb397fe6d7f2bde93d869fe4f0ad69"}, + {file = "pycryptodome-3.19.1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:6c3df3613592ea6afaec900fd7189d23c8c28b75b550254f4bd33fe94acb84b9"}, + {file = "pycryptodome-3.19.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:08b445799d571041765e7d5c9ca09c5d3866c2f22eeb0dd4394a4169285184f4"}, + {file = "pycryptodome-3.19.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:954d156cd50130afd53f8d77f830fe6d5801bd23e97a69d358fed068f433fbfe"}, + {file = "pycryptodome-3.19.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:b7efd46b0b4ac869046e814d83244aeab14ef787f4850644119b1c8b0ec2d637"}, + {file = "pycryptodome-3.19.1.tar.gz", hash = "sha256:8ae0dd1bcfada451c35f9e29a3e5db385caabc190f98e4a80ad02a61098fb776"}, +] + +[[package]] +name = "pydantic" +version = "2.5.3" +description = "Data validation using Python type hints" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pydantic-2.5.3-py3-none-any.whl", hash = "sha256:d0caf5954bee831b6bfe7e338c32b9e30c85dfe080c843680783ac2b631673b4"}, + {file = "pydantic-2.5.3.tar.gz", hash = "sha256:b3ef57c62535b0941697cce638c08900d87fcb67e29cfa99e8a68f747f393f7a"}, +] + +[package.dependencies] +annotated-types = ">=0.4.0" +importlib-metadata = {version = "*", markers = "python_version == \"3.7\""} +pydantic-core = "2.14.6" +typing-extensions = ">=4.6.1" + +[package.extras] +email = ["email-validator (>=2.0.0)"] + +[[package]] +name = "pydantic-core" +version = "2.14.6" +description = "" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pydantic_core-2.14.6-cp310-cp310-macosx_10_7_x86_64.whl", hash = "sha256:72f9a942d739f09cd42fffe5dc759928217649f070056f03c70df14f5770acf9"}, + {file = "pydantic_core-2.14.6-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:6a31d98c0d69776c2576dda4b77b8e0c69ad08e8b539c25c7d0ca0dc19a50d6c"}, + {file = "pydantic_core-2.14.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5aa90562bc079c6c290f0512b21768967f9968e4cfea84ea4ff5af5d917016e4"}, + {file = "pydantic_core-2.14.6-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:370ffecb5316ed23b667d99ce4debe53ea664b99cc37bfa2af47bc769056d534"}, + {file = "pydantic_core-2.14.6-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f85f3843bdb1fe80e8c206fe6eed7a1caeae897e496542cee499c374a85c6e08"}, + {file = "pydantic_core-2.14.6-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9862bf828112e19685b76ca499b379338fd4c5c269d897e218b2ae8fcb80139d"}, + {file = "pydantic_core-2.14.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:036137b5ad0cb0004c75b579445a1efccd072387a36c7f217bb8efd1afbe5245"}, + {file = "pydantic_core-2.14.6-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:92879bce89f91f4b2416eba4429c7b5ca22c45ef4a499c39f0c5c69257522c7c"}, + {file = "pydantic_core-2.14.6-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:0c08de15d50fa190d577e8591f0329a643eeaed696d7771760295998aca6bc66"}, + {file = "pydantic_core-2.14.6-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:36099c69f6b14fc2c49d7996cbf4f87ec4f0e66d1c74aa05228583225a07b590"}, + {file = "pydantic_core-2.14.6-cp310-none-win32.whl", hash = "sha256:7be719e4d2ae6c314f72844ba9d69e38dff342bc360379f7c8537c48e23034b7"}, + {file = "pydantic_core-2.14.6-cp310-none-win_amd64.whl", hash = "sha256:36fa402dcdc8ea7f1b0ddcf0df4254cc6b2e08f8cd80e7010d4c4ae6e86b2a87"}, + {file = "pydantic_core-2.14.6-cp311-cp311-macosx_10_7_x86_64.whl", hash = "sha256:dea7fcd62915fb150cdc373212141a30037e11b761fbced340e9db3379b892d4"}, + {file = "pydantic_core-2.14.6-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:ffff855100bc066ff2cd3aa4a60bc9534661816b110f0243e59503ec2df38421"}, + {file = "pydantic_core-2.14.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1b027c86c66b8627eb90e57aee1f526df77dc6d8b354ec498be9a757d513b92b"}, + {file = "pydantic_core-2.14.6-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:00b1087dabcee0b0ffd104f9f53d7d3eaddfaa314cdd6726143af6bc713aa27e"}, + {file = "pydantic_core-2.14.6-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:75ec284328b60a4e91010c1acade0c30584f28a1f345bc8f72fe8b9e46ec6a96"}, + {file = "pydantic_core-2.14.6-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7e1f4744eea1501404b20b0ac059ff7e3f96a97d3e3f48ce27a139e053bb370b"}, + {file = "pydantic_core-2.14.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b2602177668f89b38b9f84b7b3435d0a72511ddef45dc14446811759b82235a1"}, + {file = "pydantic_core-2.14.6-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6c8edaea3089bf908dd27da8f5d9e395c5b4dc092dbcce9b65e7156099b4b937"}, + {file = "pydantic_core-2.14.6-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:478e9e7b360dfec451daafe286998d4a1eeaecf6d69c427b834ae771cad4b622"}, + {file = "pydantic_core-2.14.6-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:b6ca36c12a5120bad343eef193cc0122928c5c7466121da7c20f41160ba00ba2"}, + {file = "pydantic_core-2.14.6-cp311-none-win32.whl", hash = "sha256:2b8719037e570639e6b665a4050add43134d80b687288ba3ade18b22bbb29dd2"}, + {file = "pydantic_core-2.14.6-cp311-none-win_amd64.whl", hash = "sha256:78ee52ecc088c61cce32b2d30a826f929e1708f7b9247dc3b921aec367dc1b23"}, + {file = "pydantic_core-2.14.6-cp311-none-win_arm64.whl", hash = "sha256:a19b794f8fe6569472ff77602437ec4430f9b2b9ec7a1105cfd2232f9ba355e6"}, + {file = "pydantic_core-2.14.6-cp312-cp312-macosx_10_7_x86_64.whl", hash = "sha256:667aa2eac9cd0700af1ddb38b7b1ef246d8cf94c85637cbb03d7757ca4c3fdec"}, + {file = "pydantic_core-2.14.6-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:cdee837710ef6b56ebd20245b83799fce40b265b3b406e51e8ccc5b85b9099b7"}, + {file = "pydantic_core-2.14.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2c5bcf3414367e29f83fd66f7de64509a8fd2368b1edf4351e862910727d3e51"}, + {file = "pydantic_core-2.14.6-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:26a92ae76f75d1915806b77cf459811e772d8f71fd1e4339c99750f0e7f6324f"}, + {file = "pydantic_core-2.14.6-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a983cca5ed1dd9a35e9e42ebf9f278d344603bfcb174ff99a5815f953925140a"}, + {file = "pydantic_core-2.14.6-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cb92f9061657287eded380d7dc455bbf115430b3aa4741bdc662d02977e7d0af"}, + {file = "pydantic_core-2.14.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e4ace1e220b078c8e48e82c081e35002038657e4b37d403ce940fa679e57113b"}, + {file = "pydantic_core-2.14.6-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ef633add81832f4b56d3b4c9408b43d530dfca29e68fb1b797dcb861a2c734cd"}, + {file = "pydantic_core-2.14.6-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:7e90d6cc4aad2cc1f5e16ed56e46cebf4877c62403a311af20459c15da76fd91"}, + {file = "pydantic_core-2.14.6-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:e8a5ac97ea521d7bde7621d86c30e86b798cdecd985723c4ed737a2aa9e77d0c"}, + {file = "pydantic_core-2.14.6-cp312-none-win32.whl", hash = "sha256:f27207e8ca3e5e021e2402ba942e5b4c629718e665c81b8b306f3c8b1ddbb786"}, + {file = "pydantic_core-2.14.6-cp312-none-win_amd64.whl", hash = "sha256:b3e5fe4538001bb82e2295b8d2a39356a84694c97cb73a566dc36328b9f83b40"}, + {file = "pydantic_core-2.14.6-cp312-none-win_arm64.whl", hash = "sha256:64634ccf9d671c6be242a664a33c4acf12882670b09b3f163cd00a24cffbd74e"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-macosx_10_7_x86_64.whl", hash = "sha256:24368e31be2c88bd69340fbfe741b405302993242ccb476c5c3ff48aeee1afe0"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-macosx_11_0_arm64.whl", hash = "sha256:e33b0834f1cf779aa839975f9d8755a7c2420510c0fa1e9fa0497de77cd35d2c"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6af4b3f52cc65f8a0bc8b1cd9676f8c21ef3e9132f21fed250f6958bd7223bed"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d15687d7d7f40333bd8266f3814c591c2e2cd263fa2116e314f60d82086e353a"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:095b707bb287bfd534044166ab767bec70a9bba3175dcdc3371782175c14e43c"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:94fc0e6621e07d1e91c44e016cc0b189b48db053061cc22d6298a611de8071bb"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1ce830e480f6774608dedfd4a90c42aac4a7af0a711f1b52f807130c2e434c06"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:a306cdd2ad3a7d795d8e617a58c3a2ed0f76c8496fb7621b6cd514eb1532cae8"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:2f5fa187bde8524b1e37ba894db13aadd64faa884657473b03a019f625cee9a8"}, + {file = "pydantic_core-2.14.6-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:438027a975cc213a47c5d70672e0d29776082155cfae540c4e225716586be75e"}, + {file = "pydantic_core-2.14.6-cp37-none-win32.whl", hash = "sha256:f96ae96a060a8072ceff4cfde89d261837b4294a4f28b84a28765470d502ccc6"}, + {file = "pydantic_core-2.14.6-cp37-none-win_amd64.whl", hash = "sha256:e646c0e282e960345314f42f2cea5e0b5f56938c093541ea6dbf11aec2862391"}, + {file = "pydantic_core-2.14.6-cp38-cp38-macosx_10_7_x86_64.whl", hash = "sha256:db453f2da3f59a348f514cfbfeb042393b68720787bbef2b4c6068ea362c8149"}, + {file = "pydantic_core-2.14.6-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:3860c62057acd95cc84044e758e47b18dcd8871a328ebc8ccdefd18b0d26a21b"}, + {file = "pydantic_core-2.14.6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:36026d8f99c58d7044413e1b819a67ca0e0b8ebe0f25e775e6c3d1fabb3c38fb"}, + {file = "pydantic_core-2.14.6-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8ed1af8692bd8d2a29d702f1a2e6065416d76897d726e45a1775b1444f5928a7"}, + {file = "pydantic_core-2.14.6-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:314ccc4264ce7d854941231cf71b592e30d8d368a71e50197c905874feacc8a8"}, + {file = "pydantic_core-2.14.6-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:982487f8931067a32e72d40ab6b47b1628a9c5d344be7f1a4e668fb462d2da42"}, + {file = "pydantic_core-2.14.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2dbe357bc4ddda078f79d2a36fc1dd0494a7f2fad83a0a684465b6f24b46fe80"}, + {file = "pydantic_core-2.14.6-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2f6ffc6701a0eb28648c845f4945a194dc7ab3c651f535b81793251e1185ac3d"}, + {file = "pydantic_core-2.14.6-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:7f5025db12fc6de7bc1104d826d5aee1d172f9ba6ca936bf6474c2148ac336c1"}, + {file = "pydantic_core-2.14.6-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:dab03ed811ed1c71d700ed08bde8431cf429bbe59e423394f0f4055f1ca0ea60"}, + {file = "pydantic_core-2.14.6-cp38-none-win32.whl", hash = "sha256:dfcbebdb3c4b6f739a91769aea5ed615023f3c88cb70df812849aef634c25fbe"}, + {file = "pydantic_core-2.14.6-cp38-none-win_amd64.whl", hash = "sha256:99b14dbea2fdb563d8b5a57c9badfcd72083f6006caf8e126b491519c7d64ca8"}, + {file = "pydantic_core-2.14.6-cp39-cp39-macosx_10_7_x86_64.whl", hash = "sha256:4ce8299b481bcb68e5c82002b96e411796b844d72b3e92a3fbedfe8e19813eab"}, + {file = "pydantic_core-2.14.6-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:b9a9d92f10772d2a181b5ca339dee066ab7d1c9a34ae2421b2a52556e719756f"}, + {file = "pydantic_core-2.14.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fd9e98b408384989ea4ab60206b8e100d8687da18b5c813c11e92fd8212a98e0"}, + {file = "pydantic_core-2.14.6-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4f86f1f318e56f5cbb282fe61eb84767aee743ebe32c7c0834690ebea50c0a6b"}, + {file = "pydantic_core-2.14.6-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:86ce5fcfc3accf3a07a729779d0b86c5d0309a4764c897d86c11089be61da160"}, + {file = "pydantic_core-2.14.6-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3dcf1978be02153c6a31692d4fbcc2a3f1db9da36039ead23173bc256ee3b91b"}, + {file = "pydantic_core-2.14.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eedf97be7bc3dbc8addcef4142f4b4164066df0c6f36397ae4aaed3eb187d8ab"}, + {file = "pydantic_core-2.14.6-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d5f916acf8afbcab6bacbb376ba7dc61f845367901ecd5e328fc4d4aef2fcab0"}, + {file = "pydantic_core-2.14.6-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:8a14c192c1d724c3acbfb3f10a958c55a2638391319ce8078cb36c02283959b9"}, + {file = "pydantic_core-2.14.6-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:0348b1dc6b76041516e8a854ff95b21c55f5a411c3297d2ca52f5528e49d8411"}, + {file = "pydantic_core-2.14.6-cp39-none-win32.whl", hash = "sha256:de2a0645a923ba57c5527497daf8ec5df69c6eadf869e9cd46e86349146e5975"}, + {file = "pydantic_core-2.14.6-cp39-none-win_amd64.whl", hash = "sha256:aca48506a9c20f68ee61c87f2008f81f8ee99f8d7f0104bff3c47e2d148f89d9"}, + {file = "pydantic_core-2.14.6-pp310-pypy310_pp73-macosx_10_7_x86_64.whl", hash = "sha256:d5c28525c19f5bb1e09511669bb57353d22b94cf8b65f3a8d141c389a55dec95"}, + {file = "pydantic_core-2.14.6-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:78d0768ee59baa3de0f4adac9e3748b4b1fffc52143caebddfd5ea2961595277"}, + {file = "pydantic_core-2.14.6-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8b93785eadaef932e4fe9c6e12ba67beb1b3f1e5495631419c784ab87e975670"}, + {file = "pydantic_core-2.14.6-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a874f21f87c485310944b2b2734cd6d318765bcbb7515eead33af9641816506e"}, + {file = "pydantic_core-2.14.6-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b89f4477d915ea43b4ceea6756f63f0288941b6443a2b28c69004fe07fde0d0d"}, + {file = "pydantic_core-2.14.6-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:172de779e2a153d36ee690dbc49c6db568d7b33b18dc56b69a7514aecbcf380d"}, + {file = "pydantic_core-2.14.6-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:dfcebb950aa7e667ec226a442722134539e77c575f6cfaa423f24371bb8d2e94"}, + {file = "pydantic_core-2.14.6-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:55a23dcd98c858c0db44fc5c04fc7ed81c4b4d33c653a7c45ddaebf6563a2f66"}, + {file = "pydantic_core-2.14.6-pp37-pypy37_pp73-macosx_10_7_x86_64.whl", hash = "sha256:4241204e4b36ab5ae466ecec5c4c16527a054c69f99bba20f6f75232a6a534e2"}, + {file = "pydantic_core-2.14.6-pp37-pypy37_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e574de99d735b3fc8364cba9912c2bec2da78775eba95cbb225ef7dda6acea24"}, + {file = "pydantic_core-2.14.6-pp37-pypy37_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1302a54f87b5cd8528e4d6d1bf2133b6aa7c6122ff8e9dc5220fbc1e07bffebd"}, + {file = "pydantic_core-2.14.6-pp37-pypy37_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f8e81e4b55930e5ffab4a68db1af431629cf2e4066dbdbfef65348b8ab804ea8"}, + {file = "pydantic_core-2.14.6-pp37-pypy37_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:c99462ffc538717b3e60151dfaf91125f637e801f5ab008f81c402f1dff0cd0f"}, + {file = "pydantic_core-2.14.6-pp37-pypy37_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:e4cf2d5829f6963a5483ec01578ee76d329eb5caf330ecd05b3edd697e7d768a"}, + {file = "pydantic_core-2.14.6-pp38-pypy38_pp73-macosx_10_7_x86_64.whl", hash = "sha256:cf10b7d58ae4a1f07fccbf4a0a956d705356fea05fb4c70608bb6fa81d103cda"}, + {file = "pydantic_core-2.14.6-pp38-pypy38_pp73-macosx_11_0_arm64.whl", hash = "sha256:399ac0891c284fa8eb998bcfa323f2234858f5d2efca3950ae58c8f88830f145"}, + {file = "pydantic_core-2.14.6-pp38-pypy38_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9c6a5c79b28003543db3ba67d1df336f253a87d3112dac3a51b94f7d48e4c0e1"}, + {file = "pydantic_core-2.14.6-pp38-pypy38_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:599c87d79cab2a6a2a9df4aefe0455e61e7d2aeede2f8577c1b7c0aec643ee8e"}, + {file = "pydantic_core-2.14.6-pp38-pypy38_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:43e166ad47ba900f2542a80d83f9fc65fe99eb63ceec4debec160ae729824052"}, + {file = "pydantic_core-2.14.6-pp38-pypy38_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:3a0b5db001b98e1c649dd55afa928e75aa4087e587b9524a4992316fa23c9fba"}, + {file = "pydantic_core-2.14.6-pp38-pypy38_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:747265448cb57a9f37572a488a57d873fd96bf51e5bb7edb52cfb37124516da4"}, + {file = "pydantic_core-2.14.6-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:7ebe3416785f65c28f4f9441e916bfc8a54179c8dea73c23023f7086fa601c5d"}, + {file = "pydantic_core-2.14.6-pp39-pypy39_pp73-macosx_10_7_x86_64.whl", hash = "sha256:86c963186ca5e50d5c8287b1d1c9d3f8f024cbe343d048c5bd282aec2d8641f2"}, + {file = "pydantic_core-2.14.6-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:e0641b506486f0b4cd1500a2a65740243e8670a2549bb02bc4556a83af84ae03"}, + {file = "pydantic_core-2.14.6-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:71d72ca5eaaa8d38c8df16b7deb1a2da4f650c41b58bb142f3fb75d5ad4a611f"}, + {file = "pydantic_core-2.14.6-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:27e524624eace5c59af499cd97dc18bb201dc6a7a2da24bfc66ef151c69a5f2a"}, + {file = "pydantic_core-2.14.6-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:a3dde6cac75e0b0902778978d3b1646ca9f438654395a362cb21d9ad34b24acf"}, + {file = "pydantic_core-2.14.6-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:00646784f6cd993b1e1c0e7b0fdcbccc375d539db95555477771c27555e3c556"}, + {file = "pydantic_core-2.14.6-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:23598acb8ccaa3d1d875ef3b35cb6376535095e9405d91a3d57a8c7db5d29341"}, + {file = "pydantic_core-2.14.6-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:7f41533d7e3cf9520065f610b41ac1c76bc2161415955fbcead4981b22c7611e"}, + {file = "pydantic_core-2.14.6.tar.gz", hash = "sha256:1fd0c1d395372843fba13a51c28e3bb9d59bd7aebfeb17358ffaaa1e4dbbe948"}, +] + +[package.dependencies] +typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" + +[[package]] +name = "pyflakes" +version = "2.5.0" +description = "passive checker of Python programs" +optional = false +python-versions = ">=3.6" +files = [ + {file = "pyflakes-2.5.0-py2.py3-none-any.whl", hash = "sha256:4579f67d887f804e67edb544428f264b7b24f435b263c4614f384135cea553d2"}, + {file = "pyflakes-2.5.0.tar.gz", hash = "sha256:491feb020dca48ccc562a8c0cbe8df07ee13078df59813b83959cbdada312ea3"}, +] + +[[package]] +name = "pytest" +version = "7.4.4" +description = "pytest: simple powerful testing with Python" +optional = false +python-versions = ">=3.7" +files = [ + {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, + {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "sys_platform == \"win32\""} +exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} +iniconfig = "*" +packaging = "*" +pluggy = ">=0.12,<2.0" +tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} + +[package.extras] +testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] + +[[package]] +name = "python-dateutil" +version = "2.8.2" +description = "Extensions to the standard Python datetime module" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" +files = [ + {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, + {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, +] + +[package.dependencies] +six = ">=1.5" + +[[package]] +name = "six" +version = "1.16.0" +description = "Python 2 and 3 compatibility utilities" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +files = [ + {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, + {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, +] + +[[package]] +name = "tomli" +version = "2.0.1" +description = "A lil' TOML parser" +optional = false +python-versions = ">=3.7" +files = [ + {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, + {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, +] + +[[package]] +name = "tox" +version = "3.28.0" +description = "tox is a generic virtualenv management and test command line tool" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" +files = [ + {file = "tox-3.28.0-py2.py3-none-any.whl", hash = "sha256:57b5ab7e8bb3074edc3c0c0b4b192a4f3799d3723b2c5b76f1fa9f2d40316eea"}, + {file = "tox-3.28.0.tar.gz", hash = "sha256:d0d28f3fe6d6d7195c27f8b054c3e99d5451952b54abdae673b71609a581f640"}, +] + +[package.dependencies] +colorama = {version = ">=0.4.1", markers = "platform_system == \"Windows\""} +filelock = ">=3.0.0" +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} +packaging = ">=14" +pluggy = ">=0.12.0" +py = ">=1.4.17" +six = ">=1.14.0" +tomli = {version = ">=2.0.1", markers = "python_version >= \"3.7\" and python_version < \"3.11\""} +virtualenv = ">=16.0.0,<20.0.0 || >20.0.0,<20.0.1 || >20.0.1,<20.0.2 || >20.0.2,<20.0.3 || >20.0.3,<20.0.4 || >20.0.4,<20.0.5 || >20.0.5,<20.0.6 || >20.0.6,<20.0.7 || >20.0.7" + +[package.extras] +docs = ["pygments-github-lexers (>=0.0.5)", "sphinx (>=2.0.0)", "sphinxcontrib-autoprogram (>=0.1.5)", "towncrier (>=18.5.0)"] +testing = ["flaky (>=3.4.0)", "freezegun (>=0.3.11)", "pathlib2 (>=2.3.3)", "psutil (>=5.6.1)", "pytest (>=4.0.0)", "pytest-cov (>=2.5.1)", "pytest-mock (>=1.10.0)", "pytest-randomly (>=1.0.0)"] + +[[package]] +name = "typed-ast" +version = "1.5.5" +description = "a fork of Python 2 and 3 ast modules with type comment support" +optional = false +python-versions = ">=3.6" +files = [ + {file = "typed_ast-1.5.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:4bc1efe0ce3ffb74784e06460f01a223ac1f6ab31c6bc0376a21184bf5aabe3b"}, + {file = "typed_ast-1.5.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:5f7a8c46a8b333f71abd61d7ab9255440d4a588f34a21f126bbfc95f6049e686"}, + {file = "typed_ast-1.5.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:597fc66b4162f959ee6a96b978c0435bd63791e31e4f410622d19f1686d5e769"}, + {file = "typed_ast-1.5.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d41b7a686ce653e06c2609075d397ebd5b969d821b9797d029fccd71fdec8e04"}, + {file = "typed_ast-1.5.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:5fe83a9a44c4ce67c796a1b466c270c1272e176603d5e06f6afbc101a572859d"}, + {file = "typed_ast-1.5.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:d5c0c112a74c0e5db2c75882a0adf3133adedcdbfd8cf7c9d6ed77365ab90a1d"}, + {file = "typed_ast-1.5.5-cp310-cp310-win_amd64.whl", hash = "sha256:e1a976ed4cc2d71bb073e1b2a250892a6e968ff02aa14c1f40eba4f365ffec02"}, + {file = "typed_ast-1.5.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:c631da9710271cb67b08bd3f3813b7af7f4c69c319b75475436fcab8c3d21bee"}, + {file = "typed_ast-1.5.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b445c2abfecab89a932b20bd8261488d574591173d07827c1eda32c457358b18"}, + {file = "typed_ast-1.5.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cc95ffaaab2be3b25eb938779e43f513e0e538a84dd14a5d844b8f2932593d88"}, + {file = "typed_ast-1.5.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:61443214d9b4c660dcf4b5307f15c12cb30bdfe9588ce6158f4a005baeb167b2"}, + {file = "typed_ast-1.5.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:6eb936d107e4d474940469e8ec5b380c9b329b5f08b78282d46baeebd3692dc9"}, + {file = "typed_ast-1.5.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e48bf27022897577d8479eaed64701ecaf0467182448bd95759883300ca818c8"}, + {file = "typed_ast-1.5.5-cp311-cp311-win_amd64.whl", hash = "sha256:83509f9324011c9a39faaef0922c6f720f9623afe3fe220b6d0b15638247206b"}, + {file = "typed_ast-1.5.5-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:44f214394fc1af23ca6d4e9e744804d890045d1643dd7e8229951e0ef39429b5"}, + {file = "typed_ast-1.5.5-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:118c1ce46ce58fda78503eae14b7664163aa735b620b64b5b725453696f2a35c"}, + {file = "typed_ast-1.5.5-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:be4919b808efa61101456e87f2d4c75b228f4e52618621c77f1ddcaae15904fa"}, + {file = "typed_ast-1.5.5-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:fc2b8c4e1bc5cd96c1a823a885e6b158f8451cf6f5530e1829390b4d27d0807f"}, + {file = "typed_ast-1.5.5-cp36-cp36m-musllinux_1_1_x86_64.whl", hash = "sha256:16f7313e0a08c7de57f2998c85e2a69a642e97cb32f87eb65fbfe88381a5e44d"}, + {file = "typed_ast-1.5.5-cp36-cp36m-win_amd64.whl", hash = "sha256:2b946ef8c04f77230489f75b4b5a4a6f24c078be4aed241cfabe9cbf4156e7e5"}, + {file = "typed_ast-1.5.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:2188bc33d85951ea4ddad55d2b35598b2709d122c11c75cffd529fbc9965508e"}, + {file = "typed_ast-1.5.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0635900d16ae133cab3b26c607586131269f88266954eb04ec31535c9a12ef1e"}, + {file = "typed_ast-1.5.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:57bfc3cf35a0f2fdf0a88a3044aafaec1d2f24d8ae8cd87c4f58d615fb5b6311"}, + {file = "typed_ast-1.5.5-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:fe58ef6a764de7b4b36edfc8592641f56e69b7163bba9f9c8089838ee596bfb2"}, + {file = "typed_ast-1.5.5-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:d09d930c2d1d621f717bb217bf1fe2584616febb5138d9b3e8cdd26506c3f6d4"}, + {file = "typed_ast-1.5.5-cp37-cp37m-win_amd64.whl", hash = "sha256:d40c10326893ecab8a80a53039164a224984339b2c32a6baf55ecbd5b1df6431"}, + {file = "typed_ast-1.5.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:fd946abf3c31fb50eee07451a6aedbfff912fcd13cf357363f5b4e834cc5e71a"}, + {file = "typed_ast-1.5.5-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:ed4a1a42df8a3dfb6b40c3d2de109e935949f2f66b19703eafade03173f8f437"}, + {file = "typed_ast-1.5.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:045f9930a1550d9352464e5149710d56a2aed23a2ffe78946478f7b5416f1ede"}, + {file = "typed_ast-1.5.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:381eed9c95484ceef5ced626355fdc0765ab51d8553fec08661dce654a935db4"}, + {file = "typed_ast-1.5.5-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:bfd39a41c0ef6f31684daff53befddae608f9daf6957140228a08e51f312d7e6"}, + {file = "typed_ast-1.5.5-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:8c524eb3024edcc04e288db9541fe1f438f82d281e591c548903d5b77ad1ddd4"}, + {file = "typed_ast-1.5.5-cp38-cp38-win_amd64.whl", hash = "sha256:7f58fabdde8dcbe764cef5e1a7fcb440f2463c1bbbec1cf2a86ca7bc1f95184b"}, + {file = "typed_ast-1.5.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:042eb665ff6bf020dd2243307d11ed626306b82812aba21836096d229fdc6a10"}, + {file = "typed_ast-1.5.5-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:622e4a006472b05cf6ef7f9f2636edc51bda670b7bbffa18d26b255269d3d814"}, + {file = "typed_ast-1.5.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1efebbbf4604ad1283e963e8915daa240cb4bf5067053cf2f0baadc4d4fb51b8"}, + {file = "typed_ast-1.5.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f0aefdd66f1784c58f65b502b6cf8b121544680456d1cebbd300c2c813899274"}, + {file = "typed_ast-1.5.5-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:48074261a842acf825af1968cd912f6f21357316080ebaca5f19abbb11690c8a"}, + {file = "typed_ast-1.5.5-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:429ae404f69dc94b9361bb62291885894b7c6fb4640d561179548c849f8492ba"}, + {file = "typed_ast-1.5.5-cp39-cp39-win_amd64.whl", hash = "sha256:335f22ccb244da2b5c296e6f96b06ee9bed46526db0de38d2f0e5a6597b81155"}, + {file = "typed_ast-1.5.5.tar.gz", hash = "sha256:94282f7a354f36ef5dbce0ef3467ebf6a258e370ab33d5b40c249fa996e590dd"}, +] + +[[package]] +name = "types-python-dateutil" +version = "2.8.19.14" +description = "Typing stubs for python-dateutil" +optional = false +python-versions = "*" +files = [ + {file = "types-python-dateutil-2.8.19.14.tar.gz", hash = "sha256:1f4f10ac98bb8b16ade9dbee3518d9ace017821d94b057a425b069f834737f4b"}, + {file = "types_python_dateutil-2.8.19.14-py3-none-any.whl", hash = "sha256:f977b8de27787639986b4e28963263fd0e5158942b3ecef91b9335c130cb1ce9"}, +] + +[[package]] +name = "typing-extensions" +version = "4.7.1" +description = "Backported and Experimental Type Hints for Python 3.7+" +optional = false +python-versions = ">=3.7" +files = [ + {file = "typing_extensions-4.7.1-py3-none-any.whl", hash = "sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36"}, + {file = "typing_extensions-4.7.1.tar.gz", hash = "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2"}, +] + +[[package]] +name = "urllib3" +version = "2.0.7" +description = "HTTP library with thread-safe connection pooling, file post, and more." +optional = false +python-versions = ">=3.7" +files = [ + {file = "urllib3-2.0.7-py3-none-any.whl", hash = "sha256:fdb6d215c776278489906c2f8916e6e7d4f5a9b602ccbcfdf7f016fc8da0596e"}, + {file = "urllib3-2.0.7.tar.gz", hash = "sha256:c97dfde1f7bd43a71c8d2a58e369e9b2bf692d1334ea9f9cae55add7d0dd0f84"}, +] + +[package.extras] +brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] +secure = ["certifi", "cryptography (>=1.9)", "idna (>=2.0.0)", "pyopenssl (>=17.1.0)", "urllib3-secure-extra"] +socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] +zstd = ["zstandard (>=0.18.0)"] + +[[package]] +name = "virtualenv" +version = "20.16.2" +description = "Virtual Python Environment builder" +optional = false +python-versions = ">=3.6" +files = [ + {file = "virtualenv-20.16.2-py2.py3-none-any.whl", hash = "sha256:635b272a8e2f77cb051946f46c60a54ace3cb5e25568228bd6b57fc70eca9ff3"}, + {file = "virtualenv-20.16.2.tar.gz", hash = "sha256:0ef5be6d07181946891f5abc8047fda8bc2f0b4b9bf222c64e6e8963baee76db"}, +] + +[package.dependencies] +distlib = ">=0.3.1,<1" +filelock = ">=3.2,<4" +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} +platformdirs = ">=2,<3" + +[package.extras] +docs = ["proselint (>=0.10.2)", "sphinx (>=3)", "sphinx-argparse (>=0.2.5)", "sphinx-rtd-theme (>=0.4.3)", "towncrier (>=21.3)"] +testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "packaging (>=20.0)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)"] + +[[package]] +name = "zipp" +version = "3.15.0" +description = "Backport of pathlib-compatible object wrapper for zip files" +optional = false +python-versions = ">=3.7" +files = [ + {file = "zipp-3.15.0-py3-none-any.whl", hash = "sha256:48904fc76a60e542af151aded95726c1a5c34ed43ab4134b597665c86d7ad556"}, + {file = "zipp-3.15.0.tar.gz", hash = "sha256:112929ad649da941c23de50f356a2b5570c954b65150642bccdd66bf194d224b"}, +] + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] +testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"] + +[metadata] +lock-version = "2.0" +python-versions = "^3.7" +content-hash = "96d25a1701fc4c71e041dd068430d11b575227644b810a999176e8f98aa070e4" diff --git a/samples/openapi3/client/petstore/python/pyproject.toml b/samples/openapi3/client/petstore/python/pyproject.toml index 0acd05db4ed9..bb84812899bd 100644 --- a/samples/openapi3/client/petstore/python/pyproject.toml +++ b/samples/openapi3/client/petstore/python/pyproject.toml @@ -35,4 +35,8 @@ build-backend = "setuptools.build_meta" extension-pkg-whitelist = "pydantic" [tool.mypy] -files = ["petstore_api"] +files = [ + "petstore_api", + #"test", # auto-generated tests + "tests", # hand-written tests +] diff --git a/samples/openapi3/client/petstore/python/tests/test_model.py b/samples/openapi3/client/petstore/python/tests/test_model.py index b06eeaa0831f..7de872a26714 100644 --- a/samples/openapi3/client/petstore/python/tests/test_model.py +++ b/samples/openapi3/client/petstore/python/tests/test_model.py @@ -459,7 +459,7 @@ def test_additional_properties(self): self.assertNotEqual(id(pet_ap.additional_properties), id(pet_ap2.additional_properties)) pet_ap.additional_properties["something-new"] = "haha" - self.assertEqual(pet_ap.to_json(), '{"id":1,"name":"test name","photoUrls":["string"],"status":"available","something-new":"haha"}') + self.assertEqual(pet_ap.to_json(), '{"id": 1, "name": "test name", "photoUrls": ["string"], "status": "available", "something-new": "haha"}') self.assertEqual(type(pet_ap2.additional_properties), dict) self.assertNotEqual(id(pet_ap.additional_properties), id(pet_ap2.additional_properties)) self.assertEqual(pet_ap.additional_properties["something-new"], "haha") @@ -589,6 +589,8 @@ def test_allof(self): # shouldn't throw NameError self.assertEqual(model.to_json(), '{"skill": "none", "type": "tiger", "info": {"name": "creature info"}}') + +class TestdditionalPropertiesAnyType(unittest.TestCase): def test_additional_properties(self): a1 = petstore_api.AdditionalPropertiesAnyType() a1.additional_properties = { "abc": 123 } From 85ed538b0c4efe4d243f74a634e4588802dd4ce2 Mon Sep 17 00:00:00 2001 From: Jonathan Ballet Date: Tue, 2 Jan 2024 18:29:42 +0100 Subject: [PATCH 6/8] don't forcefully convert the client response headers to dict --- .../src/main/resources/python/api_client.mustache | 2 +- .../src/main/resources/python/api_response.mustache | 6 +++--- .../openapi_client/api_client.py | 2 +- .../openapi_client/api_response.py | 6 +++--- samples/client/echo_api/python/openapi_client/api_client.py | 2 +- .../client/echo_api/python/openapi_client/api_response.py | 6 +++--- .../petstore/python-aiohttp/petstore_api/api_client.py | 2 +- .../petstore/python-aiohttp/petstore_api/api_response.py | 6 +++--- .../client/petstore/python/petstore_api/api_client.py | 2 +- .../client/petstore/python/petstore_api/api_response.py | 6 +++--- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python/api_client.mustache b/modules/openapi-generator/src/main/resources/python/api_client.mustache index 426992099d7e..a5bba98a3068 100644 --- a/modules/openapi-generator/src/main/resources/python/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_client.mustache @@ -331,7 +331,7 @@ class ApiClient: return ApiResponse( status_code = response_data.status, data = return_data, - headers = dict(response_data.getheaders()), + headers = response_data.getheaders(), raw_data = response_data.data ) diff --git a/modules/openapi-generator/src/main/resources/python/api_response.mustache b/modules/openapi-generator/src/main/resources/python/api_response.mustache index 2ac1ada6e9b3..ca3db13b776c 100644 --- a/modules/openapi-generator/src/main/resources/python/api_response.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_response.mustache @@ -1,8 +1,8 @@ """API response object.""" from __future__ import annotations -from typing import Any, Dict, Optional, Generic, TypeVar -from pydantic import Field, StrictInt, StrictStr, StrictBytes, BaseModel +from typing import Any, Dict, Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel T = TypeVar("T") @@ -12,7 +12,7 @@ class ApiResponse(BaseModel, Generic[T]): """ status_code: StrictInt = Field(description="HTTP status code") - headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") data: T = Field(description="Deserialized data given the data type") raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_client.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_client.py index 5ca4547e5e38..af280b9fb9a5 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_client.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_client.py @@ -324,7 +324,7 @@ def response_deserialize( return ApiResponse( status_code = response_data.status, data = return_data, - headers = dict(response_data.getheaders()), + headers = response_data.getheaders(), raw_data = response_data.data ) diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_response.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_response.py index 2ac1ada6e9b3..ca3db13b776c 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_response.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_response.py @@ -1,8 +1,8 @@ """API response object.""" from __future__ import annotations -from typing import Any, Dict, Optional, Generic, TypeVar -from pydantic import Field, StrictInt, StrictStr, StrictBytes, BaseModel +from typing import Any, Dict, Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel T = TypeVar("T") @@ -12,7 +12,7 @@ class ApiResponse(BaseModel, Generic[T]): """ status_code: StrictInt = Field(description="HTTP status code") - headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") data: T = Field(description="Deserialized data given the data type") raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") diff --git a/samples/client/echo_api/python/openapi_client/api_client.py b/samples/client/echo_api/python/openapi_client/api_client.py index 5ca4547e5e38..af280b9fb9a5 100644 --- a/samples/client/echo_api/python/openapi_client/api_client.py +++ b/samples/client/echo_api/python/openapi_client/api_client.py @@ -324,7 +324,7 @@ def response_deserialize( return ApiResponse( status_code = response_data.status, data = return_data, - headers = dict(response_data.getheaders()), + headers = response_data.getheaders(), raw_data = response_data.data ) diff --git a/samples/client/echo_api/python/openapi_client/api_response.py b/samples/client/echo_api/python/openapi_client/api_response.py index 2ac1ada6e9b3..ca3db13b776c 100644 --- a/samples/client/echo_api/python/openapi_client/api_response.py +++ b/samples/client/echo_api/python/openapi_client/api_response.py @@ -1,8 +1,8 @@ """API response object.""" from __future__ import annotations -from typing import Any, Dict, Optional, Generic, TypeVar -from pydantic import Field, StrictInt, StrictStr, StrictBytes, BaseModel +from typing import Any, Dict, Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel T = TypeVar("T") @@ -12,7 +12,7 @@ class ApiResponse(BaseModel, Generic[T]): """ status_code: StrictInt = Field(description="HTTP status code") - headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") data: T = Field(description="Deserialized data given the data type") raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py index 4f70a6b0424a..afec98bb1df5 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py @@ -326,7 +326,7 @@ def response_deserialize( return ApiResponse( status_code = response_data.status, data = return_data, - headers = dict(response_data.getheaders()), + headers = response_data.getheaders(), raw_data = response_data.data ) diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_response.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_response.py index 2ac1ada6e9b3..ca3db13b776c 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_response.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_response.py @@ -1,8 +1,8 @@ """API response object.""" from __future__ import annotations -from typing import Any, Dict, Optional, Generic, TypeVar -from pydantic import Field, StrictInt, StrictStr, StrictBytes, BaseModel +from typing import Any, Dict, Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel T = TypeVar("T") @@ -12,7 +12,7 @@ class ApiResponse(BaseModel, Generic[T]): """ status_code: StrictInt = Field(description="HTTP status code") - headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") data: T = Field(description="Deserialized data given the data type") raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") diff --git a/samples/openapi3/client/petstore/python/petstore_api/api_client.py b/samples/openapi3/client/petstore/python/petstore_api/api_client.py index 8ad4abde83f5..2e043f3abdaa 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_client.py @@ -323,7 +323,7 @@ def response_deserialize( return ApiResponse( status_code = response_data.status, data = return_data, - headers = dict(response_data.getheaders()), + headers = response_data.getheaders(), raw_data = response_data.data ) diff --git a/samples/openapi3/client/petstore/python/petstore_api/api_response.py b/samples/openapi3/client/petstore/python/petstore_api/api_response.py index 2ac1ada6e9b3..ca3db13b776c 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api_response.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_response.py @@ -1,8 +1,8 @@ """API response object.""" from __future__ import annotations -from typing import Any, Dict, Optional, Generic, TypeVar -from pydantic import Field, StrictInt, StrictStr, StrictBytes, BaseModel +from typing import Any, Dict, Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel T = TypeVar("T") @@ -12,7 +12,7 @@ class ApiResponse(BaseModel, Generic[T]): """ status_code: StrictInt = Field(description="HTTP status code") - headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") data: T = Field(description="Deserialized data given the data type") raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") From 856f2033125f30292f186857cd91461b1ee4c383 Mon Sep 17 00:00:00 2001 From: Jonathan Ballet Date: Tue, 2 Jan 2024 18:41:25 +0100 Subject: [PATCH 7/8] override petstore ApiResponse model --- bin/configs/python-aiohttp.yaml | 3 ++ bin/configs/python.yaml | 3 ++ .../resources/python/__init__package.mustache | 2 +- .../src/main/resources/python/api.mustache | 4 +- .../openapi_client/__init__.py | 2 +- .../openapi_client/api/auth_api.py | 6 +-- .../openapi_client/api/body_api.py | 20 +++---- .../openapi_client/api/form_api.py | 6 +-- .../openapi_client/api/header_api.py | 4 +- .../openapi_client/api/path_api.py | 4 +- .../openapi_client/api/query_api.py | 18 +++---- .../python/openapi_client/__init__.py | 2 +- .../python/openapi_client/api/auth_api.py | 6 +-- .../python/openapi_client/api/body_api.py | 20 +++---- .../python/openapi_client/api/form_api.py | 6 +-- .../python/openapi_client/api/header_api.py | 4 +- .../python/openapi_client/api/path_api.py | 4 +- .../python/openapi_client/api/query_api.py | 18 +++---- .../python-aiohttp/.openapi-generator/FILES | 4 +- .../client/petstore/python-aiohttp/README.md | 2 +- .../{ApiResponse.md => ModelApiResponse.md} | 16 +++--- .../petstore/python-aiohttp/docs/PetApi.md | 12 ++--- .../python-aiohttp/petstore_api/__init__.py | 4 +- .../petstore_api/api/another_fake_api.py | 4 +- .../petstore_api/api/default_api.py | 4 +- .../petstore_api/api/fake_api.py | 52 +++++++++--------- .../api/fake_classname_tags123_api.py | 4 +- .../petstore_api/api/pet_api.py | 38 ++++++------- .../petstore_api/api/store_api.py | 10 ++-- .../petstore_api/api/user_api.py | 18 +++---- .../petstore_api/models/__init__.py | 2 +- ...{api_response.py => model_api_response.py} | 8 +-- .../python-aiohttp/test/test_api_response.py | 53 ------------------ .../test/test_model_api_response.py | 54 +++++++++++++++++++ .../petstore/python/.openapi-generator/FILES | 4 +- .../openapi3/client/petstore/python/README.md | 2 +- .../{ApiResponse.md => ModelApiResponse.md} | 16 +++--- .../client/petstore/python/docs/PetApi.md | 12 ++--- .../petstore/python/petstore_api/__init__.py | 4 +- .../petstore_api/api/another_fake_api.py | 4 +- .../python/petstore_api/api/default_api.py | 4 +- .../python/petstore_api/api/fake_api.py | 52 +++++++++--------- .../api/fake_classname_tags123_api.py | 4 +- .../python/petstore_api/api/pet_api.py | 38 ++++++------- .../python/petstore_api/api/store_api.py | 10 ++-- .../python/petstore_api/api/user_api.py | 18 +++---- .../python/petstore_api/models/__init__.py | 2 +- ...{api_response.py => model_api_response.py} | 8 +-- .../petstore/python/test/test_api_response.py | 53 ------------------ .../python/test/test_model_api_response.py | 54 +++++++++++++++++++ 50 files changed, 355 insertions(+), 347 deletions(-) rename samples/openapi3/client/petstore/python-aiohttp/docs/{ApiResponse.md => ModelApiResponse.md} (55%) rename samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/{api_response.py => model_api_response.py} (92%) delete mode 100644 samples/openapi3/client/petstore/python-aiohttp/test/test_api_response.py create mode 100644 samples/openapi3/client/petstore/python-aiohttp/test/test_model_api_response.py rename samples/openapi3/client/petstore/python/docs/{ApiResponse.md => ModelApiResponse.md} (55%) rename samples/openapi3/client/petstore/python/petstore_api/models/{api_response.py => model_api_response.py} (94%) delete mode 100644 samples/openapi3/client/petstore/python/test/test_api_response.py create mode 100644 samples/openapi3/client/petstore/python/test/test_model_api_response.py diff --git a/bin/configs/python-aiohttp.yaml b/bin/configs/python-aiohttp.yaml index 8c13f87b6319..a7515a1bdfb2 100644 --- a/bin/configs/python-aiohttp.yaml +++ b/bin/configs/python-aiohttp.yaml @@ -9,3 +9,6 @@ additionalProperties: nameMappings: _type: underscore_type type_: type_with_underscore +modelNameMappings: + # The OpenAPI spec ApiResponse conflicts with the internal ApiResponse + ApiResponse: ModelApiResponse diff --git a/bin/configs/python.yaml b/bin/configs/python.yaml index b13e5b802e21..09727cdfab9a 100644 --- a/bin/configs/python.yaml +++ b/bin/configs/python.yaml @@ -10,3 +10,6 @@ additionalProperties: nameMappings: _type: underscore_type type_: type_with_underscore +modelNameMappings: + # The OpenAPI spec ApiResponse conflicts with the internal ApiResponse + ApiResponse: ModelApiResponse diff --git a/modules/openapi-generator/src/main/resources/python/__init__package.mustache b/modules/openapi-generator/src/main/resources/python/__init__package.mustache index ddc9f9db1314..7985e6e46a4f 100644 --- a/modules/openapi-generator/src/main/resources/python/__init__package.mustache +++ b/modules/openapi-generator/src/main/resources/python/__init__package.mustache @@ -10,7 +10,7 @@ __version__ = "{{packageVersion}}" {{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classFilename}} import {{classname}} {{/apis}}{{/apiInfo}} # import ApiClient -#from {{packageName}}.api_response import ApiResponse +from {{packageName}}.api_response import ApiResponse from {{packageName}}.api_client import ApiClient from {{packageName}}.configuration import Configuration from {{packageName}}.exceptions import OpenApiException diff --git a/modules/openapi-generator/src/main/resources/python/api.mustache b/modules/openapi-generator/src/main/resources/python/api.mustache index 177318620c94..7f66cf0ec89b 100644 --- a/modules/openapi-generator/src/main/resources/python/api.mustache +++ b/modules/openapi-generator/src/main/resources/python/api.mustache @@ -14,7 +14,7 @@ from typing_extensions import Annotated {{/imports}} from {{packageName}}.api_client import ApiClient -from {{packageName}}.api_response import ApiResponse as _ApiResponse +from {{packageName}}.api_response import ApiResponse from {{packageName}}.rest import RESTResponseType @@ -48,7 +48,7 @@ class {{classname}}: @validate_call - {{#asyncio}}async {{/asyncio}}def {{operationId}}_with_http_info{{>partial_api_args}} -> _ApiResponse[{{{returnType}}}{{^returnType}}None{{/returnType}}]: + {{#asyncio}}async {{/asyncio}}def {{operationId}}_with_http_info{{>partial_api_args}} -> ApiResponse[{{{returnType}}}{{^returnType}}None{{/returnType}}]: {{>partial_api}} response_data = {{#asyncio}}await {{/asyncio}}self.api_client.call_api( *_param, diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/__init__.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/__init__.py index 715ae020f7ae..7b67f7c597fb 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/__init__.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/__init__.py @@ -26,7 +26,7 @@ from openapi_client.api.query_api import QueryApi # import ApiClient -#from openapi_client.api_response import ApiResponse +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 diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/auth_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/auth_api.py index 4dc8f8576019..30ccb46f395f 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/auth_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/auth_api.py @@ -22,7 +22,7 @@ from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse as _ApiResponse +from openapi_client.api_response import ApiResponse from openapi_client.rest import RESTResponseType @@ -117,7 +117,7 @@ def test_auth_http_basic_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """To test HTTP basic authentication To test HTTP basic authentication @@ -360,7 +360,7 @@ def test_auth_http_bearer_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """To test HTTP bearer authentication To test HTTP bearer authentication diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/body_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/body_api.py index 1a03f727baf8..77570aaf2d59 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/body_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/body_api.py @@ -30,7 +30,7 @@ from openapi_client.models.tag import Tag from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse as _ApiResponse +from openapi_client.api_response import ApiResponse from openapi_client.rest import RESTResponseType @@ -125,7 +125,7 @@ def test_binary_gif_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[bytearray]: + ) -> ApiResponse[bytearray]: """Test binary (gif) response body Test binary (gif) response body @@ -372,7 +372,7 @@ def test_body_application_octetstream_binary_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test body parameter(s) Test body parameter(s) @@ -647,7 +647,7 @@ def test_body_multipart_formdata_array_of_binary_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test array of binary in multipart mime Test array of binary in multipart mime @@ -918,7 +918,7 @@ def test_body_multipart_formdata_single_binary_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test single binary in multipart mime Test single binary in multipart mime @@ -1188,7 +1188,7 @@ def test_echo_body_all_of_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[Pet]: + ) -> ApiResponse[Pet]: """Test body parameter(s) Test body parameter(s) @@ -1458,7 +1458,7 @@ def test_echo_body_free_form_object_response_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test free form object Test free form object @@ -1728,7 +1728,7 @@ def test_echo_body_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[Pet]: + ) -> ApiResponse[Pet]: """Test body parameter(s) Test body parameter(s) @@ -1998,7 +1998,7 @@ def test_echo_body_pet_response_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test empty response body Test empty response body @@ -2268,7 +2268,7 @@ def test_echo_body_tag_response_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test empty json (request body) Test empty json (request body) diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/form_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/form_api.py index 764774a5e95e..0dc4cb13a8d5 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/form_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/form_api.py @@ -26,7 +26,7 @@ from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse as _ApiResponse +from openapi_client.api_response import ApiResponse from openapi_client.rest import RESTResponseType @@ -136,7 +136,7 @@ def test_form_integer_boolean_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test form parameter(s) Test form parameter(s) @@ -451,7 +451,7 @@ def test_form_oneof_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test form parameter(s) for oneOf schema Test form parameter(s) for oneOf schema diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/header_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/header_api.py index dcdfffbc4cd7..496845f93ad8 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/header_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/header_api.py @@ -27,7 +27,7 @@ from openapi_client.models.string_enum_ref import StringEnumRef from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse as _ApiResponse +from openapi_client.api_response import ApiResponse from openapi_client.rest import RESTResponseType @@ -147,7 +147,7 @@ def test_header_integer_boolean_string_enums_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test header parameter(s) Test header parameter(s) diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/path_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/path_api.py index 1d501b5c268c..78d3d0bdc81c 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/path_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/path_api.py @@ -25,7 +25,7 @@ from openapi_client.models.string_enum_ref import StringEnumRef from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse as _ApiResponse +from openapi_client.api_response import ApiResponse from openapi_client.rest import RESTResponseType @@ -140,7 +140,7 @@ def tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_e _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test path parameter(s) Test path parameter(s) diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/query_api.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/query_api.py index cf0980110e19..cc96b61aaeab 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/query_api.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api/query_api.py @@ -31,7 +31,7 @@ from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse as _ApiResponse +from openapi_client.api_response import ApiResponse from openapi_client.rest import RESTResponseType @@ -136,7 +136,7 @@ def test_enum_ref_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -417,7 +417,7 @@ def test_query_datetime_date_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -728,7 +728,7 @@ def test_query_integer_boolean_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -1011,7 +1011,7 @@ def test_query_style_deep_object_explode_true_object_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -1270,7 +1270,7 @@ def test_query_style_deep_object_explode_true_object_all_of_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -1529,7 +1529,7 @@ def test_query_style_form_explode_true_array_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -1788,7 +1788,7 @@ def test_query_style_form_explode_true_object_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -2047,7 +2047,7 @@ def test_query_style_form_explode_true_object_all_of_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test query parameter(s) Test query parameter(s) diff --git a/samples/client/echo_api/python/openapi_client/__init__.py b/samples/client/echo_api/python/openapi_client/__init__.py index 715ae020f7ae..7b67f7c597fb 100644 --- a/samples/client/echo_api/python/openapi_client/__init__.py +++ b/samples/client/echo_api/python/openapi_client/__init__.py @@ -26,7 +26,7 @@ from openapi_client.api.query_api import QueryApi # import ApiClient -#from openapi_client.api_response import ApiResponse +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 diff --git a/samples/client/echo_api/python/openapi_client/api/auth_api.py b/samples/client/echo_api/python/openapi_client/api/auth_api.py index 4dc8f8576019..30ccb46f395f 100644 --- a/samples/client/echo_api/python/openapi_client/api/auth_api.py +++ b/samples/client/echo_api/python/openapi_client/api/auth_api.py @@ -22,7 +22,7 @@ from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse as _ApiResponse +from openapi_client.api_response import ApiResponse from openapi_client.rest import RESTResponseType @@ -117,7 +117,7 @@ def test_auth_http_basic_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """To test HTTP basic authentication To test HTTP basic authentication @@ -360,7 +360,7 @@ def test_auth_http_bearer_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """To test HTTP bearer authentication To test HTTP bearer authentication diff --git a/samples/client/echo_api/python/openapi_client/api/body_api.py b/samples/client/echo_api/python/openapi_client/api/body_api.py index 1a03f727baf8..77570aaf2d59 100644 --- a/samples/client/echo_api/python/openapi_client/api/body_api.py +++ b/samples/client/echo_api/python/openapi_client/api/body_api.py @@ -30,7 +30,7 @@ from openapi_client.models.tag import Tag from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse as _ApiResponse +from openapi_client.api_response import ApiResponse from openapi_client.rest import RESTResponseType @@ -125,7 +125,7 @@ def test_binary_gif_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[bytearray]: + ) -> ApiResponse[bytearray]: """Test binary (gif) response body Test binary (gif) response body @@ -372,7 +372,7 @@ def test_body_application_octetstream_binary_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test body parameter(s) Test body parameter(s) @@ -647,7 +647,7 @@ def test_body_multipart_formdata_array_of_binary_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test array of binary in multipart mime Test array of binary in multipart mime @@ -918,7 +918,7 @@ def test_body_multipart_formdata_single_binary_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test single binary in multipart mime Test single binary in multipart mime @@ -1188,7 +1188,7 @@ def test_echo_body_all_of_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[Pet]: + ) -> ApiResponse[Pet]: """Test body parameter(s) Test body parameter(s) @@ -1458,7 +1458,7 @@ def test_echo_body_free_form_object_response_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test free form object Test free form object @@ -1728,7 +1728,7 @@ def test_echo_body_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[Pet]: + ) -> ApiResponse[Pet]: """Test body parameter(s) Test body parameter(s) @@ -1998,7 +1998,7 @@ def test_echo_body_pet_response_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test empty response body Test empty response body @@ -2268,7 +2268,7 @@ def test_echo_body_tag_response_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test empty json (request body) Test empty json (request body) diff --git a/samples/client/echo_api/python/openapi_client/api/form_api.py b/samples/client/echo_api/python/openapi_client/api/form_api.py index 764774a5e95e..0dc4cb13a8d5 100644 --- a/samples/client/echo_api/python/openapi_client/api/form_api.py +++ b/samples/client/echo_api/python/openapi_client/api/form_api.py @@ -26,7 +26,7 @@ from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse as _ApiResponse +from openapi_client.api_response import ApiResponse from openapi_client.rest import RESTResponseType @@ -136,7 +136,7 @@ def test_form_integer_boolean_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test form parameter(s) Test form parameter(s) @@ -451,7 +451,7 @@ def test_form_oneof_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test form parameter(s) for oneOf schema Test form parameter(s) for oneOf schema diff --git a/samples/client/echo_api/python/openapi_client/api/header_api.py b/samples/client/echo_api/python/openapi_client/api/header_api.py index dcdfffbc4cd7..496845f93ad8 100644 --- a/samples/client/echo_api/python/openapi_client/api/header_api.py +++ b/samples/client/echo_api/python/openapi_client/api/header_api.py @@ -27,7 +27,7 @@ from openapi_client.models.string_enum_ref import StringEnumRef from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse as _ApiResponse +from openapi_client.api_response import ApiResponse from openapi_client.rest import RESTResponseType @@ -147,7 +147,7 @@ def test_header_integer_boolean_string_enums_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test header parameter(s) Test header parameter(s) diff --git a/samples/client/echo_api/python/openapi_client/api/path_api.py b/samples/client/echo_api/python/openapi_client/api/path_api.py index 1d501b5c268c..78d3d0bdc81c 100644 --- a/samples/client/echo_api/python/openapi_client/api/path_api.py +++ b/samples/client/echo_api/python/openapi_client/api/path_api.py @@ -25,7 +25,7 @@ from openapi_client.models.string_enum_ref import StringEnumRef from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse as _ApiResponse +from openapi_client.api_response import ApiResponse from openapi_client.rest import RESTResponseType @@ -140,7 +140,7 @@ def tests_path_string_path_string_integer_path_integer_enum_nonref_string_path_e _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test path parameter(s) Test path parameter(s) diff --git a/samples/client/echo_api/python/openapi_client/api/query_api.py b/samples/client/echo_api/python/openapi_client/api/query_api.py index cf0980110e19..cc96b61aaeab 100644 --- a/samples/client/echo_api/python/openapi_client/api/query_api.py +++ b/samples/client/echo_api/python/openapi_client/api/query_api.py @@ -31,7 +31,7 @@ from openapi_client.models.test_query_style_form_explode_true_array_string_query_object_parameter import TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter from openapi_client.api_client import ApiClient -from openapi_client.api_response import ApiResponse as _ApiResponse +from openapi_client.api_response import ApiResponse from openapi_client.rest import RESTResponseType @@ -136,7 +136,7 @@ def test_enum_ref_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -417,7 +417,7 @@ def test_query_datetime_date_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -728,7 +728,7 @@ def test_query_integer_boolean_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -1011,7 +1011,7 @@ def test_query_style_deep_object_explode_true_object_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -1270,7 +1270,7 @@ def test_query_style_deep_object_explode_true_object_all_of_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -1529,7 +1529,7 @@ def test_query_style_form_explode_true_array_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -1788,7 +1788,7 @@ def test_query_style_form_explode_true_object_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test query parameter(s) Test query parameter(s) @@ -2047,7 +2047,7 @@ def test_query_style_form_explode_true_object_all_of_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Test query parameter(s) Test query parameter(s) diff --git a/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES b/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES index 1ef5f596fa14..b85011e97909 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES @@ -12,7 +12,6 @@ docs/Animal.md docs/AnotherFakeApi.md docs/AnyOfColor.md docs/AnyOfPig.md -docs/ApiResponse.md docs/ArrayOfArrayOfModel.md docs/ArrayOfArrayOfNumberOnly.md docs/ArrayOfNumberOnly.md @@ -54,6 +53,7 @@ docs/MapOfArrayOfModel.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md docs/Model200Response.md +docs/ModelApiResponse.md docs/ModelReturn.md docs/Name.md docs/NullableClass.md @@ -116,7 +116,6 @@ petstore_api/models/all_of_with_single_ref.py petstore_api/models/animal.py petstore_api/models/any_of_color.py petstore_api/models/any_of_pig.py -petstore_api/models/api_response.py petstore_api/models/array_of_array_of_model.py petstore_api/models/array_of_array_of_number_only.py petstore_api/models/array_of_number_only.py @@ -155,6 +154,7 @@ petstore_api/models/map_of_array_of_model.py petstore_api/models/map_test.py petstore_api/models/mixed_properties_and_additional_properties_class.py petstore_api/models/model200_response.py +petstore_api/models/model_api_response.py petstore_api/models/model_return.py petstore_api/models/name.py petstore_api/models/nullable_class.py diff --git a/samples/openapi3/client/petstore/python-aiohttp/README.md b/samples/openapi3/client/petstore/python-aiohttp/README.md index 3506f64f00c7..4974d5668348 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/README.md +++ b/samples/openapi3/client/petstore/python-aiohttp/README.md @@ -146,7 +146,6 @@ Class | Method | HTTP request | Description - [Animal](docs/Animal.md) - [AnyOfColor](docs/AnyOfColor.md) - [AnyOfPig](docs/AnyOfPig.md) - - [ApiResponse](docs/ApiResponse.md) - [ArrayOfArrayOfModel](docs/ArrayOfArrayOfModel.md) - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) @@ -185,6 +184,7 @@ Class | Method | HTTP request | Description - [MapTest](docs/MapTest.md) - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) - [Model200Response](docs/Model200Response.md) + - [ModelApiResponse](docs/ModelApiResponse.md) - [ModelReturn](docs/ModelReturn.md) - [Name](docs/Name.md) - [NullableClass](docs/NullableClass.md) diff --git a/samples/openapi3/client/petstore/python-aiohttp/docs/ApiResponse.md b/samples/openapi3/client/petstore/python-aiohttp/docs/ModelApiResponse.md similarity index 55% rename from samples/openapi3/client/petstore/python-aiohttp/docs/ApiResponse.md rename to samples/openapi3/client/petstore/python-aiohttp/docs/ModelApiResponse.md index 866258d527c8..659823b8051f 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/ApiResponse.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/ModelApiResponse.md @@ -1,4 +1,4 @@ -# ApiResponse +# ModelApiResponse ## Properties @@ -12,19 +12,19 @@ Name | Type | Description | Notes ## Example ```python -from petstore_api.models.api_response import ApiResponse +from petstore_api.models.model_api_response import ModelApiResponse # TODO update the JSON string below json = "{}" -# create an instance of ApiResponse from a JSON string -api_response_instance = ApiResponse.from_json(json) +# create an instance of ModelApiResponse from a JSON string +model_api_response_instance = ModelApiResponse.from_json(json) # print the JSON string representation of the object -print ApiResponse.to_json() +print ModelApiResponse.to_json() # convert the object into a dict -api_response_dict = api_response_instance.to_dict() -# create an instance of ApiResponse from a dict -api_response_form_dict = api_response.from_dict(api_response_dict) +model_api_response_dict = model_api_response_instance.to_dict() +# create an instance of ModelApiResponse from a dict +model_api_response_form_dict = model_api_response.from_dict(model_api_response_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/python-aiohttp/docs/PetApi.md b/samples/openapi3/client/petstore/python-aiohttp/docs/PetApi.md index 2253bdbbfa97..a281de2cd053 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/PetApi.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/PetApi.md @@ -817,7 +817,7 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **upload_file** -> ApiResponse upload_file(pet_id, additional_metadata=additional_metadata, file=file) +> ModelApiResponse upload_file(pet_id, additional_metadata=additional_metadata, file=file) uploads an image @@ -831,7 +831,7 @@ uploads an image import time import os import petstore_api -from petstore_api.models.api_response import ApiResponse +from petstore_api.models.model_api_response import ModelApiResponse from petstore_api.rest import ApiException from pprint import pprint @@ -878,7 +878,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization @@ -898,7 +898,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **upload_file_with_required_file** -> ApiResponse upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata) +> ModelApiResponse upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata) uploads an image (required) @@ -912,7 +912,7 @@ uploads an image (required) import time import os import petstore_api -from petstore_api.models.api_response import ApiResponse +from petstore_api.models.model_api_response import ModelApiResponse from petstore_api.rest import ApiException from pprint import pprint @@ -959,7 +959,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py index 112f8a4abdaa..f791bc531127 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py @@ -26,7 +26,7 @@ from petstore_api.api.user_api import UserApi # import ApiClient -#from petstore_api.api_response import ApiResponse +from petstore_api.api_response import ApiResponse from petstore_api.api_client import ApiClient from petstore_api.configuration import Configuration from petstore_api.exceptions import OpenApiException @@ -46,7 +46,6 @@ from petstore_api.models.animal import Animal from petstore_api.models.any_of_color import AnyOfColor from petstore_api.models.any_of_pig import AnyOfPig -from petstore_api.models.api_response import ApiResponse from petstore_api.models.array_of_array_of_model import ArrayOfArrayOfModel from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly from petstore_api.models.array_of_number_only import ArrayOfNumberOnly @@ -85,6 +84,7 @@ from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass from petstore_api.models.model200_response import Model200Response +from petstore_api.models.model_api_response import ModelApiResponse from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.nullable_class import NullableClass diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/another_fake_api.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/another_fake_api.py index 664305726fd1..f50667c30eb2 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/another_fake_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/another_fake_api.py @@ -24,7 +24,7 @@ from petstore_api.models.client import Client from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse as _ApiResponse +from petstore_api.api_response import ApiResponse from petstore_api.rest import RESTResponseType @@ -124,7 +124,7 @@ async def call_123_test_special_tags_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[Client]: + ) -> ApiResponse[Client]: """To test special tags To test special tags and operation ID starting with number diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/default_api.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/default_api.py index d4265c6c32b0..a14efb2e375a 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/default_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/default_api.py @@ -22,7 +22,7 @@ from petstore_api.models.foo_get_default_response import FooGetDefaultResponse from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse as _ApiResponse +from petstore_api.api_response import ApiResponse from petstore_api.rest import RESTResponseType @@ -115,7 +115,7 @@ async def foo_get_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[FooGetDefaultResponse]: + ) -> ApiResponse[FooGetDefaultResponse]: """foo_get diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py index 69babf6fb1ac..f03fa6215dd9 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_api.py @@ -39,7 +39,7 @@ from petstore_api.models.user import User from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse as _ApiResponse +from petstore_api.api_response import ApiResponse from petstore_api.rest import RESTResponseType @@ -138,7 +138,7 @@ async def fake_any_type_request_body_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test any type request body @@ -399,7 +399,7 @@ async def fake_enum_ref_query_parameter_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test enum reference query parameter @@ -644,7 +644,7 @@ async def fake_health_get_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[HealthCheckResult]: + ) -> ApiResponse[HealthCheckResult]: """Health check endpoint @@ -898,7 +898,7 @@ async def fake_http_signature_test_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test http signature authentication @@ -1184,7 +1184,7 @@ async def fake_outer_boolean_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[bool]: + ) -> ApiResponse[bool]: """fake_outer_boolean_serialize Test serialization of outer boolean types @@ -1454,7 +1454,7 @@ async def fake_outer_composite_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[OuterComposite]: + ) -> ApiResponse[OuterComposite]: """fake_outer_composite_serialize Test serialization of object with outer number type @@ -1724,7 +1724,7 @@ async def fake_outer_number_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[float]: + ) -> ApiResponse[float]: """fake_outer_number_serialize Test serialization of outer number types @@ -1994,7 +1994,7 @@ async def fake_outer_string_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """fake_outer_string_serialize Test serialization of outer string types @@ -2264,7 +2264,7 @@ async def fake_property_enum_integer_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[OuterObjectWithEnumProperty]: + ) -> ApiResponse[OuterObjectWithEnumProperty]: """fake_property_enum_integer_serialize Test serialization of enum (int) properties with examples @@ -2528,7 +2528,7 @@ async def fake_ref_enum_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[EnumClass]: + ) -> ApiResponse[EnumClass]: """test ref to enum string @@ -2767,7 +2767,7 @@ async def fake_return_list_of_objects_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[List[List[Tag]]]: + ) -> ApiResponse[List[List[Tag]]]: """test returning list of objects @@ -3011,7 +3011,7 @@ async def fake_uuid_example_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test uuid example @@ -3262,7 +3262,7 @@ async def test_body_with_binary_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test_body_with_binary For this test, the body has to be a binary file. @@ -3531,7 +3531,7 @@ async def test_body_with_file_schema_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test_body_with_file_schema For this test, the body for this request must reference a schema named `File`. @@ -3799,7 +3799,7 @@ async def test_body_with_query_params_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test_body_with_query_params @@ -4073,7 +4073,7 @@ async def test_client_model_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[Client]: + ) -> ApiResponse[Client]: """To test \"client\" model To test \"client\" model @@ -4347,7 +4347,7 @@ async def test_date_time_query_parameter_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test_date_time_query_parameter @@ -4615,7 +4615,7 @@ async def test_empty_and_non_empty_responses_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test empty and non-empty responses @@ -4935,7 +4935,7 @@ async def test_endpoint_parameters_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -5338,7 +5338,7 @@ async def test_error_responses_with_model_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test error responses with model @@ -5612,7 +5612,7 @@ async def test_group_parameters_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) @@ -5922,7 +5922,7 @@ async def test_inline_additional_properties_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test inline additionalProperties @@ -6186,7 +6186,7 @@ async def test_inline_freeform_additional_properties_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test inline free-form additionalProperties @@ -6455,7 +6455,7 @@ async def test_json_form_data_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test json serialization of form data @@ -6759,7 +6759,7 @@ async def test_query_parameter_collection_format_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test_query_parameter_collection_format To test the collection format in query parameters diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_classname_tags123_api.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_classname_tags123_api.py index db3ad254b24e..56da731e164d 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_classname_tags123_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/fake_classname_tags123_api.py @@ -24,7 +24,7 @@ from petstore_api.models.client import Client from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse as _ApiResponse +from petstore_api.api_response import ApiResponse from petstore_api.rest import RESTResponseType @@ -124,7 +124,7 @@ async def test_classname_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[Client]: + ) -> ApiResponse[Client]: """To test class name in snake case To test class name in snake case diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/pet_api.py index 2d6288078ba1..13672731a6a4 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/pet_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/pet_api.py @@ -25,11 +25,11 @@ from typing import List, Optional, Union -from petstore_api.models.api_response import ApiResponse +from petstore_api.models.model_api_response import ModelApiResponse from petstore_api.models.pet import Pet from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse as _ApiResponse +from petstore_api.api_response import ApiResponse from petstore_api.rest import RESTResponseType @@ -130,7 +130,7 @@ async def add_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Add a new pet to the store @@ -405,7 +405,7 @@ async def delete_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Deletes a pet @@ -670,7 +670,7 @@ async def find_pets_by_status_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[List[Pet]]: + ) -> ApiResponse[List[Pet]]: """Finds Pets by status Multiple status values can be provided with comma separated strings @@ -937,7 +937,7 @@ async def find_pets_by_tags_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[List[Pet]]: + ) -> ApiResponse[List[Pet]]: """(Deprecated) Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -1206,7 +1206,7 @@ async def get_pet_by_id_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[Pet]: + ) -> ApiResponse[Pet]: """Find pet by ID Returns a single pet @@ -1472,7 +1472,7 @@ async def update_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Update an existing pet @@ -1756,7 +1756,7 @@ async def update_pet_with_form_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Updates a pet in the store with form data @@ -1978,7 +1978,7 @@ async def upload_file( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse: + ) -> ModelApiResponse: """uploads an image @@ -2022,7 +2022,7 @@ async def upload_file( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ApiResponse", + '200': "ModelApiResponse", } response_data = await self.api_client.call_api( *_param, @@ -2053,7 +2053,7 @@ async def upload_file_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[ApiResponse]: + ) -> ApiResponse[ModelApiResponse]: """uploads an image @@ -2097,7 +2097,7 @@ async def upload_file_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ApiResponse", + '200': "ModelApiResponse", } response_data = await self.api_client.call_api( *_param, @@ -2172,7 +2172,7 @@ async def upload_file_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ApiResponse", + '200': "ModelApiResponse", } response_data = await self.api_client.call_api( *_param, @@ -2279,7 +2279,7 @@ async def upload_file_with_required_file( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse: + ) -> ModelApiResponse: """uploads an image (required) @@ -2323,7 +2323,7 @@ async def upload_file_with_required_file( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ApiResponse", + '200': "ModelApiResponse", } response_data = await self.api_client.call_api( *_param, @@ -2354,7 +2354,7 @@ async def upload_file_with_required_file_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[ApiResponse]: + ) -> ApiResponse[ModelApiResponse]: """uploads an image (required) @@ -2398,7 +2398,7 @@ async def upload_file_with_required_file_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ApiResponse", + '200': "ModelApiResponse", } response_data = await self.api_client.call_api( *_param, @@ -2473,7 +2473,7 @@ async def upload_file_with_required_file_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ApiResponse", + '200': "ModelApiResponse", } response_data = await self.api_client.call_api( *_param, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/store_api.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/store_api.py index 0a7a69757333..b19e155eef12 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/store_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/store_api.py @@ -28,7 +28,7 @@ from petstore_api.models.order import Order from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse as _ApiResponse +from petstore_api.api_response import ApiResponse from petstore_api.rest import RESTResponseType @@ -129,7 +129,7 @@ async def delete_order_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -377,7 +377,7 @@ async def get_inventory_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[Dict[str, int]]: + ) -> ApiResponse[Dict[str, int]]: """Returns pet inventories by status Returns a map of status codes to quantities @@ -627,7 +627,7 @@ async def get_order_by_id_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[Order]: + ) -> ApiResponse[Order]: """Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -890,7 +890,7 @@ async def place_order_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[Order]: + ) -> ApiResponse[Order]: """Place an order for a pet diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/user_api.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/user_api.py index c11bf6503887..a33ab26881bb 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/user_api.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api/user_api.py @@ -28,7 +28,7 @@ from petstore_api.models.user import User from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse as _ApiResponse +from petstore_api.api_response import ApiResponse from petstore_api.rest import RESTResponseType @@ -127,7 +127,7 @@ async def create_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=3)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Create user This can only be done by the logged in user. @@ -393,7 +393,7 @@ async def create_users_with_array_input_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Creates list of users with given input array @@ -655,7 +655,7 @@ async def create_users_with_list_input_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Creates list of users with given input array @@ -919,7 +919,7 @@ async def delete_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Delete user This can only be done by the logged in user. @@ -1174,7 +1174,7 @@ async def get_user_by_name_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[User]: + ) -> ApiResponse[User]: """Get user by user name @@ -1442,7 +1442,7 @@ async def login_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Logs user into the system @@ -1710,7 +1710,7 @@ async def logout_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Logs out current logged in user session @@ -1955,7 +1955,7 @@ async def update_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Updated user This can only be done by the logged in user. diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/__init__.py index c106409daa97..945dd198de1a 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/__init__.py @@ -22,7 +22,6 @@ from petstore_api.models.animal import Animal from petstore_api.models.any_of_color import AnyOfColor from petstore_api.models.any_of_pig import AnyOfPig -from petstore_api.models.api_response import ApiResponse from petstore_api.models.array_of_array_of_model import ArrayOfArrayOfModel from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly from petstore_api.models.array_of_number_only import ArrayOfNumberOnly @@ -61,6 +60,7 @@ from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass from petstore_api.models.model200_response import Model200Response +from petstore_api.models.model_api_response import ModelApiResponse from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.nullable_class import NullableClass diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/api_response.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model_api_response.py similarity index 92% rename from samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/api_response.py rename to samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model_api_response.py index 90e05a8d1b0a..3d98389554b1 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/api_response.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model_api_response.py @@ -23,9 +23,9 @@ from typing import Optional, Set from typing_extensions import Self -class ApiResponse(BaseModel): +class ModelApiResponse(BaseModel): """ - ApiResponse + ModelApiResponse """ # noqa: E501 code: Optional[StrictInt] = None type: Optional[StrictStr] = None @@ -50,7 +50,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of ApiResponse from a JSON string""" + """Create an instance of ModelApiResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -75,7 +75,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: - """Create an instance of ApiResponse from a dict""" + """Create an instance of ModelApiResponse from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python-aiohttp/test/test_api_response.py b/samples/openapi3/client/petstore/python-aiohttp/test/test_api_response.py deleted file mode 100644 index 54871268a190..000000000000 --- a/samples/openapi3/client/petstore/python-aiohttp/test/test_api_response.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding: utf-8 - -""" - OpenAPI Petstore - - This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import petstore_api -from petstore_api.models.api_response import ApiResponse # noqa: E501 -from petstore_api.rest import ApiException - -class TestApiResponse(unittest.TestCase): - """ApiResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test ApiResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = petstore_api.models.api_response.ApiResponse() # noqa: E501 - if include_optional : - return ApiResponse( - code = 56, - type = '', - message = '' - ) - else : - return ApiResponse( - ) - - def testApiResponse(self): - """Test ApiResponse""" - # inst_req_only = self.make_instance(include_optional=False) - # inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python-aiohttp/test/test_model_api_response.py b/samples/openapi3/client/petstore/python-aiohttp/test/test_model_api_response.py new file mode 100644 index 000000000000..f37f34084401 --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/test/test_model_api_response.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from petstore_api.models.model_api_response import ModelApiResponse + +class TestModelApiResponse(unittest.TestCase): + """ModelApiResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ModelApiResponse: + """Test ModelApiResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `ModelApiResponse` + """ + model = ModelApiResponse() + if include_optional: + return ModelApiResponse( + code = 56, + type = '', + message = '' + ) + else: + return ModelApiResponse( + ) + """ + + def testModelApiResponse(self): + """Test ModelApiResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python/.openapi-generator/FILES b/samples/openapi3/client/petstore/python/.openapi-generator/FILES index 06be01a3bab9..090c6c431e53 100755 --- a/samples/openapi3/client/petstore/python/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python/.openapi-generator/FILES @@ -12,7 +12,6 @@ docs/Animal.md docs/AnotherFakeApi.md docs/AnyOfColor.md docs/AnyOfPig.md -docs/ApiResponse.md docs/ArrayOfArrayOfModel.md docs/ArrayOfArrayOfNumberOnly.md docs/ArrayOfNumberOnly.md @@ -54,6 +53,7 @@ docs/MapOfArrayOfModel.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md docs/Model200Response.md +docs/ModelApiResponse.md docs/ModelReturn.md docs/Name.md docs/NullableClass.md @@ -116,7 +116,6 @@ petstore_api/models/all_of_with_single_ref.py petstore_api/models/animal.py petstore_api/models/any_of_color.py petstore_api/models/any_of_pig.py -petstore_api/models/api_response.py petstore_api/models/array_of_array_of_model.py petstore_api/models/array_of_array_of_number_only.py petstore_api/models/array_of_number_only.py @@ -155,6 +154,7 @@ petstore_api/models/map_of_array_of_model.py petstore_api/models/map_test.py petstore_api/models/mixed_properties_and_additional_properties_class.py petstore_api/models/model200_response.py +petstore_api/models/model_api_response.py petstore_api/models/model_return.py petstore_api/models/name.py petstore_api/models/nullable_class.py diff --git a/samples/openapi3/client/petstore/python/README.md b/samples/openapi3/client/petstore/python/README.md index 2b705d722f3d..9a2bf6add781 100755 --- a/samples/openapi3/client/petstore/python/README.md +++ b/samples/openapi3/client/petstore/python/README.md @@ -146,7 +146,6 @@ Class | Method | HTTP request | Description - [Animal](docs/Animal.md) - [AnyOfColor](docs/AnyOfColor.md) - [AnyOfPig](docs/AnyOfPig.md) - - [ApiResponse](docs/ApiResponse.md) - [ArrayOfArrayOfModel](docs/ArrayOfArrayOfModel.md) - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) - [ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md) @@ -185,6 +184,7 @@ Class | Method | HTTP request | Description - [MapTest](docs/MapTest.md) - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) - [Model200Response](docs/Model200Response.md) + - [ModelApiResponse](docs/ModelApiResponse.md) - [ModelReturn](docs/ModelReturn.md) - [Name](docs/Name.md) - [NullableClass](docs/NullableClass.md) diff --git a/samples/openapi3/client/petstore/python/docs/ApiResponse.md b/samples/openapi3/client/petstore/python/docs/ModelApiResponse.md similarity index 55% rename from samples/openapi3/client/petstore/python/docs/ApiResponse.md rename to samples/openapi3/client/petstore/python/docs/ModelApiResponse.md index 866258d527c8..659823b8051f 100644 --- a/samples/openapi3/client/petstore/python/docs/ApiResponse.md +++ b/samples/openapi3/client/petstore/python/docs/ModelApiResponse.md @@ -1,4 +1,4 @@ -# ApiResponse +# ModelApiResponse ## Properties @@ -12,19 +12,19 @@ Name | Type | Description | Notes ## Example ```python -from petstore_api.models.api_response import ApiResponse +from petstore_api.models.model_api_response import ModelApiResponse # TODO update the JSON string below json = "{}" -# create an instance of ApiResponse from a JSON string -api_response_instance = ApiResponse.from_json(json) +# create an instance of ModelApiResponse from a JSON string +model_api_response_instance = ModelApiResponse.from_json(json) # print the JSON string representation of the object -print ApiResponse.to_json() +print ModelApiResponse.to_json() # convert the object into a dict -api_response_dict = api_response_instance.to_dict() -# create an instance of ApiResponse from a dict -api_response_form_dict = api_response.from_dict(api_response_dict) +model_api_response_dict = model_api_response_instance.to_dict() +# create an instance of ModelApiResponse from a dict +model_api_response_form_dict = model_api_response.from_dict(model_api_response_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/python/docs/PetApi.md b/samples/openapi3/client/petstore/python/docs/PetApi.md index 40f84eb3bd2e..993ebd204622 100644 --- a/samples/openapi3/client/petstore/python/docs/PetApi.md +++ b/samples/openapi3/client/petstore/python/docs/PetApi.md @@ -817,7 +817,7 @@ void (empty response body) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **upload_file** -> ApiResponse upload_file(pet_id, additional_metadata=additional_metadata, file=file) +> ModelApiResponse upload_file(pet_id, additional_metadata=additional_metadata, file=file) uploads an image @@ -831,7 +831,7 @@ uploads an image import time import os import petstore_api -from petstore_api.models.api_response import ApiResponse +from petstore_api.models.model_api_response import ModelApiResponse from petstore_api.rest import ApiException from pprint import pprint @@ -878,7 +878,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization @@ -898,7 +898,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **upload_file_with_required_file** -> ApiResponse upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata) +> ModelApiResponse upload_file_with_required_file(pet_id, required_file, additional_metadata=additional_metadata) uploads an image (required) @@ -912,7 +912,7 @@ uploads an image (required) import time import os import petstore_api -from petstore_api.models.api_response import ApiResponse +from petstore_api.models.model_api_response import ModelApiResponse from petstore_api.rest import ApiException from pprint import pprint @@ -959,7 +959,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +[**ModelApiResponse**](ModelApiResponse.md) ### Authorization diff --git a/samples/openapi3/client/petstore/python/petstore_api/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/__init__.py index 112f8a4abdaa..f791bc531127 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python/petstore_api/__init__.py @@ -26,7 +26,7 @@ from petstore_api.api.user_api import UserApi # import ApiClient -#from petstore_api.api_response import ApiResponse +from petstore_api.api_response import ApiResponse from petstore_api.api_client import ApiClient from petstore_api.configuration import Configuration from petstore_api.exceptions import OpenApiException @@ -46,7 +46,6 @@ from petstore_api.models.animal import Animal from petstore_api.models.any_of_color import AnyOfColor from petstore_api.models.any_of_pig import AnyOfPig -from petstore_api.models.api_response import ApiResponse from petstore_api.models.array_of_array_of_model import ArrayOfArrayOfModel from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly from petstore_api.models.array_of_number_only import ArrayOfNumberOnly @@ -85,6 +84,7 @@ from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass from petstore_api.models.model200_response import Model200Response +from petstore_api.models.model_api_response import ModelApiResponse from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.nullable_class import NullableClass diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py index 91b14d67fed4..2371780ade74 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py @@ -24,7 +24,7 @@ from petstore_api.models.client import Client from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse as _ApiResponse +from petstore_api.api_response import ApiResponse from petstore_api.rest import RESTResponseType @@ -124,7 +124,7 @@ def call_123_test_special_tags_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[Client]: + ) -> ApiResponse[Client]: """To test special tags To test special tags and operation ID starting with number diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py index 892981cfd240..4c42d2452a5b 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py @@ -22,7 +22,7 @@ from petstore_api.models.foo_get_default_response import FooGetDefaultResponse from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse as _ApiResponse +from petstore_api.api_response import ApiResponse from petstore_api.rest import RESTResponseType @@ -115,7 +115,7 @@ def foo_get_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[FooGetDefaultResponse]: + ) -> ApiResponse[FooGetDefaultResponse]: """foo_get diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py index 4868dc660f64..90b2cc1b80ee 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py @@ -39,7 +39,7 @@ from petstore_api.models.user import User from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse as _ApiResponse +from petstore_api.api_response import ApiResponse from petstore_api.rest import RESTResponseType @@ -138,7 +138,7 @@ def fake_any_type_request_body_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test any type request body @@ -399,7 +399,7 @@ def fake_enum_ref_query_parameter_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test enum reference query parameter @@ -644,7 +644,7 @@ def fake_health_get_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[HealthCheckResult]: + ) -> ApiResponse[HealthCheckResult]: """Health check endpoint @@ -898,7 +898,7 @@ def fake_http_signature_test_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test http signature authentication @@ -1184,7 +1184,7 @@ def fake_outer_boolean_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[bool]: + ) -> ApiResponse[bool]: """fake_outer_boolean_serialize Test serialization of outer boolean types @@ -1454,7 +1454,7 @@ def fake_outer_composite_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[OuterComposite]: + ) -> ApiResponse[OuterComposite]: """fake_outer_composite_serialize Test serialization of object with outer number type @@ -1724,7 +1724,7 @@ def fake_outer_number_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[float]: + ) -> ApiResponse[float]: """fake_outer_number_serialize Test serialization of outer number types @@ -1994,7 +1994,7 @@ def fake_outer_string_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """fake_outer_string_serialize Test serialization of outer string types @@ -2264,7 +2264,7 @@ def fake_property_enum_integer_serialize_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[OuterObjectWithEnumProperty]: + ) -> ApiResponse[OuterObjectWithEnumProperty]: """fake_property_enum_integer_serialize Test serialization of enum (int) properties with examples @@ -2528,7 +2528,7 @@ def fake_ref_enum_string_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[EnumClass]: + ) -> ApiResponse[EnumClass]: """test ref to enum string @@ -2767,7 +2767,7 @@ def fake_return_list_of_objects_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[List[List[Tag]]]: + ) -> ApiResponse[List[List[Tag]]]: """test returning list of objects @@ -3011,7 +3011,7 @@ def fake_uuid_example_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test uuid example @@ -3262,7 +3262,7 @@ def test_body_with_binary_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test_body_with_binary For this test, the body has to be a binary file. @@ -3531,7 +3531,7 @@ def test_body_with_file_schema_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test_body_with_file_schema For this test, the body for this request must reference a schema named `File`. @@ -3799,7 +3799,7 @@ def test_body_with_query_params_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test_body_with_query_params @@ -4073,7 +4073,7 @@ def test_client_model_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[Client]: + ) -> ApiResponse[Client]: """To test \"client\" model To test \"client\" model @@ -4347,7 +4347,7 @@ def test_date_time_query_parameter_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test_date_time_query_parameter @@ -4615,7 +4615,7 @@ def test_empty_and_non_empty_responses_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test empty and non-empty responses @@ -4935,7 +4935,7 @@ def test_endpoint_parameters_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -5338,7 +5338,7 @@ def test_error_responses_with_model_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test error responses with model @@ -5612,7 +5612,7 @@ def test_group_parameters_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Fake endpoint to test group parameters (optional) Fake endpoint to test group parameters (optional) @@ -5922,7 +5922,7 @@ def test_inline_additional_properties_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test inline additionalProperties @@ -6186,7 +6186,7 @@ def test_inline_freeform_additional_properties_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test inline free-form additionalProperties @@ -6455,7 +6455,7 @@ def test_json_form_data_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test json serialization of form data @@ -6759,7 +6759,7 @@ def test_query_parameter_collection_format_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """test_query_parameter_collection_format To test the collection format in query parameters diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags123_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags123_api.py index ac4f851d3086..a4dc7e810a6e 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags123_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags123_api.py @@ -24,7 +24,7 @@ from petstore_api.models.client import Client from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse as _ApiResponse +from petstore_api.api_response import ApiResponse from petstore_api.rest import RESTResponseType @@ -124,7 +124,7 @@ def test_classname_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[Client]: + ) -> ApiResponse[Client]: """To test class name in snake case To test class name in snake case diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py index d8a99e70527c..501b9f648a13 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py @@ -25,11 +25,11 @@ from typing import List, Optional, Union -from petstore_api.models.api_response import ApiResponse +from petstore_api.models.model_api_response import ModelApiResponse from petstore_api.models.pet import Pet from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse as _ApiResponse +from petstore_api.api_response import ApiResponse from petstore_api.rest import RESTResponseType @@ -130,7 +130,7 @@ def add_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Add a new pet to the store @@ -405,7 +405,7 @@ def delete_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Deletes a pet @@ -670,7 +670,7 @@ def find_pets_by_status_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[List[Pet]]: + ) -> ApiResponse[List[Pet]]: """Finds Pets by status Multiple status values can be provided with comma separated strings @@ -937,7 +937,7 @@ def find_pets_by_tags_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[List[Pet]]: + ) -> ApiResponse[List[Pet]]: """(Deprecated) Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -1206,7 +1206,7 @@ def get_pet_by_id_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[Pet]: + ) -> ApiResponse[Pet]: """Find pet by ID Returns a single pet @@ -1472,7 +1472,7 @@ def update_pet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Update an existing pet @@ -1756,7 +1756,7 @@ def update_pet_with_form_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Updates a pet in the store with form data @@ -1978,7 +1978,7 @@ def upload_file( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse: + ) -> ModelApiResponse: """uploads an image @@ -2022,7 +2022,7 @@ def upload_file( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ApiResponse", + '200': "ModelApiResponse", } response_data = self.api_client.call_api( *_param, @@ -2053,7 +2053,7 @@ def upload_file_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[ApiResponse]: + ) -> ApiResponse[ModelApiResponse]: """uploads an image @@ -2097,7 +2097,7 @@ def upload_file_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ApiResponse", + '200': "ModelApiResponse", } response_data = self.api_client.call_api( *_param, @@ -2172,7 +2172,7 @@ def upload_file_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ApiResponse", + '200': "ModelApiResponse", } response_data = self.api_client.call_api( *_param, @@ -2279,7 +2279,7 @@ def upload_file_with_required_file( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse: + ) -> ModelApiResponse: """uploads an image (required) @@ -2323,7 +2323,7 @@ def upload_file_with_required_file( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ApiResponse", + '200': "ModelApiResponse", } response_data = self.api_client.call_api( *_param, @@ -2354,7 +2354,7 @@ def upload_file_with_required_file_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[ApiResponse]: + ) -> ApiResponse[ModelApiResponse]: """uploads an image (required) @@ -2398,7 +2398,7 @@ def upload_file_with_required_file_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ApiResponse", + '200': "ModelApiResponse", } response_data = self.api_client.call_api( *_param, @@ -2473,7 +2473,7 @@ def upload_file_with_required_file_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ApiResponse", + '200': "ModelApiResponse", } response_data = self.api_client.call_api( *_param, diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py index 481af9f78f70..8e3169aaa788 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py @@ -28,7 +28,7 @@ from petstore_api.models.order import Order from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse as _ApiResponse +from petstore_api.api_response import ApiResponse from petstore_api.rest import RESTResponseType @@ -129,7 +129,7 @@ def delete_order_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -377,7 +377,7 @@ def get_inventory_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[Dict[str, int]]: + ) -> ApiResponse[Dict[str, int]]: """Returns pet inventories by status Returns a map of status codes to quantities @@ -627,7 +627,7 @@ def get_order_by_id_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[Order]: + ) -> ApiResponse[Order]: """Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -890,7 +890,7 @@ def place_order_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[Order]: + ) -> ApiResponse[Order]: """Place an order for a pet diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py index 622a473377f3..18cf0177ac54 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py @@ -28,7 +28,7 @@ from petstore_api.models.user import User from petstore_api.api_client import ApiClient -from petstore_api.api_response import ApiResponse as _ApiResponse +from petstore_api.api_response import ApiResponse from petstore_api.rest import RESTResponseType @@ -127,7 +127,7 @@ def create_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=3)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Create user This can only be done by the logged in user. @@ -393,7 +393,7 @@ def create_users_with_array_input_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Creates list of users with given input array @@ -655,7 +655,7 @@ def create_users_with_list_input_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Creates list of users with given input array @@ -919,7 +919,7 @@ def delete_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Delete user This can only be done by the logged in user. @@ -1174,7 +1174,7 @@ def get_user_by_name_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[User]: + ) -> ApiResponse[User]: """Get user by user name @@ -1442,7 +1442,7 @@ def login_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[str]: + ) -> ApiResponse[str]: """Logs user into the system @@ -1710,7 +1710,7 @@ def logout_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Logs out current logged in user session @@ -1955,7 +1955,7 @@ def update_user_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> _ApiResponse[None]: + ) -> ApiResponse[None]: """Updated user This can only be done by the logged in user. diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py index c106409daa97..945dd198de1a 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py @@ -22,7 +22,6 @@ from petstore_api.models.animal import Animal from petstore_api.models.any_of_color import AnyOfColor from petstore_api.models.any_of_pig import AnyOfPig -from petstore_api.models.api_response import ApiResponse from petstore_api.models.array_of_array_of_model import ArrayOfArrayOfModel from petstore_api.models.array_of_array_of_number_only import ArrayOfArrayOfNumberOnly from petstore_api.models.array_of_number_only import ArrayOfNumberOnly @@ -61,6 +60,7 @@ from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass from petstore_api.models.model200_response import Model200Response +from petstore_api.models.model_api_response import ModelApiResponse from petstore_api.models.model_return import ModelReturn from petstore_api.models.name import Name from petstore_api.models.nullable_class import NullableClass diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/api_response.py b/samples/openapi3/client/petstore/python/petstore_api/models/model_api_response.py similarity index 94% rename from samples/openapi3/client/petstore/python/petstore_api/models/api_response.py rename to samples/openapi3/client/petstore/python/petstore_api/models/model_api_response.py index efd9710840f2..c02396266663 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/api_response.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/model_api_response.py @@ -23,9 +23,9 @@ from typing import Optional, Set from typing_extensions import Self -class ApiResponse(BaseModel): +class ModelApiResponse(BaseModel): """ - ApiResponse + ModelApiResponse """ # noqa: E501 code: Optional[StrictInt] = None type: Optional[StrictStr] = None @@ -51,7 +51,7 @@ def to_json(self) -> str: @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of ApiResponse from a JSON string""" + """Create an instance of ModelApiResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -83,7 +83,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict]) -> Optional[Self]: - """Create an instance of ApiResponse from a dict""" + """Create an instance of ModelApiResponse from a dict""" if obj is None: return None diff --git a/samples/openapi3/client/petstore/python/test/test_api_response.py b/samples/openapi3/client/petstore/python/test/test_api_response.py deleted file mode 100644 index 95efd33bce57..000000000000 --- a/samples/openapi3/client/petstore/python/test/test_api_response.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding: utf-8 - -""" - OpenAPI Petstore - - This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by: https://openapi-generator.tech -""" - - -from __future__ import absolute_import - -import unittest -import datetime - -import petstore_api -from petstore_api.models.api_response import ApiResponse # noqa: E501 -from petstore_api.rest import ApiException - -class TestApiResponse(unittest.TestCase): - """ApiResponse unit test stubs""" - - def setUp(self): - pass - - def tearDown(self): - pass - - def make_instance(self, include_optional): - """Test ApiResponse - include_option is a boolean, when False only required - params are included, when True both required and - optional params are included """ - # model = petstore_api.models.api_response.ApiResponse() # noqa: E501 - if include_optional : - return ApiResponse( - code = 56, - type = '', - message = '' - ) - else : - return ApiResponse( - ) - - def testApiResponse(self): - """Test ApiResponse""" - inst_req_only = self.make_instance(include_optional=False) - inst_req_and_optional = self.make_instance(include_optional=True) - -if __name__ == '__main__': - unittest.main() diff --git a/samples/openapi3/client/petstore/python/test/test_model_api_response.py b/samples/openapi3/client/petstore/python/test/test_model_api_response.py new file mode 100644 index 000000000000..f37f34084401 --- /dev/null +++ b/samples/openapi3/client/petstore/python/test/test_model_api_response.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from petstore_api.models.model_api_response import ModelApiResponse + +class TestModelApiResponse(unittest.TestCase): + """ModelApiResponse unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ModelApiResponse: + """Test ModelApiResponse + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `ModelApiResponse` + """ + model = ModelApiResponse() + if include_optional: + return ModelApiResponse( + code = 56, + type = '', + message = '' + ) + else: + return ModelApiResponse( + ) + """ + + def testModelApiResponse(self): + """Test ModelApiResponse""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() From 0230af2f9c9442bc052e168c39cf1dc8407dab98 Mon Sep 17 00:00:00 2001 From: Jonathan Ballet Date: Tue, 2 Jan 2024 18:57:12 +0100 Subject: [PATCH 8/8] adjust type of 'any/one_of_schemas' fields --- .../src/main/resources/python/model_anyof.mustache | 2 +- .../src/main/resources/python/model_oneof.mustache | 2 +- .../petstore/python-aiohttp/petstore_api/models/any_of_color.py | 2 +- .../petstore/python-aiohttp/petstore_api/models/any_of_pig.py | 2 +- .../client/petstore/python-aiohttp/petstore_api/models/color.py | 2 +- .../python-aiohttp/petstore_api/models/int_or_string.py | 2 +- .../python-aiohttp/petstore_api/models/one_of_enum_string.py | 2 +- .../client/petstore/python-aiohttp/petstore_api/models/pig.py | 2 +- .../client/petstore/python/petstore_api/models/any_of_color.py | 2 +- .../client/petstore/python/petstore_api/models/any_of_pig.py | 2 +- .../client/petstore/python/petstore_api/models/color.py | 2 +- .../client/petstore/python/petstore_api/models/int_or_string.py | 2 +- .../petstore/python/petstore_api/models/one_of_enum_string.py | 2 +- .../openapi3/client/petstore/python/petstore_api/models/pig.py | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python/model_anyof.mustache b/modules/openapi-generator/src/main/resources/python/model_anyof.mustache index 31096e3ecb42..cc3c8d43ac0a 100644 --- a/modules/openapi-generator/src/main/resources/python/model_anyof.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_anyof.mustache @@ -31,7 +31,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} actual_instance: Optional[Union[{{#anyOf}}{{{.}}}{{^-last}}, {{/-last}}{{/anyOf}}]] = None else: actual_instance: Any = None - #any_of_schemas: List[str] = Literal[{{#lambda.uppercase}}{{{classname}}}{{/lambda.uppercase}}_ANY_OF_SCHEMAS] + any_of_schemas: List[str] = Field(default=Literal[{{#anyOf}}"{{.}}"{{^-last}}, {{/-last}}{{/anyOf}}]) model_config = { "validate_assignment": True, diff --git a/modules/openapi-generator/src/main/resources/python/model_oneof.mustache b/modules/openapi-generator/src/main/resources/python/model_oneof.mustache index 69dd8f0c9295..850ce94f5244 100644 --- a/modules/openapi-generator/src/main/resources/python/model_oneof.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_oneof.mustache @@ -27,7 +27,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} {{vendorExtensions.x-py-name}}: {{{vendorExtensions.x-py-typing}}} {{/composedSchemas.oneOf}} actual_instance: Optional[Union[{{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}]] = None - #one_of_schemas = Literal[{{#oneOf}}"{{.}}"{{^-last}}, {{/-last}}{{/oneOf}}] + one_of_schemas: List[str] = Field(default=Literal[{{#oneOf}}"{{.}}"{{^-last}}, {{/-last}}{{/oneOf}}]) model_config = { "validate_assignment": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/any_of_color.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/any_of_color.py index e47be4dc9539..d73c244865d7 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/any_of_color.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/any_of_color.py @@ -43,7 +43,7 @@ class AnyOfColor(BaseModel): actual_instance: Optional[Union[List[int], str]] = None else: actual_instance: Any = None - #any_of_schemas: List[str] = Literal[ANYOFCOLOR_ANY_OF_SCHEMAS] + any_of_schemas: List[str] = Field(default=Literal["List[int]", "str"]) model_config = { "validate_assignment": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/any_of_pig.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/any_of_pig.py index 917567c88d39..f8333b1d91d2 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/any_of_pig.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/any_of_pig.py @@ -41,7 +41,7 @@ class AnyOfPig(BaseModel): actual_instance: Optional[Union[BasquePig, DanishPig]] = None else: actual_instance: Any = None - #any_of_schemas: List[str] = Literal[ANYOFPIG_ANY_OF_SCHEMAS] + any_of_schemas: List[str] = Field(default=Literal["BasquePig", "DanishPig"]) model_config = { "validate_assignment": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/color.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/color.py index f71a5cb4e333..133d986dd63e 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/color.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/color.py @@ -39,7 +39,7 @@ class Color(BaseModel): # data type: str oneof_schema_3_validator: Optional[Annotated[str, Field(min_length=7, strict=True, max_length=7)]] = Field(default=None, description="Hex color string, such as #00FF00.") actual_instance: Optional[Union[List[int], str]] = None - #one_of_schemas = Literal["List[int]", "str"] + one_of_schemas: List[str] = Field(default=Literal["List[int]", "str"]) model_config = { "validate_assignment": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/int_or_string.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/int_or_string.py index 489820634d84..27db0e86cca4 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/int_or_string.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/int_or_string.py @@ -37,7 +37,7 @@ class IntOrString(BaseModel): # data type: str oneof_schema_2_validator: Optional[StrictStr] = None actual_instance: Optional[Union[int, str]] = None - #one_of_schemas = Literal["int", "str"] + one_of_schemas: List[str] = Field(default=Literal["int", "str"]) model_config = { "validate_assignment": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/one_of_enum_string.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/one_of_enum_string.py index 36dc89230d95..8957a63eb767 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/one_of_enum_string.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/one_of_enum_string.py @@ -37,7 +37,7 @@ class OneOfEnumString(BaseModel): # data type: EnumString2 oneof_schema_2_validator: Optional[EnumString2] = None actual_instance: Optional[Union[EnumString1, EnumString2]] = None - #one_of_schemas = Literal["EnumString1", "EnumString2"] + one_of_schemas: List[str] = Field(default=Literal["EnumString1", "EnumString2"]) model_config = { "validate_assignment": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pig.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pig.py index af0a3faf5f80..94e4087cc88f 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pig.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pig.py @@ -37,7 +37,7 @@ class Pig(BaseModel): # data type: DanishPig oneof_schema_2_validator: Optional[DanishPig] = None actual_instance: Optional[Union[BasquePig, DanishPig]] = None - #one_of_schemas = Literal["BasquePig", "DanishPig"] + one_of_schemas: List[str] = Field(default=Literal["BasquePig", "DanishPig"]) model_config = { "validate_assignment": True, diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/any_of_color.py b/samples/openapi3/client/petstore/python/petstore_api/models/any_of_color.py index e47be4dc9539..d73c244865d7 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/any_of_color.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/any_of_color.py @@ -43,7 +43,7 @@ class AnyOfColor(BaseModel): actual_instance: Optional[Union[List[int], str]] = None else: actual_instance: Any = None - #any_of_schemas: List[str] = Literal[ANYOFCOLOR_ANY_OF_SCHEMAS] + any_of_schemas: List[str] = Field(default=Literal["List[int]", "str"]) model_config = { "validate_assignment": True, diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/any_of_pig.py b/samples/openapi3/client/petstore/python/petstore_api/models/any_of_pig.py index 917567c88d39..f8333b1d91d2 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/any_of_pig.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/any_of_pig.py @@ -41,7 +41,7 @@ class AnyOfPig(BaseModel): actual_instance: Optional[Union[BasquePig, DanishPig]] = None else: actual_instance: Any = None - #any_of_schemas: List[str] = Literal[ANYOFPIG_ANY_OF_SCHEMAS] + any_of_schemas: List[str] = Field(default=Literal["BasquePig", "DanishPig"]) model_config = { "validate_assignment": True, diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/color.py b/samples/openapi3/client/petstore/python/petstore_api/models/color.py index f71a5cb4e333..133d986dd63e 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/color.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/color.py @@ -39,7 +39,7 @@ class Color(BaseModel): # data type: str oneof_schema_3_validator: Optional[Annotated[str, Field(min_length=7, strict=True, max_length=7)]] = Field(default=None, description="Hex color string, such as #00FF00.") actual_instance: Optional[Union[List[int], str]] = None - #one_of_schemas = Literal["List[int]", "str"] + one_of_schemas: List[str] = Field(default=Literal["List[int]", "str"]) model_config = { "validate_assignment": True, diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/int_or_string.py b/samples/openapi3/client/petstore/python/petstore_api/models/int_or_string.py index 489820634d84..27db0e86cca4 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/int_or_string.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/int_or_string.py @@ -37,7 +37,7 @@ class IntOrString(BaseModel): # data type: str oneof_schema_2_validator: Optional[StrictStr] = None actual_instance: Optional[Union[int, str]] = None - #one_of_schemas = Literal["int", "str"] + one_of_schemas: List[str] = Field(default=Literal["int", "str"]) model_config = { "validate_assignment": True, diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/one_of_enum_string.py b/samples/openapi3/client/petstore/python/petstore_api/models/one_of_enum_string.py index 36dc89230d95..8957a63eb767 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/one_of_enum_string.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/one_of_enum_string.py @@ -37,7 +37,7 @@ class OneOfEnumString(BaseModel): # data type: EnumString2 oneof_schema_2_validator: Optional[EnumString2] = None actual_instance: Optional[Union[EnumString1, EnumString2]] = None - #one_of_schemas = Literal["EnumString1", "EnumString2"] + one_of_schemas: List[str] = Field(default=Literal["EnumString1", "EnumString2"]) model_config = { "validate_assignment": True, diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/pig.py b/samples/openapi3/client/petstore/python/petstore_api/models/pig.py index 51a14fe1e9e4..14051026b2f4 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/pig.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/pig.py @@ -37,7 +37,7 @@ class Pig(BaseModel): # data type: DanishPig oneof_schema_2_validator: Optional[DanishPig] = None actual_instance: Optional[Union[BasquePig, DanishPig]] = None - #one_of_schemas = Literal["BasquePig", "DanishPig"] + one_of_schemas: List[str] = Field(default=Literal["BasquePig", "DanishPig"]) model_config = { "validate_assignment": True,