From 02397bc9db1648e2d7ad63f52bb631d72d00a5c1 Mon Sep 17 00:00:00 2001 From: Obeida Shamoun <2135622+oshmoun@users.noreply.github.com> Date: Thu, 31 Aug 2023 14:45:59 +0200 Subject: [PATCH 1/2] python: generate code based on pydantic v2 --- .../main/resources/python-fastapi/requirements.mustache | 4 ++-- .../src/main/resources/python/api.mustache | 6 +++--- .../src/main/resources/python/model_anyof.mustache | 5 +++-- .../src/main/resources/python/model_generic.mustache | 9 +++++---- .../src/main/resources/python/model_oneof.mustache | 9 ++++----- .../src/main/resources/python/pyproject.mustache | 2 +- .../src/main/resources/python/requirements.mustache | 2 +- .../src/main/resources/python/setup.mustache | 2 +- 8 files changed, 20 insertions(+), 19 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python-fastapi/requirements.mustache b/modules/openapi-generator/src/main/resources/python-fastapi/requirements.mustache index e5a1b375c4c3..6e52599f1f75 100644 --- a/modules/openapi-generator/src/main/resources/python-fastapi/requirements.mustache +++ b/modules/openapi-generator/src/main/resources/python-fastapi/requirements.mustache @@ -7,7 +7,7 @@ chardet==4.0.0 click==7.1.2 dnspython==2.1.0 email-validator==1.1.2 -fastapi==0.95.2 +fastapi==0.103.0 graphene==2.1.8 graphql-core==2.3.2 graphql-relay==2.0.1 @@ -20,7 +20,7 @@ Jinja2==2.11.3 MarkupSafe==2.0.1 orjson==3.5.2 promise==2.3 -pydantic==1.8.2 +pydantic==2.3.0 python-dotenv==0.17.1 python-multipart==0.0.5 PyYAML==5.4.1 diff --git a/modules/openapi-generator/src/main/resources/python/api.mustache b/modules/openapi-generator/src/main/resources/python/api.mustache index 913e0dbbb28d..7864bab9cc55 100644 --- a/modules/openapi-generator/src/main/resources/python/api.mustache +++ b/modules/openapi-generator/src/main/resources/python/api.mustache @@ -6,7 +6,7 @@ import re # noqa: F401 import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated{{#asyncio}} from typing import overload, Optional, Union, Awaitable{{/asyncio}} @@ -46,7 +46,7 @@ class {{classname}}(object): ... {{/asyncio}} - @validate_arguments + @validate_call def {{operationId}}(self, {{#allParams}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/allParams}}{{#asyncio}}async_req: Optional[bool]=None, {{/asyncio}}**kwargs) -> {{#asyncio}}Union[{{{returnType}}}{{^returnType}}None{{/returnType}}, Awaitable[{{{returnType}}}{{^returnType}}None{{/returnType}}]]{{/asyncio}}{{^asyncio}}{{{returnType}}}{{^returnType}}None{{/returnType}}{{/asyncio}}: # noqa: E501 """{{#isDeprecated}}(Deprecated) {{/isDeprecated}}{{{summary}}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501 @@ -83,7 +83,7 @@ class {{classname}}(object): {{/asyncio}} return self.{{operationId}}_with_http_info({{#allParams}}{{paramName}}, {{/allParams}}**kwargs) # noqa: E501 - @validate_arguments + @validate_call def {{operationId}}_with_http_info(self, {{#allParams}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/allParams}}**kwargs) -> ApiResponse: # noqa: E501 """{{#isDeprecated}}(Deprecated) {{/isDeprecated}}{{{summary}}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501 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 74a007fbc192..cc774e208d66 100644 --- a/modules/openapi-generator/src/main/resources/python/model_anyof.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_anyof.mustache @@ -29,8 +29,9 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} actual_instance: Any any_of_schemas: List[str] = Field({{#lambda.uppercase}}{{{classname}}}{{/lambda.uppercase}}_ANY_OF_SCHEMAS, const=True) - class Config: - validate_assignment = True + model_config = { + "validate_assignment": True, + } {{#discriminator}} discriminator_value_class_map = { 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 1355ddbf20bb..999c9b099026 100644 --- a/modules/openapi-generator/src/main/resources/python/model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_generic.mustache @@ -73,10 +73,11 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} {{/isEnum}} {{/vars}} - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } {{#hasChildren}} {{#discriminator}} 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 c7afad4d172b..f374ee8c31fa 100644 --- a/modules/openapi-generator/src/main/resources/python/model_oneof.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_oneof.mustache @@ -12,8 +12,6 @@ import re # noqa: F401 from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field -{{#lambda.uppercase}}{{{classname}}}{{/lambda.uppercase}}_ONE_OF_SCHEMAS = [{{#oneOf}}"{{.}}"{{^-last}}, {{/-last}}{{/oneOf}}] - class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}): """ {{{description}}}{{^description}}{{{classname}}}{{/description}} @@ -26,10 +24,11 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} actual_instance: Union[{{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}] else: actual_instance: Any - one_of_schemas: List[str] = Field({{#lambda.uppercase}}{{{classname}}}{{/lambda.uppercase}}_ONE_OF_SCHEMAS, const=True) + one_of_schemas: List[str] = Literal[{{#oneOf}}"{{.}}"{{^-last}}, {{/-last}}{{/oneOf}}] - class Config: - validate_assignment = True + model_config = { + "validate_assignment": True, + } {{#discriminator}} discriminator_value_class_map = { diff --git a/modules/openapi-generator/src/main/resources/python/pyproject.mustache b/modules/openapi-generator/src/main/resources/python/pyproject.mustache index 75900ed9f8a6..c39a2353eb94 100644 --- a/modules/openapi-generator/src/main/resources/python/pyproject.mustache +++ b/modules/openapi-generator/src/main/resources/python/pyproject.mustache @@ -24,7 +24,7 @@ tornado = ">=4.2,<5" pem = ">= 19.3.0" pycryptodome = ">= 3.9.0" {{/hasHttpSignatureMethods}} -pydantic = "^1.10.5, <2" +pydantic = ">=2" aenum = ">=3.1.11" [tool.poetry.dev-dependencies] diff --git a/modules/openapi-generator/src/main/resources/python/requirements.mustache b/modules/openapi-generator/src/main/resources/python/requirements.mustache index bd4fe39d883b..045d6b43a7de 100644 --- a/modules/openapi-generator/src/main/resources/python/requirements.mustache +++ b/modules/openapi-generator/src/main/resources/python/requirements.mustache @@ -1,7 +1,7 @@ python_dateutil >= 2.5.3 setuptools >= 21.0.0 urllib3 >= 1.25.3, < 2.1.0 -pydantic >= 1.10.5, < 2 +pydantic >= 2 aenum >= 3.1.11 {{#asyncio}} aiohttp >= 3.0.0 diff --git a/modules/openapi-generator/src/main/resources/python/setup.mustache b/modules/openapi-generator/src/main/resources/python/setup.mustache index 538a8dff90fb..02759335b43b 100644 --- a/modules/openapi-generator/src/main/resources/python/setup.mustache +++ b/modules/openapi-generator/src/main/resources/python/setup.mustache @@ -29,7 +29,7 @@ REQUIRES = [ "pem>=19.3.0", "pycryptodome>=3.9.0", {{/hasHttpSignatureMethods}} - "pydantic >= 1.10.5, < 2", + "pydantic >= 2", "aenum" ] From b2c87692316389fac52c7b0311e511d9c28934a7 Mon Sep 17 00:00:00 2001 From: Obeida Shamoun <2135622+oshmoun@users.noreply.github.com> Date: Thu, 31 Aug 2023 16:04:53 +0200 Subject: [PATCH 2/2] Update python samples --- .../python/openapi_client/api/body_api.py | 30 +++---- .../python/openapi_client/api/form_api.py | 6 +- .../python/openapi_client/api/header_api.py | 6 +- .../python/openapi_client/api/path_api.py | 6 +- .../python/openapi_client/api/query_api.py | 34 ++++---- .../python/openapi_client/models/bird.py | 9 +- .../python/openapi_client/models/category.py | 9 +- .../openapi_client/models/data_query.py | 9 +- .../openapi_client/models/default_value.py | 9 +- .../models/number_properties_only.py | 9 +- .../python/openapi_client/models/pet.py | 9 +- .../python/openapi_client/models/query.py | 9 +- .../python/openapi_client/models/tag.py | 9 +- ...ue_object_all_of_query_object_parameter.py | 9 +- ...rue_array_string_query_object_parameter.py | 9 +- samples/client/echo_api/python/pyproject.toml | 2 +- .../client/echo_api/python/requirements.txt | 2 +- samples/client/echo_api/python/setup.py | 2 +- .../petstore_api/api/another_fake_api.py | 6 +- .../petstore_api/api/default_api.py | 6 +- .../petstore_api/api/fake_api.py | 86 +++++++++---------- .../api/fake_classname_tags123_api.py | 6 +- .../petstore_api/api/pet_api.py | 38 ++++---- .../petstore_api/api/store_api.py | 18 ++-- .../petstore_api/api/user_api.py | 34 ++++---- .../models/additional_properties_any_type.py | 9 +- .../models/additional_properties_class.py | 9 +- .../models/additional_properties_object.py | 9 +- ...tional_properties_with_description_only.py | 9 +- .../models/all_of_with_single_ref.py | 9 +- .../petstore_api/models/animal.py | 9 +- .../petstore_api/models/any_of_color.py | 5 +- .../petstore_api/models/any_of_pig.py | 5 +- .../petstore_api/models/api_response.py | 9 +- .../models/array_of_array_of_model.py | 9 +- .../models/array_of_array_of_number_only.py | 9 +- .../models/array_of_number_only.py | 9 +- .../petstore_api/models/array_test.py | 9 +- .../petstore_api/models/basque_pig.py | 9 +- .../petstore_api/models/capitalization.py | 9 +- .../python-aiohttp/petstore_api/models/cat.py | 9 +- .../petstore_api/models/category.py | 9 +- .../models/circular_reference_model.py | 9 +- .../petstore_api/models/class_model.py | 9 +- .../petstore_api/models/client.py | 9 +- .../petstore_api/models/color.py | 9 +- .../petstore_api/models/creature.py | 9 +- .../petstore_api/models/creature_info.py | 9 +- .../petstore_api/models/danish_pig.py | 9 +- .../petstore_api/models/deprecated_object.py | 9 +- .../python-aiohttp/petstore_api/models/dog.py | 9 +- .../petstore_api/models/dummy_model.py | 9 +- .../petstore_api/models/enum_arrays.py | 9 +- .../petstore_api/models/enum_test.py | 9 +- .../petstore_api/models/file.py | 9 +- .../models/file_schema_test_class.py | 9 +- .../petstore_api/models/first_ref.py | 9 +- .../python-aiohttp/petstore_api/models/foo.py | 9 +- .../models/foo_get_default_response.py | 9 +- .../petstore_api/models/format_test.py | 9 +- .../petstore_api/models/has_only_read_only.py | 9 +- .../models/health_check_result.py | 9 +- .../models/inner_dict_with_property.py | 9 +- .../petstore_api/models/int_or_string.py | 9 +- .../petstore_api/models/list.py | 9 +- .../models/map_of_array_of_model.py | 9 +- .../petstore_api/models/map_test.py | 9 +- ...perties_and_additional_properties_class.py | 9 +- .../petstore_api/models/model200_response.py | 9 +- .../petstore_api/models/model_return.py | 9 +- .../petstore_api/models/name.py | 9 +- .../petstore_api/models/nullable_class.py | 9 +- .../petstore_api/models/nullable_property.py | 9 +- .../petstore_api/models/number_only.py | 9 +- .../object_to_test_additional_properties.py | 9 +- .../models/object_with_deprecated_fields.py | 9 +- .../petstore_api/models/one_of_enum_string.py | 9 +- .../petstore_api/models/order.py | 9 +- .../petstore_api/models/outer_composite.py | 9 +- .../models/outer_object_with_enum_property.py | 9 +- .../petstore_api/models/parent.py | 9 +- .../models/parent_with_optional_dict.py | 9 +- .../python-aiohttp/petstore_api/models/pet.py | 9 +- .../python-aiohttp/petstore_api/models/pig.py | 9 +- .../models/property_name_collision.py | 9 +- .../petstore_api/models/read_only_first.py | 9 +- .../petstore_api/models/second_ref.py | 9 +- .../models/self_reference_model.py | 9 +- .../petstore_api/models/special_model_name.py | 9 +- .../petstore_api/models/special_name.py | 9 +- .../python-aiohttp/petstore_api/models/tag.py | 9 +- .../petstore_api/models/tiger.py | 9 +- .../petstore_api/models/user.py | 9 +- .../petstore_api/models/with_nested_one_of.py | 9 +- .../petstore/python-aiohttp/pyproject.toml | 2 +- .../petstore/python-aiohttp/requirements.txt | 2 +- .../client/petstore/python-aiohttp/setup.py | 2 +- .../petstore_api/api/another_fake_api.py | 6 +- .../python/petstore_api/api/default_api.py | 6 +- .../python/petstore_api/api/fake_api.py | 86 +++++++++---------- .../api/fake_classname_tags123_api.py | 6 +- .../python/petstore_api/api/pet_api.py | 38 ++++---- .../python/petstore_api/api/store_api.py | 18 ++-- .../python/petstore_api/api/user_api.py | 34 ++++---- .../models/additional_properties_any_type.py | 9 +- .../models/additional_properties_class.py | 9 +- .../models/additional_properties_object.py | 9 +- ...tional_properties_with_description_only.py | 9 +- .../models/all_of_with_single_ref.py | 9 +- .../python/petstore_api/models/animal.py | 9 +- .../petstore_api/models/any_of_color.py | 5 +- .../python/petstore_api/models/any_of_pig.py | 5 +- .../petstore_api/models/api_response.py | 9 +- .../models/array_of_array_of_model.py | 9 +- .../models/array_of_array_of_number_only.py | 9 +- .../models/array_of_number_only.py | 9 +- .../python/petstore_api/models/array_test.py | 9 +- .../python/petstore_api/models/basque_pig.py | 9 +- .../petstore_api/models/capitalization.py | 9 +- .../python/petstore_api/models/cat.py | 9 +- .../python/petstore_api/models/category.py | 9 +- .../models/circular_reference_model.py | 9 +- .../python/petstore_api/models/class_model.py | 9 +- .../python/petstore_api/models/client.py | 9 +- .../python/petstore_api/models/color.py | 9 +- .../python/petstore_api/models/creature.py | 9 +- .../petstore_api/models/creature_info.py | 9 +- .../python/petstore_api/models/danish_pig.py | 9 +- .../petstore_api/models/deprecated_object.py | 9 +- .../python/petstore_api/models/dog.py | 9 +- .../python/petstore_api/models/dummy_model.py | 9 +- .../python/petstore_api/models/enum_arrays.py | 9 +- .../python/petstore_api/models/enum_test.py | 9 +- .../python/petstore_api/models/file.py | 9 +- .../models/file_schema_test_class.py | 9 +- .../python/petstore_api/models/first_ref.py | 9 +- .../python/petstore_api/models/foo.py | 9 +- .../models/foo_get_default_response.py | 9 +- .../python/petstore_api/models/format_test.py | 9 +- .../petstore_api/models/has_only_read_only.py | 9 +- .../models/health_check_result.py | 9 +- .../models/inner_dict_with_property.py | 9 +- .../petstore_api/models/int_or_string.py | 9 +- .../python/petstore_api/models/list.py | 9 +- .../models/map_of_array_of_model.py | 9 +- .../python/petstore_api/models/map_test.py | 9 +- ...perties_and_additional_properties_class.py | 9 +- .../petstore_api/models/model200_response.py | 9 +- .../petstore_api/models/model_return.py | 9 +- .../python/petstore_api/models/name.py | 9 +- .../petstore_api/models/nullable_class.py | 9 +- .../petstore_api/models/nullable_property.py | 9 +- .../python/petstore_api/models/number_only.py | 9 +- .../object_to_test_additional_properties.py | 9 +- .../models/object_with_deprecated_fields.py | 9 +- .../petstore_api/models/one_of_enum_string.py | 9 +- .../python/petstore_api/models/order.py | 9 +- .../petstore_api/models/outer_composite.py | 9 +- .../models/outer_object_with_enum_property.py | 9 +- .../python/petstore_api/models/parent.py | 9 +- .../models/parent_with_optional_dict.py | 9 +- .../python/petstore_api/models/pet.py | 9 +- .../python/petstore_api/models/pig.py | 9 +- .../models/property_name_collision.py | 9 +- .../petstore_api/models/read_only_first.py | 9 +- .../python/petstore_api/models/second_ref.py | 9 +- .../models/self_reference_model.py | 9 +- .../petstore_api/models/special_model_name.py | 9 +- .../petstore_api/models/special_name.py | 9 +- .../python/petstore_api/models/tag.py | 9 +- .../python/petstore_api/models/tiger.py | 9 +- .../python/petstore_api/models/user.py | 9 +- .../petstore_api/models/with_nested_one_of.py | 9 +- .../client/petstore/python/pyproject.toml | 2 +- .../client/petstore/python/requirements.txt | 2 +- .../openapi3/client/petstore/python/setup.py | 2 +- .../petstore/python-fastapi/requirements.txt | 4 +- 177 files changed, 970 insertions(+), 838 deletions(-) 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 fa1953cecd30..174acceb202a 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,7 +17,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from pydantic import Field, StrictBytes, StrictStr, conlist @@ -47,7 +47,7 @@ def __init__(self, api_client=None): api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def test_binary_gif(self, **kwargs) -> bytearray: # noqa: E501 """Test binary (gif) response body # noqa: E501 @@ -74,7 +74,7 @@ def test_binary_gif(self, **kwargs) -> bytearray: # noqa: E501 raise ValueError("Error! Please call the test_binary_gif_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_binary_gif_with_http_info(**kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_binary_gif_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 """Test binary (gif) response body # noqa: E501 @@ -178,7 +178,7 @@ def test_binary_gif_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_body_application_octetstream_binary(self, body : Optional[Union[StrictBytes, StrictStr]] = None, **kwargs) -> str: # noqa: E501 """Test body parameter(s) # noqa: E501 @@ -207,7 +207,7 @@ def test_body_application_octetstream_binary(self, body : Optional[Union[StrictB raise ValueError("Error! Please call the test_body_application_octetstream_binary_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_body_application_octetstream_binary_with_http_info(body, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_body_application_octetstream_binary_with_http_info(self, body : Optional[Union[StrictBytes, StrictStr]] = None, **kwargs) -> ApiResponse: # noqa: E501 """Test body parameter(s) # noqa: E501 @@ -329,7 +329,7 @@ def test_body_application_octetstream_binary_with_http_info(self, body : Optiona collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_body_multipart_formdata_array_of_binary(self, files : conlist(Union[StrictBytes, StrictStr]), **kwargs) -> str: # noqa: E501 """Test array of binary in multipart mime # noqa: E501 @@ -358,7 +358,7 @@ def test_body_multipart_formdata_array_of_binary(self, files : conlist(Union[Str raise ValueError("Error! Please call the test_body_multipart_formdata_array_of_binary_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_body_multipart_formdata_array_of_binary_with_http_info(files, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_body_multipart_formdata_array_of_binary_with_http_info(self, files : conlist(Union[StrictBytes, StrictStr]), **kwargs) -> ApiResponse: # noqa: E501 """Test array of binary in multipart mime # noqa: E501 @@ -476,7 +476,7 @@ def test_body_multipart_formdata_array_of_binary_with_http_info(self, files : co collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_echo_body_free_form_object_response_string(self, body : Annotated[Optional[Dict[str, Any]], Field(description="Free form object")] = None, **kwargs) -> str: # noqa: E501 """Test free form object # noqa: E501 @@ -505,7 +505,7 @@ def test_echo_body_free_form_object_response_string(self, body : Annotated[Optio raise ValueError("Error! Please call the test_echo_body_free_form_object_response_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_echo_body_free_form_object_response_string_with_http_info(body, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_echo_body_free_form_object_response_string_with_http_info(self, body : Annotated[Optional[Dict[str, Any]], Field(description="Free form object")] = None, **kwargs) -> ApiResponse: # noqa: E501 """Test free form object # noqa: E501 @@ -622,7 +622,7 @@ def test_echo_body_free_form_object_response_string_with_http_info(self, body : collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_echo_body_pet(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> Pet: # noqa: E501 """Test body parameter(s) # noqa: E501 @@ -651,7 +651,7 @@ def test_echo_body_pet(self, pet : Annotated[Optional[Pet], Field(description="P raise ValueError("Error! Please call the test_echo_body_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_echo_body_pet_with_http_info(pet, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_echo_body_pet_with_http_info(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> ApiResponse: # noqa: E501 """Test body parameter(s) # noqa: E501 @@ -768,7 +768,7 @@ def test_echo_body_pet_with_http_info(self, pet : Annotated[Optional[Pet], Field collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_echo_body_pet_response_string(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> str: # noqa: E501 """Test empty response body # noqa: E501 @@ -797,7 +797,7 @@ def test_echo_body_pet_response_string(self, pet : Annotated[Optional[Pet], Fiel raise ValueError("Error! Please call the test_echo_body_pet_response_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_echo_body_pet_response_string_with_http_info(pet, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_echo_body_pet_response_string_with_http_info(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> ApiResponse: # noqa: E501 """Test empty response body # noqa: E501 @@ -914,7 +914,7 @@ def test_echo_body_pet_response_string_with_http_info(self, pet : Annotated[Opti collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_echo_body_tag_response_string(self, tag : Annotated[Optional[Tag], Field(description="Tag object")] = None, **kwargs) -> str: # noqa: E501 """Test empty json (request body) # noqa: E501 @@ -943,7 +943,7 @@ def test_echo_body_tag_response_string(self, tag : Annotated[Optional[Tag], Fiel raise ValueError("Error! Please call the test_echo_body_tag_response_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_echo_body_tag_response_string_with_http_info(tag, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_echo_body_tag_response_string_with_http_info(self, tag : Annotated[Optional[Tag], Field(description="Tag object")] = None, **kwargs) -> ApiResponse: # noqa: E501 """Test empty json (request body) # noqa: E501 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 d0cc8730d4f4..e6da891fb51c 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,7 +17,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from pydantic import StrictBool, StrictInt, StrictStr @@ -45,7 +45,7 @@ def __init__(self, api_client=None): api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def test_form_integer_boolean_string(self, integer_form : Optional[StrictInt] = None, boolean_form : Optional[StrictBool] = None, string_form : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501 """Test form parameter(s) # noqa: E501 @@ -78,7 +78,7 @@ def test_form_integer_boolean_string(self, integer_form : Optional[StrictInt] = raise ValueError("Error! Please call the test_form_integer_boolean_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_form_integer_boolean_string_with_http_info(integer_form, boolean_form, string_form, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_form_integer_boolean_string_with_http_info(self, integer_form : Optional[StrictInt] = None, boolean_form : Optional[StrictBool] = None, string_form : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 """Test form parameter(s) # noqa: E501 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 4742d4c21748..668ec4a179d7 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,7 +17,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from pydantic import StrictBool, StrictInt, StrictStr @@ -45,7 +45,7 @@ def __init__(self, api_client=None): api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def test_header_integer_boolean_string(self, integer_header : Optional[StrictInt] = None, boolean_header : Optional[StrictBool] = None, string_header : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501 """Test header parameter(s) # noqa: E501 @@ -78,7 +78,7 @@ def test_header_integer_boolean_string(self, integer_header : Optional[StrictInt raise ValueError("Error! Please call the test_header_integer_boolean_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_header_integer_boolean_string_with_http_info(integer_header, boolean_header, string_header, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_header_integer_boolean_string_with_http_info(self, integer_header : Optional[StrictInt] = None, boolean_header : Optional[StrictBool] = None, string_header : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 """Test header parameter(s) # noqa: E501 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 12a2a5c8684d..105575632282 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,7 +17,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from pydantic import StrictInt, StrictStr @@ -43,7 +43,7 @@ def __init__(self, api_client=None): api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def tests_path_string_path_string_integer_path_integer(self, path_string : StrictStr, path_integer : StrictInt, **kwargs) -> str: # noqa: E501 """Test path parameter(s) # noqa: E501 @@ -74,7 +74,7 @@ def tests_path_string_path_string_integer_path_integer(self, path_string : Stric raise ValueError("Error! Please call the tests_path_string_path_string_integer_path_integer_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.tests_path_string_path_string_integer_path_integer_with_http_info(path_string, path_integer, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def tests_path_string_path_string_integer_path_integer_with_http_info(self, path_string : StrictStr, path_integer : StrictInt, **kwargs) -> ApiResponse: # noqa: E501 """Test path parameter(s) # noqa: E501 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 7d387c1adaf6..ebbfd71e6d1c 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,7 +17,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from datetime import date, datetime @@ -50,7 +50,7 @@ def __init__(self, api_client=None): api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def test_enum_ref_string(self, enum_ref_string_query : Optional[StringEnumRef] = None, **kwargs) -> str: # noqa: E501 """Test query parameter(s) # noqa: E501 @@ -79,7 +79,7 @@ def test_enum_ref_string(self, enum_ref_string_query : Optional[StringEnumRef] = raise ValueError("Error! Please call the test_enum_ref_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_enum_ref_string_with_http_info(enum_ref_string_query, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_enum_ref_string_with_http_info(self, enum_ref_string_query : Optional[StringEnumRef] = None, **kwargs) -> ApiResponse: # noqa: E501 """Test query parameter(s) # noqa: E501 @@ -189,7 +189,7 @@ def test_enum_ref_string_with_http_info(self, enum_ref_string_query : Optional[S collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_query_datetime_date_string(self, datetime_query : Optional[datetime] = None, date_query : Optional[date] = None, string_query : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501 """Test query parameter(s) # noqa: E501 @@ -222,7 +222,7 @@ def test_query_datetime_date_string(self, datetime_query : Optional[datetime] = raise ValueError("Error! Please call the test_query_datetime_date_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_query_datetime_date_string_with_http_info(datetime_query, date_query, string_query, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_query_datetime_date_string_with_http_info(self, datetime_query : Optional[datetime] = None, date_query : Optional[date] = None, string_query : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 """Test query parameter(s) # noqa: E501 @@ -350,7 +350,7 @@ def test_query_datetime_date_string_with_http_info(self, datetime_query : Option collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_query_integer_boolean_string(self, integer_query : Optional[StrictInt] = None, boolean_query : Optional[StrictBool] = None, string_query : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501 """Test query parameter(s) # noqa: E501 @@ -383,7 +383,7 @@ def test_query_integer_boolean_string(self, integer_query : Optional[StrictInt] raise ValueError("Error! Please call the test_query_integer_boolean_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_query_integer_boolean_string_with_http_info(integer_query, boolean_query, string_query, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_query_integer_boolean_string_with_http_info(self, integer_query : Optional[StrictInt] = None, boolean_query : Optional[StrictBool] = None, string_query : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 """Test query parameter(s) # noqa: E501 @@ -505,7 +505,7 @@ def test_query_integer_boolean_string_with_http_info(self, integer_query : Optio collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_query_style_deep_object_explode_true_object(self, query_object : Optional[Pet] = None, **kwargs) -> str: # noqa: E501 """Test query parameter(s) # noqa: E501 @@ -534,7 +534,7 @@ def test_query_style_deep_object_explode_true_object(self, query_object : Option raise ValueError("Error! Please call the test_query_style_deep_object_explode_true_object_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_query_style_deep_object_explode_true_object_with_http_info(query_object, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_query_style_deep_object_explode_true_object_with_http_info(self, query_object : Optional[Pet] = None, **kwargs) -> ApiResponse: # noqa: E501 """Test query parameter(s) # noqa: E501 @@ -644,7 +644,7 @@ def test_query_style_deep_object_explode_true_object_with_http_info(self, query_ collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_query_style_deep_object_explode_true_object_all_of(self, query_object : Optional[Any] = None, **kwargs) -> str: # noqa: E501 """Test query parameter(s) # noqa: E501 @@ -673,7 +673,7 @@ def test_query_style_deep_object_explode_true_object_all_of(self, query_object : raise ValueError("Error! Please call the test_query_style_deep_object_explode_true_object_all_of_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_query_style_deep_object_explode_true_object_all_of_with_http_info(query_object, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_query_style_deep_object_explode_true_object_all_of_with_http_info(self, query_object : Optional[Any] = None, **kwargs) -> ApiResponse: # noqa: E501 """Test query parameter(s) # noqa: E501 @@ -783,7 +783,7 @@ def test_query_style_deep_object_explode_true_object_all_of_with_http_info(self, collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_query_style_form_explode_true_array_string(self, query_object : Optional[TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter] = None, **kwargs) -> str: # noqa: E501 """Test query parameter(s) # noqa: E501 @@ -812,7 +812,7 @@ def test_query_style_form_explode_true_array_string(self, query_object : Optiona raise ValueError("Error! Please call the test_query_style_form_explode_true_array_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_query_style_form_explode_true_array_string_with_http_info(query_object, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_query_style_form_explode_true_array_string_with_http_info(self, query_object : Optional[TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter] = None, **kwargs) -> ApiResponse: # noqa: E501 """Test query parameter(s) # noqa: E501 @@ -922,7 +922,7 @@ def test_query_style_form_explode_true_array_string_with_http_info(self, query_o collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_query_style_form_explode_true_object(self, query_object : Optional[Pet] = None, **kwargs) -> str: # noqa: E501 """Test query parameter(s) # noqa: E501 @@ -951,7 +951,7 @@ def test_query_style_form_explode_true_object(self, query_object : Optional[Pet] raise ValueError("Error! Please call the test_query_style_form_explode_true_object_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_query_style_form_explode_true_object_with_http_info(query_object, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_query_style_form_explode_true_object_with_http_info(self, query_object : Optional[Pet] = None, **kwargs) -> ApiResponse: # noqa: E501 """Test query parameter(s) # noqa: E501 @@ -1061,7 +1061,7 @@ def test_query_style_form_explode_true_object_with_http_info(self, query_object collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_query_style_form_explode_true_object_all_of(self, query_object : Optional[Any] = None, **kwargs) -> str: # noqa: E501 """Test query parameter(s) # noqa: E501 @@ -1090,7 +1090,7 @@ def test_query_style_form_explode_true_object_all_of(self, query_object : Option raise ValueError("Error! Please call the test_query_style_form_explode_true_object_all_of_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_query_style_form_explode_true_object_all_of_with_http_info(query_object, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_query_style_form_explode_true_object_all_of_with_http_info(self, query_object : Optional[Any] = None, **kwargs) -> ApiResponse: # noqa: E501 """Test query parameter(s) # noqa: E501 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 77887a53120d..d977552e008e 100644 --- a/samples/client/echo_api/python/openapi_client/models/bird.py +++ b/samples/client/echo_api/python/openapi_client/models/bird.py @@ -30,10 +30,11 @@ class Bird(BaseModel): color: Optional[StrictStr] = None __properties = ["size", "color"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 ee8e5c258ae9..b41f4f9bbe24 100644 --- a/samples/client/echo_api/python/openapi_client/models/category.py +++ b/samples/client/echo_api/python/openapi_client/models/category.py @@ -30,10 +30,11 @@ class Category(BaseModel): name: Optional[StrictStr] = None __properties = ["id", "name"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 af8078549f1f..1f69b8f25e8f 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 @@ -32,10 +32,11 @@ class DataQuery(Query): var_date: Optional[datetime] = Field(None, alias="date", description="A date") __properties = ["id", "outcomes", "suffix", "text", "date"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 568dcdf752f2..799c6938e11d 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 @@ -48,10 +48,11 @@ def array_string_enum_default_validate_enum(cls, value): raise ValueError("each list item must be one of ('success', 'failure', 'unclassified')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 10bb3a590a21..fe0ce8323b6e 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 @@ -31,10 +31,11 @@ class NumberPropertiesOnly(BaseModel): double: Optional[Union[confloat(le=50.2, ge=0.8, strict=True), conint(le=50, ge=1, strict=True)]] = None __properties = ["number", "float", "double"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 3a40ddc03215..e86cc7cce5d4 100644 --- a/samples/client/echo_api/python/openapi_client/models/pet.py +++ b/samples/client/echo_api/python/openapi_client/models/pet.py @@ -46,10 +46,11 @@ def status_validate_enum(cls, value): raise ValueError("must be one of enum values ('available', 'pending', 'sold')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 02e4233d513a..b44737287218 100644 --- a/samples/client/echo_api/python/openapi_client/models/query.py +++ b/samples/client/echo_api/python/openapi_client/models/query.py @@ -41,10 +41,11 @@ def outcomes_validate_enum(cls, value): raise ValueError("each list item must be one of ('SUCCESS', 'FAILURE', 'SKIPPED')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 66a39adff29c..859a7b3337b9 100644 --- a/samples/client/echo_api/python/openapi_client/models/tag.py +++ b/samples/client/echo_api/python/openapi_client/models/tag.py @@ -30,10 +30,11 @@ class Tag(BaseModel): name: Optional[StrictStr] = None __properties = ["id", "name"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 42e1101ec022..e10d08636280 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 @@ -32,10 +32,11 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(BaseMod name: Optional[StrictStr] = None __properties = ["size", "color", "id", "name"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 1bff80a6df1c..b1496c04cfc4 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 @@ -29,10 +29,11 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(BaseModel): values: Optional[conlist(StrictStr)] = None __properties = ["values"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" diff --git a/samples/client/echo_api/python/pyproject.toml b/samples/client/echo_api/python/pyproject.toml index caaec1be1b2a..0bdc236af243 100644 --- a/samples/client/echo_api/python/pyproject.toml +++ b/samples/client/echo_api/python/pyproject.toml @@ -14,7 +14,7 @@ python = "^3.7" urllib3 = ">= 1.25.3" python-dateutil = ">=2.8.2" -pydantic = "^1.10.5, <2" +pydantic = ">=2" aenum = ">=3.1.11" [tool.poetry.dev-dependencies] diff --git a/samples/client/echo_api/python/requirements.txt b/samples/client/echo_api/python/requirements.txt index 258c179c10b2..358a78535383 100644 --- a/samples/client/echo_api/python/requirements.txt +++ b/samples/client/echo_api/python/requirements.txt @@ -1,5 +1,5 @@ python_dateutil >= 2.5.3 setuptools >= 21.0.0 urllib3 >= 1.25.3, < 2.1.0 -pydantic >= 1.10.5, < 2 +pydantic >= 2 aenum >= 3.1.11 diff --git a/samples/client/echo_api/python/setup.py b/samples/client/echo_api/python/setup.py index 192f8f2b0402..77e660f8a789 100644 --- a/samples/client/echo_api/python/setup.py +++ b/samples/client/echo_api/python/setup.py @@ -27,7 +27,7 @@ REQUIRES = [ "urllib3 >= 1.25.3, < 2.1.0", "python-dateutil", - "pydantic >= 1.10.5, < 2", + "pydantic >= 2", "aenum" ] 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 74d0a3c7de93..023a6b9ab038 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,7 +16,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from typing import overload, Optional, Union, Awaitable @@ -52,7 +52,7 @@ async def call_123_test_special_tags(self, client : Annotated[Client, Field(..., def call_123_test_special_tags(self, client : Annotated[Client, Field(..., description="client model")], async_req: Optional[bool]=True, **kwargs) -> Client: # noqa: E501 ... - @validate_arguments + @validate_call def call_123_test_special_tags(self, client : Annotated[Client, Field(..., description="client model")], async_req: Optional[bool]=None, **kwargs) -> Union[Client, Awaitable[Client]]: # noqa: E501 """To test special tags # noqa: E501 @@ -83,7 +83,7 @@ def call_123_test_special_tags(self, client : Annotated[Client, Field(..., descr kwargs['async_req'] = async_req return self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def call_123_test_special_tags_with_http_info(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> ApiResponse: # noqa: E501 """To test special tags # noqa: E501 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 f9480b03abd9..5cb0cd254533 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,7 +16,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from typing import overload, Optional, Union, Awaitable @@ -50,7 +50,7 @@ async def foo_get(self, **kwargs) -> FooGetDefaultResponse: # noqa: E501 def foo_get(self, async_req: Optional[bool]=True, **kwargs) -> FooGetDefaultResponse: # noqa: E501 ... - @validate_arguments + @validate_call def foo_get(self, async_req: Optional[bool]=None, **kwargs) -> Union[FooGetDefaultResponse, Awaitable[FooGetDefaultResponse]]: # noqa: E501 """foo_get # noqa: E501 @@ -78,7 +78,7 @@ def foo_get(self, async_req: Optional[bool]=None, **kwargs) -> Union[FooGetDefau kwargs['async_req'] = async_req return self.foo_get_with_http_info(**kwargs) # noqa: E501 - @validate_arguments + @validate_call def foo_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 """foo_get # noqa: E501 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 1fa99033b98b..b9a6daec1961 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,7 +16,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from typing import overload, Optional, Union, Awaitable @@ -64,7 +64,7 @@ async def fake_any_type_request_body(self, body : Optional[Dict[str, Any]] = Non def fake_any_type_request_body(self, body : Optional[Dict[str, Any]] = None, async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def fake_any_type_request_body(self, body : Optional[Dict[str, Any]] = None, async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """test any type request body # noqa: E501 @@ -94,7 +94,7 @@ def fake_any_type_request_body(self, body : Optional[Dict[str, Any]] = None, asy kwargs['async_req'] = async_req return self.fake_any_type_request_body_with_http_info(body, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_any_type_request_body_with_http_info(self, body : Optional[Dict[str, Any]] = None, **kwargs) -> ApiResponse: # noqa: E501 """test any type request body # noqa: E501 @@ -212,7 +212,7 @@ async def fake_enum_ref_query_parameter(self, enum_ref : Annotated[Optional[Enum def fake_enum_ref_query_parameter(self, enum_ref : Annotated[Optional[EnumClass], Field(description="enum reference")] = None, async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def fake_enum_ref_query_parameter(self, enum_ref : Annotated[Optional[EnumClass], Field(description="enum reference")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """test enum reference query parameter # noqa: E501 @@ -242,7 +242,7 @@ def fake_enum_ref_query_parameter(self, enum_ref : Annotated[Optional[EnumClass] kwargs['async_req'] = async_req return self.fake_enum_ref_query_parameter_with_http_info(enum_ref, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_enum_ref_query_parameter_with_http_info(self, enum_ref : Annotated[Optional[EnumClass], Field(description="enum reference")] = None, **kwargs) -> ApiResponse: # noqa: E501 """test enum reference query parameter # noqa: E501 @@ -353,7 +353,7 @@ async def fake_health_get(self, **kwargs) -> HealthCheckResult: # noqa: E501 def fake_health_get(self, async_req: Optional[bool]=True, **kwargs) -> HealthCheckResult: # noqa: E501 ... - @validate_arguments + @validate_call def fake_health_get(self, async_req: Optional[bool]=None, **kwargs) -> Union[HealthCheckResult, Awaitable[HealthCheckResult]]: # noqa: E501 """Health check endpoint # noqa: E501 @@ -381,7 +381,7 @@ def fake_health_get(self, async_req: Optional[bool]=None, **kwargs) -> Union[Hea kwargs['async_req'] = async_req return self.fake_health_get_with_http_info(**kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_health_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 """Health check endpoint # noqa: E501 @@ -492,7 +492,7 @@ async def fake_http_signature_test(self, pet : Annotated[Pet, Field(..., descrip def fake_http_signature_test(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], query_1 : Annotated[Optional[StrictStr], Field(description="query parameter")] = None, header_1 : Annotated[Optional[StrictStr], Field(description="header parameter")] = None, async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def fake_http_signature_test(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], query_1 : Annotated[Optional[StrictStr], Field(description="query parameter")] = None, header_1 : Annotated[Optional[StrictStr], Field(description="header parameter")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """test http signature authentication # noqa: E501 @@ -526,7 +526,7 @@ def fake_http_signature_test(self, pet : Annotated[Pet, Field(..., description=" kwargs['async_req'] = async_req return self.fake_http_signature_test_with_http_info(pet, query_1, header_1, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_http_signature_test_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], query_1 : Annotated[Optional[StrictStr], Field(description="query parameter")] = None, header_1 : Annotated[Optional[StrictStr], Field(description="header parameter")] = None, **kwargs) -> ApiResponse: # noqa: E501 """test http signature authentication # noqa: E501 @@ -656,7 +656,7 @@ async def fake_outer_boolean_serialize(self, body : Annotated[Optional[StrictBoo def fake_outer_boolean_serialize(self, body : Annotated[Optional[StrictBool], Field(description="Input boolean as post body")] = None, async_req: Optional[bool]=True, **kwargs) -> bool: # noqa: E501 ... - @validate_arguments + @validate_call def fake_outer_boolean_serialize(self, body : Annotated[Optional[StrictBool], Field(description="Input boolean as post body")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[bool, Awaitable[bool]]: # noqa: E501 """fake_outer_boolean_serialize # noqa: E501 @@ -687,7 +687,7 @@ def fake_outer_boolean_serialize(self, body : Annotated[Optional[StrictBool], Fi kwargs['async_req'] = async_req return self.fake_outer_boolean_serialize_with_http_info(body, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_outer_boolean_serialize_with_http_info(self, body : Annotated[Optional[StrictBool], Field(description="Input boolean as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 """fake_outer_boolean_serialize # noqa: E501 @@ -812,7 +812,7 @@ async def fake_outer_composite_serialize(self, outer_composite : Annotated[Optio def fake_outer_composite_serialize(self, outer_composite : Annotated[Optional[OuterComposite], Field(description="Input composite as post body")] = None, async_req: Optional[bool]=True, **kwargs) -> OuterComposite: # noqa: E501 ... - @validate_arguments + @validate_call def fake_outer_composite_serialize(self, outer_composite : Annotated[Optional[OuterComposite], Field(description="Input composite as post body")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[OuterComposite, Awaitable[OuterComposite]]: # noqa: E501 """fake_outer_composite_serialize # noqa: E501 @@ -843,7 +843,7 @@ def fake_outer_composite_serialize(self, outer_composite : Annotated[Optional[Ou kwargs['async_req'] = async_req return self.fake_outer_composite_serialize_with_http_info(outer_composite, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_outer_composite_serialize_with_http_info(self, outer_composite : Annotated[Optional[OuterComposite], Field(description="Input composite as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 """fake_outer_composite_serialize # noqa: E501 @@ -968,7 +968,7 @@ async def fake_outer_number_serialize(self, body : Annotated[Optional[float], Fi def fake_outer_number_serialize(self, body : Annotated[Optional[float], Field(description="Input number as post body")] = None, async_req: Optional[bool]=True, **kwargs) -> float: # noqa: E501 ... - @validate_arguments + @validate_call def fake_outer_number_serialize(self, body : Annotated[Optional[float], Field(description="Input number as post body")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[float, Awaitable[float]]: # noqa: E501 """fake_outer_number_serialize # noqa: E501 @@ -999,7 +999,7 @@ def fake_outer_number_serialize(self, body : Annotated[Optional[float], Field(de kwargs['async_req'] = async_req return self.fake_outer_number_serialize_with_http_info(body, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_outer_number_serialize_with_http_info(self, body : Annotated[Optional[float], Field(description="Input number as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 """fake_outer_number_serialize # noqa: E501 @@ -1124,7 +1124,7 @@ async def fake_outer_string_serialize(self, body : Annotated[Optional[StrictStr] def fake_outer_string_serialize(self, body : Annotated[Optional[StrictStr], Field(description="Input string as post body")] = None, async_req: Optional[bool]=True, **kwargs) -> str: # noqa: E501 ... - @validate_arguments + @validate_call def fake_outer_string_serialize(self, body : Annotated[Optional[StrictStr], Field(description="Input string as post body")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[str, Awaitable[str]]: # noqa: E501 """fake_outer_string_serialize # noqa: E501 @@ -1155,7 +1155,7 @@ def fake_outer_string_serialize(self, body : Annotated[Optional[StrictStr], Fiel kwargs['async_req'] = async_req return self.fake_outer_string_serialize_with_http_info(body, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_outer_string_serialize_with_http_info(self, body : Annotated[Optional[StrictStr], Field(description="Input string as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 """fake_outer_string_serialize # noqa: E501 @@ -1280,7 +1280,7 @@ async def fake_property_enum_integer_serialize(self, outer_object_with_enum_prop def fake_property_enum_integer_serialize(self, outer_object_with_enum_property : Annotated[OuterObjectWithEnumProperty, Field(..., description="Input enum (int) as post body")], async_req: Optional[bool]=True, **kwargs) -> OuterObjectWithEnumProperty: # noqa: E501 ... - @validate_arguments + @validate_call def fake_property_enum_integer_serialize(self, outer_object_with_enum_property : Annotated[OuterObjectWithEnumProperty, Field(..., description="Input enum (int) as post body")], async_req: Optional[bool]=None, **kwargs) -> Union[OuterObjectWithEnumProperty, Awaitable[OuterObjectWithEnumProperty]]: # noqa: E501 """fake_property_enum_integer_serialize # noqa: E501 @@ -1311,7 +1311,7 @@ def fake_property_enum_integer_serialize(self, outer_object_with_enum_property : kwargs['async_req'] = async_req return self.fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_property, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_property_enum_integer_serialize_with_http_info(self, outer_object_with_enum_property : Annotated[OuterObjectWithEnumProperty, Field(..., description="Input enum (int) as post body")], **kwargs) -> ApiResponse: # noqa: E501 """fake_property_enum_integer_serialize # noqa: E501 @@ -1436,7 +1436,7 @@ async def fake_return_list_of_objects(self, **kwargs) -> List[List[Tag]]: # noq def fake_return_list_of_objects(self, async_req: Optional[bool]=True, **kwargs) -> List[List[Tag]]: # noqa: E501 ... - @validate_arguments + @validate_call def fake_return_list_of_objects(self, async_req: Optional[bool]=None, **kwargs) -> Union[List[List[Tag]], Awaitable[List[List[Tag]]]]: # noqa: E501 """test returning list of objects # noqa: E501 @@ -1464,7 +1464,7 @@ def fake_return_list_of_objects(self, async_req: Optional[bool]=None, **kwargs) kwargs['async_req'] = async_req return self.fake_return_list_of_objects_with_http_info(**kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_return_list_of_objects_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 """test returning list of objects # noqa: E501 @@ -1575,7 +1575,7 @@ async def fake_uuid_example(self, uuid_example : Annotated[StrictStr, Field(..., def fake_uuid_example(self, uuid_example : Annotated[StrictStr, Field(..., description="uuid example")], async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def fake_uuid_example(self, uuid_example : Annotated[StrictStr, Field(..., description="uuid example")], async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """test uuid example # noqa: E501 @@ -1605,7 +1605,7 @@ def fake_uuid_example(self, uuid_example : Annotated[StrictStr, Field(..., descr kwargs['async_req'] = async_req return self.fake_uuid_example_with_http_info(uuid_example, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_uuid_example_with_http_info(self, uuid_example : Annotated[StrictStr, Field(..., description="uuid example")], **kwargs) -> ApiResponse: # noqa: E501 """test uuid example # noqa: E501 @@ -1716,7 +1716,7 @@ async def test_body_with_binary(self, body : Annotated[Optional[Union[StrictByte def test_body_with_binary(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def test_body_with_binary(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """test_body_with_binary # noqa: E501 @@ -1747,7 +1747,7 @@ def test_body_with_binary(self, body : Annotated[Optional[Union[StrictBytes, Str kwargs['async_req'] = async_req return self.test_body_with_binary_with_http_info(body, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_body_with_binary_with_http_info(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], **kwargs) -> ApiResponse: # noqa: E501 """test_body_with_binary # noqa: E501 @@ -1871,7 +1871,7 @@ async def test_body_with_file_schema(self, file_schema_test_class : FileSchemaTe def test_body_with_file_schema(self, file_schema_test_class : FileSchemaTestClass, async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def test_body_with_file_schema(self, file_schema_test_class : FileSchemaTestClass, async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """test_body_with_file_schema # noqa: E501 @@ -1902,7 +1902,7 @@ def test_body_with_file_schema(self, file_schema_test_class : FileSchemaTestClas kwargs['async_req'] = async_req return self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_body_with_file_schema_with_http_info(self, file_schema_test_class : FileSchemaTestClass, **kwargs) -> ApiResponse: # noqa: E501 """test_body_with_file_schema # noqa: E501 @@ -2021,7 +2021,7 @@ async def test_body_with_query_params(self, query : StrictStr, user : User, **kw def test_body_with_query_params(self, query : StrictStr, user : User, async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def test_body_with_query_params(self, query : StrictStr, user : User, async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """test_body_with_query_params # noqa: E501 @@ -2053,7 +2053,7 @@ def test_body_with_query_params(self, query : StrictStr, user : User, async_req: kwargs['async_req'] = async_req return self.test_body_with_query_params_with_http_info(query, user, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_body_with_query_params_with_http_info(self, query : StrictStr, user : User, **kwargs) -> ApiResponse: # noqa: E501 """test_body_with_query_params # noqa: E501 @@ -2177,7 +2177,7 @@ async def test_client_model(self, client : Annotated[Client, Field(..., descript def test_client_model(self, client : Annotated[Client, Field(..., description="client model")], async_req: Optional[bool]=True, **kwargs) -> Client: # noqa: E501 ... - @validate_arguments + @validate_call def test_client_model(self, client : Annotated[Client, Field(..., description="client model")], async_req: Optional[bool]=None, **kwargs) -> Union[Client, Awaitable[Client]]: # noqa: E501 """To test \"client\" model # noqa: E501 @@ -2208,7 +2208,7 @@ def test_client_model(self, client : Annotated[Client, Field(..., description="c kwargs['async_req'] = async_req return self.test_client_model_with_http_info(client, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_client_model_with_http_info(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> ApiResponse: # noqa: E501 """To test \"client\" model # noqa: E501 @@ -2333,7 +2333,7 @@ async def test_date_time_query_parameter(self, date_time_query : datetime, str_q def test_date_time_query_parameter(self, date_time_query : datetime, str_query : StrictStr, async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def test_date_time_query_parameter(self, date_time_query : datetime, str_query : StrictStr, async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """test_date_time_query_parameter # noqa: E501 @@ -2365,7 +2365,7 @@ def test_date_time_query_parameter(self, date_time_query : datetime, str_query : kwargs['async_req'] = async_req return self.test_date_time_query_parameter_with_http_info(date_time_query, str_query, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_date_time_query_parameter_with_http_info(self, date_time_query : datetime, str_query : StrictStr, **kwargs) -> ApiResponse: # noqa: E501 """test_date_time_query_parameter # noqa: E501 @@ -2485,7 +2485,7 @@ async def test_endpoint_parameters(self, number : Annotated[confloat(le=543.2, g def test_endpoint_parameters(self, number : Annotated[confloat(le=543.2, ge=32.1), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[conbytes(strict=True, max_length=64), constr(strict=True, max_length=64)]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def test_endpoint_parameters(self, number : Annotated[confloat(le=543.2, ge=32.1), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[conbytes(strict=True, max_length=64), constr(strict=True, max_length=64)]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 @@ -2544,7 +2544,7 @@ def test_endpoint_parameters(self, number : Annotated[confloat(le=543.2, ge=32.1 kwargs['async_req'] = async_req return self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, byte_with_max_length, var_date, date_time, password, param_callback, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_endpoint_parameters_with_http_info(self, number : Annotated[confloat(le=543.2, ge=32.1), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[conbytes(strict=True, max_length=64), constr(strict=True, max_length=64)]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> ApiResponse: # noqa: E501 """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 @@ -2747,7 +2747,7 @@ async def test_group_parameters(self, required_string_group : Annotated[StrictIn def test_group_parameters(self, required_string_group : Annotated[StrictInt, Field(..., description="Required String in group parameters")], required_boolean_group : Annotated[StrictBool, Field(..., description="Required Boolean in group parameters")], required_int64_group : Annotated[StrictInt, Field(..., description="Required Integer in group parameters")], string_group : Annotated[Optional[StrictInt], Field(description="String in group parameters")] = None, boolean_group : Annotated[Optional[StrictBool], Field(description="Boolean in group parameters")] = None, int64_group : Annotated[Optional[StrictInt], Field(description="Integer in group parameters")] = None, async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def test_group_parameters(self, required_string_group : Annotated[StrictInt, Field(..., description="Required String in group parameters")], required_boolean_group : Annotated[StrictBool, Field(..., description="Required Boolean in group parameters")], required_int64_group : Annotated[StrictInt, Field(..., description="Required Integer in group parameters")], string_group : Annotated[Optional[StrictInt], Field(description="String in group parameters")] = None, boolean_group : Annotated[Optional[StrictBool], Field(description="Boolean in group parameters")] = None, int64_group : Annotated[Optional[StrictInt], Field(description="Integer in group parameters")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """Fake endpoint to test group parameters (optional) # noqa: E501 @@ -2788,7 +2788,7 @@ def test_group_parameters(self, required_string_group : Annotated[StrictInt, Fie kwargs['async_req'] = async_req return self.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, string_group, boolean_group, int64_group, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_group_parameters_with_http_info(self, required_string_group : Annotated[StrictInt, Field(..., description="Required String in group parameters")], required_boolean_group : Annotated[StrictBool, Field(..., description="Required Boolean in group parameters")], required_int64_group : Annotated[StrictInt, Field(..., description="Required Integer in group parameters")], string_group : Annotated[Optional[StrictInt], Field(description="String in group parameters")] = None, boolean_group : Annotated[Optional[StrictBool], Field(description="Boolean in group parameters")] = None, int64_group : Annotated[Optional[StrictInt], Field(description="Integer in group parameters")] = None, **kwargs) -> ApiResponse: # noqa: E501 """Fake endpoint to test group parameters (optional) # noqa: E501 @@ -2930,7 +2930,7 @@ async def test_inline_additional_properties(self, request_body : Annotated[Dict[ def test_inline_additional_properties(self, request_body : Annotated[Dict[str, StrictStr], Field(..., description="request body")], async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def test_inline_additional_properties(self, request_body : Annotated[Dict[str, StrictStr], Field(..., description="request body")], async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """test inline additionalProperties # noqa: E501 @@ -2961,7 +2961,7 @@ def test_inline_additional_properties(self, request_body : Annotated[Dict[str, S kwargs['async_req'] = async_req return self.test_inline_additional_properties_with_http_info(request_body, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_inline_additional_properties_with_http_info(self, request_body : Annotated[Dict[str, StrictStr], Field(..., description="request body")], **kwargs) -> ApiResponse: # noqa: E501 """test inline additionalProperties # noqa: E501 @@ -3080,7 +3080,7 @@ async def test_json_form_data(self, param : Annotated[StrictStr, Field(..., desc def test_json_form_data(self, param : Annotated[StrictStr, Field(..., description="field1")], param2 : Annotated[StrictStr, Field(..., description="field2")], async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def test_json_form_data(self, param : Annotated[StrictStr, Field(..., description="field1")], param2 : Annotated[StrictStr, Field(..., description="field2")], async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """test json serialization of form data # noqa: E501 @@ -3113,7 +3113,7 @@ def test_json_form_data(self, param : Annotated[StrictStr, Field(..., descriptio kwargs['async_req'] = async_req return self.test_json_form_data_with_http_info(param, param2, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_json_form_data_with_http_info(self, param : Annotated[StrictStr, Field(..., description="field1")], param2 : Annotated[StrictStr, Field(..., description="field2")], **kwargs) -> ApiResponse: # noqa: E501 """test json serialization of form data # noqa: E501 @@ -3238,7 +3238,7 @@ async def test_query_parameter_collection_format(self, pipe : conlist(StrictStr) def test_query_parameter_collection_format(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def test_query_parameter_collection_format(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """test_query_parameter_collection_format # noqa: E501 @@ -3281,7 +3281,7 @@ def test_query_parameter_collection_format(self, pipe : conlist(StrictStr), iout kwargs['async_req'] = async_req return self.test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, url, context, allow_empty, language, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_query_parameter_collection_format_with_http_info(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> ApiResponse: # noqa: E501 """test_query_parameter_collection_format # noqa: E501 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 5f06bd394e8c..5ab6fd0ae19e 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,7 +16,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from typing import overload, Optional, Union, Awaitable @@ -52,7 +52,7 @@ async def test_classname(self, client : Annotated[Client, Field(..., description def test_classname(self, client : Annotated[Client, Field(..., description="client model")], async_req: Optional[bool]=True, **kwargs) -> Client: # noqa: E501 ... - @validate_arguments + @validate_call def test_classname(self, client : Annotated[Client, Field(..., description="client model")], async_req: Optional[bool]=None, **kwargs) -> Union[Client, Awaitable[Client]]: # noqa: E501 """To test class name in snake case # noqa: E501 @@ -83,7 +83,7 @@ def test_classname(self, client : Annotated[Client, Field(..., description="clie kwargs['async_req'] = async_req return self.test_classname_with_http_info(client, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_classname_with_http_info(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> ApiResponse: # noqa: E501 """To test class name in snake case # noqa: E501 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 b3a44f89a80d..1b19cc3f252d 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,7 +16,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from typing import overload, Optional, Union, Awaitable @@ -55,7 +55,7 @@ async def add_pet(self, pet : Annotated[Pet, Field(..., description="Pet object def add_pet(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def add_pet(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """Add a new pet to the store # noqa: E501 @@ -86,7 +86,7 @@ def add_pet(self, pet : Annotated[Pet, Field(..., description="Pet object that n kwargs['async_req'] = async_req return self.add_pet_with_http_info(pet, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def add_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> ApiResponse: # noqa: E501 """Add a new pet to the store # noqa: E501 @@ -205,7 +205,7 @@ async def delete_pet(self, pet_id : Annotated[StrictInt, Field(..., description= def delete_pet(self, pet_id : Annotated[StrictInt, Field(..., description="Pet id to delete")], api_key : Optional[StrictStr] = None, async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def delete_pet(self, pet_id : Annotated[StrictInt, Field(..., description="Pet id to delete")], api_key : Optional[StrictStr] = None, async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """Deletes a pet # noqa: E501 @@ -238,7 +238,7 @@ def delete_pet(self, pet_id : Annotated[StrictInt, Field(..., description="Pet i kwargs['async_req'] = async_req return self.delete_pet_with_http_info(pet_id, api_key, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def delete_pet_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="Pet id to delete")], api_key : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 """Deletes a pet # noqa: E501 @@ -356,7 +356,7 @@ async def find_pets_by_status(self, status : Annotated[conlist(StrictStr), Field def find_pets_by_status(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], async_req: Optional[bool]=True, **kwargs) -> List[Pet]: # noqa: E501 ... - @validate_arguments + @validate_call def find_pets_by_status(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], async_req: Optional[bool]=None, **kwargs) -> Union[List[Pet], Awaitable[List[Pet]]]: # noqa: E501 """Finds Pets by status # noqa: E501 @@ -387,7 +387,7 @@ def find_pets_by_status(self, status : Annotated[conlist(StrictStr), Field(..., kwargs['async_req'] = async_req return self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def find_pets_by_status_with_http_info(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs) -> ApiResponse: # noqa: E501 """Finds Pets by status # noqa: E501 @@ -507,7 +507,7 @@ async def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr, unique_ite def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], async_req: Optional[bool]=True, **kwargs) -> List[Pet]: # noqa: E501 ... - @validate_arguments + @validate_call def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], async_req: Optional[bool]=None, **kwargs) -> Union[List[Pet], Awaitable[List[Pet]]]: # noqa: E501 """(Deprecated) Finds Pets by tags # noqa: E501 @@ -538,7 +538,7 @@ def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr, unique_items=Tru kwargs['async_req'] = async_req return self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def find_pets_by_tags_with_http_info(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs) -> ApiResponse: # noqa: E501 """(Deprecated) Finds Pets by tags # noqa: E501 @@ -660,7 +660,7 @@ async def get_pet_by_id(self, pet_id : Annotated[StrictInt, Field(..., descripti def get_pet_by_id(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to return")], async_req: Optional[bool]=True, **kwargs) -> Pet: # noqa: E501 ... - @validate_arguments + @validate_call def get_pet_by_id(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to return")], async_req: Optional[bool]=None, **kwargs) -> Union[Pet, Awaitable[Pet]]: # noqa: E501 """Find pet by ID # noqa: E501 @@ -691,7 +691,7 @@ def get_pet_by_id(self, pet_id : Annotated[StrictInt, Field(..., description="ID kwargs['async_req'] = async_req return self.get_pet_by_id_with_http_info(pet_id, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def get_pet_by_id_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to return")], **kwargs) -> ApiResponse: # noqa: E501 """Find pet by ID # noqa: E501 @@ -811,7 +811,7 @@ async def update_pet(self, pet : Annotated[Pet, Field(..., description="Pet obje def update_pet(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def update_pet(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """Update an existing pet # noqa: E501 @@ -842,7 +842,7 @@ def update_pet(self, pet : Annotated[Pet, Field(..., description="Pet object tha kwargs['async_req'] = async_req return self.update_pet_with_http_info(pet, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def update_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> ApiResponse: # noqa: E501 """Update an existing pet # noqa: E501 @@ -961,7 +961,7 @@ async def update_pet_with_form(self, pet_id : Annotated[StrictInt, Field(..., de def update_pet_with_form(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet that needs to be updated")], name : Annotated[Optional[StrictStr], Field(description="Updated name of the pet")] = None, status : Annotated[Optional[StrictStr], Field(description="Updated status of the pet")] = None, async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def update_pet_with_form(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet that needs to be updated")], name : Annotated[Optional[StrictStr], Field(description="Updated name of the pet")] = None, status : Annotated[Optional[StrictStr], Field(description="Updated status of the pet")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """Updates a pet in the store with form data # noqa: E501 @@ -996,7 +996,7 @@ def update_pet_with_form(self, pet_id : Annotated[StrictInt, Field(..., descript kwargs['async_req'] = async_req return self.update_pet_with_form_with_http_info(pet_id, name, status, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def update_pet_with_form_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet that needs to be updated")], name : Annotated[Optional[StrictStr], Field(description="Updated name of the pet")] = None, status : Annotated[Optional[StrictStr], Field(description="Updated status of the pet")] = None, **kwargs) -> ApiResponse: # noqa: E501 """Updates a pet in the store with form data # noqa: E501 @@ -1127,7 +1127,7 @@ async def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, async_req: Optional[bool]=True, **kwargs) -> ApiResponse: # noqa: E501 ... - @validate_arguments + @validate_call def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[ApiResponse, Awaitable[ApiResponse]]: # noqa: E501 """uploads an image # noqa: E501 @@ -1162,7 +1162,7 @@ def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID o kwargs['async_req'] = async_req return self.upload_file_with_http_info(pet_id, additional_metadata, file, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def upload_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, **kwargs) -> ApiResponse: # noqa: E501 """uploads an image # noqa: E501 @@ -1299,7 +1299,7 @@ async def upload_file_with_required_file(self, pet_id : Annotated[StrictInt, Fie def upload_file_with_required_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[Union[StrictBytes, StrictStr], Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, async_req: Optional[bool]=True, **kwargs) -> ApiResponse: # noqa: E501 ... - @validate_arguments + @validate_call def upload_file_with_required_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[Union[StrictBytes, StrictStr], Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[ApiResponse, Awaitable[ApiResponse]]: # noqa: E501 """uploads an image (required) # noqa: E501 @@ -1334,7 +1334,7 @@ def upload_file_with_required_file(self, pet_id : Annotated[StrictInt, Field(... kwargs['async_req'] = async_req return self.upload_file_with_required_file_with_http_info(pet_id, required_file, additional_metadata, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def upload_file_with_required_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[Union[StrictBytes, StrictStr], Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, **kwargs) -> ApiResponse: # noqa: E501 """uploads an image (required) # noqa: E501 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 4ad496740135..e8df18e582b7 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,7 +16,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from typing import overload, Optional, Union, Awaitable @@ -54,7 +54,7 @@ async def delete_order(self, order_id : Annotated[StrictStr, Field(..., descript def delete_order(self, order_id : Annotated[StrictStr, Field(..., description="ID of the order that needs to be deleted")], async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def delete_order(self, order_id : Annotated[StrictStr, Field(..., description="ID of the order that needs to be deleted")], async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """Delete purchase order by ID # noqa: E501 @@ -85,7 +85,7 @@ def delete_order(self, order_id : Annotated[StrictStr, Field(..., description="I kwargs['async_req'] = async_req return self.delete_order_with_http_info(order_id, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def delete_order_with_http_info(self, order_id : Annotated[StrictStr, Field(..., description="ID of the order that needs to be deleted")], **kwargs) -> ApiResponse: # noqa: E501 """Delete purchase order by ID # noqa: E501 @@ -197,7 +197,7 @@ async def get_inventory(self, **kwargs) -> Dict[str, int]: # noqa: E501 def get_inventory(self, async_req: Optional[bool]=True, **kwargs) -> Dict[str, int]: # noqa: E501 ... - @validate_arguments + @validate_call def get_inventory(self, async_req: Optional[bool]=None, **kwargs) -> Union[Dict[str, int], Awaitable[Dict[str, int]]]: # noqa: E501 """Returns pet inventories by status # noqa: E501 @@ -226,7 +226,7 @@ def get_inventory(self, async_req: Optional[bool]=None, **kwargs) -> Union[Dict[ kwargs['async_req'] = async_req return self.get_inventory_with_http_info(**kwargs) # noqa: E501 - @validate_arguments + @validate_call def get_inventory_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 """Returns pet inventories by status # noqa: E501 @@ -338,7 +338,7 @@ async def get_order_by_id(self, order_id : Annotated[conint(strict=True, le=5, g def get_order_by_id(self, order_id : Annotated[conint(strict=True, le=5, ge=1), Field(..., description="ID of pet that needs to be fetched")], async_req: Optional[bool]=True, **kwargs) -> Order: # noqa: E501 ... - @validate_arguments + @validate_call def get_order_by_id(self, order_id : Annotated[conint(strict=True, le=5, ge=1), Field(..., description="ID of pet that needs to be fetched")], async_req: Optional[bool]=None, **kwargs) -> Union[Order, Awaitable[Order]]: # noqa: E501 """Find purchase order by ID # noqa: E501 @@ -369,7 +369,7 @@ def get_order_by_id(self, order_id : Annotated[conint(strict=True, le=5, ge=1), kwargs['async_req'] = async_req return self.get_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def get_order_by_id_with_http_info(self, order_id : Annotated[conint(strict=True, le=5, ge=1), Field(..., description="ID of pet that needs to be fetched")], **kwargs) -> ApiResponse: # noqa: E501 """Find purchase order by ID # noqa: E501 @@ -489,7 +489,7 @@ async def place_order(self, order : Annotated[Order, Field(..., description="ord def place_order(self, order : Annotated[Order, Field(..., description="order placed for purchasing the pet")], async_req: Optional[bool]=True, **kwargs) -> Order: # noqa: E501 ... - @validate_arguments + @validate_call def place_order(self, order : Annotated[Order, Field(..., description="order placed for purchasing the pet")], async_req: Optional[bool]=None, **kwargs) -> Union[Order, Awaitable[Order]]: # noqa: E501 """Place an order for a pet # noqa: E501 @@ -520,7 +520,7 @@ def place_order(self, order : Annotated[Order, Field(..., description="order pla kwargs['async_req'] = async_req return self.place_order_with_http_info(order, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def place_order_with_http_info(self, order : Annotated[Order, Field(..., description="order placed for purchasing the pet")], **kwargs) -> ApiResponse: # noqa: E501 """Place an order for a pet # noqa: E501 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 a54f051ed65d..f50ef00c3d8e 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,7 +16,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from typing import overload, Optional, Union, Awaitable @@ -52,7 +52,7 @@ async def create_user(self, user : Annotated[User, Field(..., description="Creat def create_user(self, user : Annotated[User, Field(..., description="Created user object")], async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def create_user(self, user : Annotated[User, Field(..., description="Created user object")], async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """Create user # noqa: E501 @@ -83,7 +83,7 @@ def create_user(self, user : Annotated[User, Field(..., description="Created use kwargs['async_req'] = async_req return self.create_user_with_http_info(user, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def create_user_with_http_info(self, user : Annotated[User, Field(..., description="Created user object")], **kwargs) -> ApiResponse: # noqa: E501 """Create user # noqa: E501 @@ -217,7 +217,7 @@ async def create_users_with_array_input(self, user : Annotated[conlist(User), Fi def create_users_with_array_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def create_users_with_array_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """Creates list of users with given input array # noqa: E501 @@ -248,7 +248,7 @@ def create_users_with_array_input(self, user : Annotated[conlist(User), Field(.. kwargs['async_req'] = async_req return self.create_users_with_array_input_with_http_info(user, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def create_users_with_array_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> ApiResponse: # noqa: E501 """Creates list of users with given input array # noqa: E501 @@ -367,7 +367,7 @@ async def create_users_with_list_input(self, user : Annotated[conlist(User), Fie def create_users_with_list_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def create_users_with_list_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """Creates list of users with given input array # noqa: E501 @@ -398,7 +398,7 @@ def create_users_with_list_input(self, user : Annotated[conlist(User), Field(... kwargs['async_req'] = async_req return self.create_users_with_list_input_with_http_info(user, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def create_users_with_list_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> ApiResponse: # noqa: E501 """Creates list of users with given input array # noqa: E501 @@ -517,7 +517,7 @@ async def delete_user(self, username : Annotated[StrictStr, Field(..., descripti def delete_user(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be deleted")], async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def delete_user(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be deleted")], async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """Delete user # noqa: E501 @@ -548,7 +548,7 @@ def delete_user(self, username : Annotated[StrictStr, Field(..., description="Th kwargs['async_req'] = async_req return self.delete_user_with_http_info(username, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def delete_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be deleted")], **kwargs) -> ApiResponse: # noqa: E501 """Delete user # noqa: E501 @@ -660,7 +660,7 @@ async def get_user_by_name(self, username : Annotated[StrictStr, Field(..., desc def get_user_by_name(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be fetched. Use user1 for testing.")], async_req: Optional[bool]=True, **kwargs) -> User: # noqa: E501 ... - @validate_arguments + @validate_call def get_user_by_name(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be fetched. Use user1 for testing.")], async_req: Optional[bool]=None, **kwargs) -> Union[User, Awaitable[User]]: # noqa: E501 """Get user by user name # noqa: E501 @@ -691,7 +691,7 @@ def get_user_by_name(self, username : Annotated[StrictStr, Field(..., descriptio kwargs['async_req'] = async_req return self.get_user_by_name_with_http_info(username, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def get_user_by_name_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be fetched. Use user1 for testing.")], **kwargs) -> ApiResponse: # noqa: E501 """Get user by user name # noqa: E501 @@ -811,7 +811,7 @@ async def login_user(self, username : Annotated[StrictStr, Field(..., descriptio def login_user(self, username : Annotated[StrictStr, Field(..., description="The user name for login")], password : Annotated[StrictStr, Field(..., description="The password for login in clear text")], async_req: Optional[bool]=True, **kwargs) -> str: # noqa: E501 ... - @validate_arguments + @validate_call def login_user(self, username : Annotated[StrictStr, Field(..., description="The user name for login")], password : Annotated[StrictStr, Field(..., description="The password for login in clear text")], async_req: Optional[bool]=None, **kwargs) -> Union[str, Awaitable[str]]: # noqa: E501 """Logs user into the system # noqa: E501 @@ -844,7 +844,7 @@ def login_user(self, username : Annotated[StrictStr, Field(..., description="The kwargs['async_req'] = async_req return self.login_user_with_http_info(username, password, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def login_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The user name for login")], password : Annotated[StrictStr, Field(..., description="The password for login in clear text")], **kwargs) -> ApiResponse: # noqa: E501 """Logs user into the system # noqa: E501 @@ -969,7 +969,7 @@ async def logout_user(self, **kwargs) -> None: # noqa: E501 def logout_user(self, async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def logout_user(self, async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """Logs out current logged in user session # noqa: E501 @@ -998,7 +998,7 @@ def logout_user(self, async_req: Optional[bool]=None, **kwargs) -> Union[None, A kwargs['async_req'] = async_req return self.logout_user_with_http_info(**kwargs) # noqa: E501 - @validate_arguments + @validate_call def logout_user_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 """Logs out current logged in user session # noqa: E501 @@ -1104,7 +1104,7 @@ async def update_user(self, username : Annotated[StrictStr, Field(..., descripti def update_user(self, username : Annotated[StrictStr, Field(..., description="name that need to be deleted")], user : Annotated[User, Field(..., description="Updated user object")], async_req: Optional[bool]=True, **kwargs) -> None: # noqa: E501 ... - @validate_arguments + @validate_call def update_user(self, username : Annotated[StrictStr, Field(..., description="name that need to be deleted")], user : Annotated[User, Field(..., description="Updated user object")], async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]: # noqa: E501 """Updated user # noqa: E501 @@ -1137,7 +1137,7 @@ def update_user(self, username : Annotated[StrictStr, Field(..., description="na kwargs['async_req'] = async_req return self.update_user_with_http_info(username, user, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def update_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="name that need to be deleted")], user : Annotated[User, Field(..., description="Updated user object")], **kwargs) -> ApiResponse: # noqa: E501 """Updated user # noqa: E501 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 0441dfd99e92..65c01f1cfbaa 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 @@ -29,10 +29,11 @@ class AdditionalPropertiesAnyType(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["name"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 c53af3e2ca67..a11a8d81d783 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 @@ -29,10 +29,11 @@ class AdditionalPropertiesClass(BaseModel): map_of_map_property: Optional[Dict[str, Dict[str, StrictStr]]] = None __properties = ["map_property", "map_of_map_property"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 cff0e89b0568..9df6fbf386bc 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 @@ -29,10 +29,11 @@ class AdditionalPropertiesObject(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["name"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 17d6c461ed1b..b0ca59b4f349 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 @@ -29,10 +29,11 @@ class AdditionalPropertiesWithDescriptionOnly(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["name"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 c5d066463f64..af8aa0572e76 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 @@ -30,10 +30,11 @@ class AllOfWithSingleRef(BaseModel): single_ref_type: Optional[SingleRefType] = Field(None, alias="SingleRefType") __properties = ["username", "SingleRefType"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 18738e6051bc..619c243cb21b 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 @@ -29,10 +29,11 @@ class Animal(BaseModel): color: Optional[StrictStr] = 'red' __properties = ["className", "color"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } # JSON field name that stores the object type __discriminator_property_name = 'className' 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 61defc0e9eb8..9342f49264cf 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 @@ -42,8 +42,9 @@ class AnyOfColor(BaseModel): actual_instance: Any any_of_schemas: List[str] = Field(ANYOFCOLOR_ANY_OF_SCHEMAS, const=True) - class Config: - validate_assignment = True + model_config = { + "validate_assignment": True, + } def __init__(self, *args, **kwargs): if args: 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 c2f26f1e873b..73731baed652 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 @@ -42,8 +42,9 @@ class AnyOfPig(BaseModel): actual_instance: Any any_of_schemas: List[str] = Field(ANYOFPIG_ANY_OF_SCHEMAS, const=True) - class Config: - validate_assignment = True + model_config = { + "validate_assignment": True, + } def __init__(self, *args, **kwargs): if args: 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 2c58b8b9ccb8..6357e647bb58 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 @@ -30,10 +30,11 @@ class ApiResponse(BaseModel): message: Optional[StrictStr] = None __properties = ["code", "type", "message"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 6f67b220ccf1..25b5d4938a63 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 @@ -29,10 +29,11 @@ class ArrayOfArrayOfModel(BaseModel): another_property: Optional[conlist(conlist(Tag))] = None __properties = ["another_property"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 8ce909858b18..fbacbd45d864 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 @@ -28,10 +28,11 @@ class ArrayOfArrayOfNumberOnly(BaseModel): array_array_number: Optional[conlist(conlist(float))] = Field(None, alias="ArrayArrayNumber") __properties = ["ArrayArrayNumber"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 768ea5ef0baf..3ebca1c2b543 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 @@ -28,10 +28,11 @@ class ArrayOfNumberOnly(BaseModel): array_number: Optional[conlist(float)] = Field(None, alias="ArrayNumber") __properties = ["ArrayNumber"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 8ec1a1ad67ef..fcd2db834256 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 @@ -31,10 +31,11 @@ class ArrayTest(BaseModel): array_array_of_model: Optional[conlist(conlist(ReadOnlyFirst))] = None __properties = ["array_of_string", "array_array_of_integer", "array_array_of_model"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 5683a73a3bfc..5836df604597 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 @@ -29,10 +29,11 @@ class BasquePig(BaseModel): color: StrictStr = Field(...) __properties = ["className", "color"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 2bb4435563b2..c7a110d95e8c 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 @@ -33,10 +33,11 @@ class Capitalization(BaseModel): att_name: Optional[StrictStr] = Field(None, alias="ATT_NAME", description="Name of the pet ") __properties = ["smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 efff0890a41a..81e1190dfd9a 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 @@ -29,10 +29,11 @@ class Cat(Animal): declawed: Optional[StrictBool] = None __properties = ["className", "color", "declawed"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 86a10a8683cf..d9eff1f7b044 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 @@ -29,10 +29,11 @@ class Category(BaseModel): name: StrictStr = Field(...) __properties = ["id", "name"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 6a9956f5af3b..6f7c27844e70 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 @@ -29,10 +29,11 @@ class CircularReferenceModel(BaseModel): nested: Optional[FirstRef] = None __properties = ["size", "nested"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 4a17279d002f..0da856751726 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 @@ -28,10 +28,11 @@ class ClassModel(BaseModel): var_class: Optional[StrictStr] = Field(None, alias="_class") __properties = ["_class"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 01f60acef507..6d164febad7c 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 @@ -28,10 +28,11 @@ class Client(BaseModel): client: Optional[StrictStr] = None __properties = ["client"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 eda8b56415eb..914d20e0e5b7 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,8 +23,6 @@ from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field -COLOR_ONE_OF_SCHEMAS = ["List[int]", "str"] - class Color(BaseModel): """ RGB array, RGBA array, or hex string. @@ -39,10 +37,11 @@ class Color(BaseModel): actual_instance: Union[List[int], str] else: actual_instance: Any - one_of_schemas: List[str] = Field(COLOR_ONE_OF_SCHEMAS, const=True) + one_of_schemas: List[str] = Literal["List[int]", "str"] - class Config: - validate_assignment = True + model_config = { + "validate_assignment": True, + } def __init__(self, *args, **kwargs): if args: 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 dc2d94ece4cb..6b9ca9f55188 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 @@ -30,10 +30,11 @@ class Creature(BaseModel): type: StrictStr = Field(...) __properties = ["info", "type"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 327ce9bc4fbc..f19603c3fcef 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 @@ -28,10 +28,11 @@ class CreatureInfo(BaseModel): name: StrictStr = Field(...) __properties = ["name"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 cfb24a7d5857..68cc4ace4904 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 @@ -29,10 +29,11 @@ class DanishPig(BaseModel): size: StrictInt = Field(...) __properties = ["className", "size"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 9ce72f88d48b..367e7ea9a8a1 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 @@ -28,10 +28,11 @@ class DeprecatedObject(BaseModel): name: Optional[StrictStr] = None __properties = ["name"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 f0533a50e495..62507cfbcdb6 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 @@ -29,10 +29,11 @@ class Dog(Animal): breed: Optional[StrictStr] = None __properties = ["className", "color", "breed"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 8e4db12e5c92..77a1f8e4471e 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 @@ -29,10 +29,11 @@ class DummyModel(BaseModel): self_ref: Optional[SelfReferenceModel] = None __properties = ["category", "self_ref"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 5f3363b0a564..75dc422b53ca 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 @@ -50,10 +50,11 @@ def array_enum_validate_enum(cls, value): raise ValueError("each list item must be one of ('fish', 'crab')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 b3899720fd30..6461dabdfd12 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 @@ -87,10 +87,11 @@ def enum_number_validate_enum(cls, value): raise ValueError("must be one of enum values (1.1, -1.2)") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 70f34a147d4c..161a437cca3d 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 @@ -28,10 +28,11 @@ class File(BaseModel): source_uri: Optional[StrictStr] = Field(None, alias="sourceURI", description="Test capitalization") __properties = ["sourceURI"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 32058bd16fa0..104a95164bc0 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 @@ -30,10 +30,11 @@ class FileSchemaTestClass(BaseModel): files: Optional[conlist(File)] = None __properties = ["file", "files"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 ace84a5bcb84..12ac72f1479a 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 @@ -29,10 +29,11 @@ class FirstRef(BaseModel): self_ref: Optional[SecondRef] = None __properties = ["category", "self_ref"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 fc58b159e5f5..0134ffef7686 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 @@ -28,10 +28,11 @@ class Foo(BaseModel): bar: Optional[StrictStr] = 'bar' __properties = ["bar"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 e792358dc002..8aee269f7bcb 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 @@ -29,10 +29,11 @@ class FooGetDefaultResponse(BaseModel): string: Optional[Foo] = None __properties = ["string"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 a0abc32a6598..0d6741b9eccf 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 @@ -84,10 +84,11 @@ def pattern_with_digits_and_delimiter_validate_regular_expression(cls, value): raise ValueError(r"must validate the regular expression /^image_\d{1,3}$/i") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 5a6dd7857d12..99c585cf61c2 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 @@ -29,10 +29,11 @@ class HasOnlyReadOnly(BaseModel): foo: Optional[StrictStr] = None __properties = ["bar", "foo"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 420f65a0a8cf..dff0f5394c95 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 @@ -28,10 +28,11 @@ class HealthCheckResult(BaseModel): nullable_message: Optional[StrictStr] = Field(None, alias="NullableMessage") __properties = ["NullableMessage"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 9f134186b6a6..1156a2eded6e 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 @@ -28,10 +28,11 @@ class InnerDictWithProperty(BaseModel): a_property: Optional[Dict[str, Any]] = Field(None, alias="aProperty") __properties = ["aProperty"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 ef8444eec0dd..2e60227494b0 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,8 +23,6 @@ from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field -INTORSTRING_ONE_OF_SCHEMAS = ["int", "str"] - class IntOrString(BaseModel): """ IntOrString @@ -37,10 +35,11 @@ class IntOrString(BaseModel): actual_instance: Union[int, str] else: actual_instance: Any - one_of_schemas: List[str] = Field(INTORSTRING_ONE_OF_SCHEMAS, const=True) + one_of_schemas: List[str] = Literal["int", "str"] - class Config: - validate_assignment = True + model_config = { + "validate_assignment": True, + } def __init__(self, *args, **kwargs): if args: diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/list.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/list.py index 4c6868146ad0..0ec2b7844dfe 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/list.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/list.py @@ -28,10 +28,11 @@ class List(BaseModel): var_123_list: Optional[StrictStr] = Field(None, alias="123-list") __properties = ["123-list"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 444732620ab5..1cc64df7ade0 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 @@ -29,10 +29,11 @@ class MapOfArrayOfModel(BaseModel): shop_id_to_org_online_lip_map: Optional[Dict[str, conlist(Tag)]] = Field(None, alias="shopIdToOrgOnlineLipMap") __properties = ["shopIdToOrgOnlineLipMap"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 42e47b1cb4f3..e7d2a4ca00c0 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 @@ -41,10 +41,11 @@ def map_of_enum_string_validate_enum(cls, value): raise ValueError("must be one of enum values ('UPPER', 'lower')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 03f306af535f..0cee674b9180 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 @@ -31,10 +31,11 @@ class MixedPropertiesAndAdditionalPropertiesClass(BaseModel): map: Optional[Dict[str, Animal]] = None __properties = ["uuid", "dateTime", "map"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 109d68559456..ddc7c5d2737e 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 @@ -29,10 +29,11 @@ class Model200Response(BaseModel): var_class: Optional[StrictStr] = Field(None, alias="class") __properties = ["name", "class"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 f370adcc19e2..e8a8c101d520 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 @@ -28,10 +28,11 @@ class ModelReturn(BaseModel): var_return: Optional[StrictInt] = Field(None, alias="return") __properties = ["return"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 b6bf35f233a7..dc4e81120fac 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 @@ -31,10 +31,11 @@ class Name(BaseModel): var_123_number: Optional[StrictInt] = Field(None, alias="123Number") __properties = ["name", "snake_case", "property", "123Number"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 f26aac9ff07d..48af47c9012a 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 @@ -41,10 +41,11 @@ class NullableClass(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["required_integer_prop", "integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 2312fbbbf5fd..5d013cc8d768 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 @@ -39,10 +39,11 @@ def name_validate_regular_expression(cls, value): raise ValueError(r"must validate the regular expression /^[A-Z].*/") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 6549b2617824..833eb9e8d37a 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 @@ -28,10 +28,11 @@ class NumberOnly(BaseModel): just_number: Optional[float] = Field(None, alias="JustNumber") __properties = ["JustNumber"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 1757c255c2f4..7967cca85651 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 @@ -28,10 +28,11 @@ class ObjectToTestAdditionalProperties(BaseModel): var_property: Optional[StrictBool] = Field(False, alias="property", description="Property") __properties = ["property"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 421206c1bc79..f347e4481b96 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 @@ -32,10 +32,11 @@ class ObjectWithDeprecatedFields(BaseModel): bars: Optional[conlist(StrictStr)] = None __properties = ["uuid", "id", "deprecatedRef", "bars"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 282b555ca937..81763613deb3 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 @@ -25,8 +25,6 @@ from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field -ONEOFENUMSTRING_ONE_OF_SCHEMAS = ["EnumString1", "EnumString2"] - class OneOfEnumString(BaseModel): """ oneOf enum strings @@ -39,10 +37,11 @@ class OneOfEnumString(BaseModel): actual_instance: Union[EnumString1, EnumString2] else: actual_instance: Any - one_of_schemas: List[str] = Field(ONEOFENUMSTRING_ONE_OF_SCHEMAS, const=True) + one_of_schemas: List[str] = Literal["EnumString1", "EnumString2"] - class Config: - validate_assignment = True + model_config = { + "validate_assignment": True, + } def __init__(self, *args, **kwargs): if args: 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 da726d2096dc..cc247c338e86 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 @@ -43,10 +43,11 @@ def status_validate_enum(cls, value): raise ValueError("must be one of enum values ('placed', 'approved', 'delivered')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 63627c3d0fde..f7875c10120e 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 @@ -30,10 +30,11 @@ class OuterComposite(BaseModel): my_boolean: Optional[StrictBool] = None __properties = ["my_number", "my_string", "my_boolean"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 c4ae68e5510f..0c081d3fdcd8 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 @@ -31,10 +31,11 @@ class OuterObjectWithEnumProperty(BaseModel): value: OuterEnumInteger = Field(...) __properties = ["str_value", "value"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 a3105aff6821..2a6c8ad44b64 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 @@ -29,10 +29,11 @@ class Parent(BaseModel): optional_dict: Optional[Dict[str, InnerDictWithProperty]] = Field(None, alias="optionalDict") __properties = ["optionalDict"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 253747b3abd7..4ea547aa64f5 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 @@ -29,10 +29,11 @@ class ParentWithOptionalDict(BaseModel): optional_dict: Optional[Dict[str, InnerDictWithProperty]] = Field(None, alias="optionalDict") __properties = ["optionalDict"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 e45fdc4a27d7..b540ff1a37f6 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 @@ -45,10 +45,11 @@ def status_validate_enum(cls, value): raise ValueError("must be one of enum values ('available', 'pending', 'sold')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 dc8e394d6892..3fa83b9264a5 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 @@ -25,8 +25,6 @@ from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field -PIG_ONE_OF_SCHEMAS = ["BasquePig", "DanishPig"] - class Pig(BaseModel): """ Pig @@ -39,10 +37,11 @@ class Pig(BaseModel): actual_instance: Union[BasquePig, DanishPig] else: actual_instance: Any - one_of_schemas: List[str] = Field(PIG_ONE_OF_SCHEMAS, const=True) + one_of_schemas: List[str] = Literal["BasquePig", "DanishPig"] - class Config: - validate_assignment = True + model_config = { + "validate_assignment": True, + } discriminator_value_class_map = { } 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 ed45ecdf74c4..4aefd1e2a6ff 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 @@ -30,10 +30,11 @@ class PropertyNameCollision(BaseModel): type_: Optional[StrictStr] = None __properties = ["_type", "type", "type_"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 da66589ee79c..84babaf1b743 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 @@ -29,10 +29,11 @@ class ReadOnlyFirst(BaseModel): baz: Optional[StrictStr] = None __properties = ["bar", "baz"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 0c4f70eb9395..af2150b98fc0 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 @@ -29,10 +29,11 @@ class SecondRef(BaseModel): circular_ref: Optional[CircularReferenceModel] = None __properties = ["category", "circular_ref"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 f7470db995e6..1a21ff6c4188 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 @@ -29,10 +29,11 @@ class SelfReferenceModel(BaseModel): nested: Optional[DummyModel] = None __properties = ["size", "nested"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 43e57ff7b7bd..1d966d62f3d4 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 @@ -28,10 +28,11 @@ class SpecialModelName(BaseModel): special_property_name: Optional[StrictInt] = Field(None, alias="$special[property.name]") __properties = ["$special[property.name]"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 f8841f7a4cce..6114f61c16c3 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 @@ -41,10 +41,11 @@ def var_schema_validate_enum(cls, value): raise ValueError("must be one of enum values ('available', 'pending', 'sold')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 45605d239331..08b10c2d340a 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 @@ -29,10 +29,11 @@ class Tag(BaseModel): name: Optional[StrictStr] = None __properties = ["id", "name"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 88b2f3c6a04f..fc2f0ab5a8ad 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 @@ -28,10 +28,11 @@ class Tiger(BaseModel): skill: Optional[StrictStr] = None __properties = ["skill"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 5c09a897c702..15a5bd2eb96b 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 @@ -35,10 +35,11 @@ class User(BaseModel): user_status: Optional[StrictInt] = Field(None, alias="userStatus", description="User Status") __properties = ["id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 0268402b5f4c..6a300d09ce38 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 @@ -32,10 +32,11 @@ class WithNestedOneOf(BaseModel): nested_oneof_enum_string: Optional[OneOfEnumString] = None __properties = ["size", "nested_pig", "nested_oneof_enum_string"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" diff --git a/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml b/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml index 8c0a993b36fa..4b05f7ffed70 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml +++ b/samples/openapi3/client/petstore/python-aiohttp/pyproject.toml @@ -17,7 +17,7 @@ python-dateutil = ">=2.8.2" aiohttp = ">= 3.8.4" pem = ">= 19.3.0" pycryptodome = ">= 3.9.0" -pydantic = "^1.10.5, <2" +pydantic = ">=2" aenum = ">=3.1.11" [tool.poetry.dev-dependencies] diff --git a/samples/openapi3/client/petstore/python-aiohttp/requirements.txt b/samples/openapi3/client/petstore/python-aiohttp/requirements.txt index 6833ad6202a4..35dab37f1207 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/requirements.txt +++ b/samples/openapi3/client/petstore/python-aiohttp/requirements.txt @@ -1,6 +1,6 @@ python_dateutil >= 2.5.3 setuptools >= 21.0.0 urllib3 >= 1.25.3, < 2.1.0 -pydantic >= 1.10.5, < 2 +pydantic >= 2 aenum >= 3.1.11 aiohttp >= 3.0.0 diff --git a/samples/openapi3/client/petstore/python-aiohttp/setup.py b/samples/openapi3/client/petstore/python-aiohttp/setup.py index e5b090da62b1..63d7670fe754 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/setup.py +++ b/samples/openapi3/client/petstore/python-aiohttp/setup.py @@ -29,7 +29,7 @@ "aiohttp >= 3.0.0", "pem>=19.3.0", "pycryptodome>=3.9.0", - "pydantic >= 1.10.5, < 2", + "pydantic >= 2", "aenum" ] 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 8599ca98bbf4..a04b29e0b2e3 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,7 +16,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from pydantic import Field @@ -43,7 +43,7 @@ def __init__(self, api_client=None): api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def call_123_test_special_tags(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> Client: # noqa: E501 """To test special tags # noqa: E501 @@ -72,7 +72,7 @@ def call_123_test_special_tags(self, client : Annotated[Client, Field(..., descr raise ValueError("Error! Please call the call_123_test_special_tags_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def call_123_test_special_tags_with_http_info(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> ApiResponse: # noqa: E501 """To test special tags # noqa: E501 diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py index 3ef7887aa612..16bdbe8e3be8 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,7 +16,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from petstore_api.models.foo_get_default_response import FooGetDefaultResponse @@ -41,7 +41,7 @@ def __init__(self, api_client=None): api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def foo_get(self, **kwargs) -> FooGetDefaultResponse: # noqa: E501 """foo_get # noqa: E501 @@ -67,7 +67,7 @@ def foo_get(self, **kwargs) -> FooGetDefaultResponse: # noqa: E501 raise ValueError("Error! Please call the foo_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.foo_get_with_http_info(**kwargs) # noqa: E501 - @validate_arguments + @validate_call def foo_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 """foo_get # noqa: E501 diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py index 24fd078e45a2..d23358eb9439 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,7 +16,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from datetime import date, datetime @@ -55,7 +55,7 @@ def __init__(self, api_client=None): api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def fake_any_type_request_body(self, body : Optional[Dict[str, Any]] = None, **kwargs) -> None: # noqa: E501 """test any type request body # noqa: E501 @@ -83,7 +83,7 @@ def fake_any_type_request_body(self, body : Optional[Dict[str, Any]] = None, **k raise ValueError("Error! Please call the fake_any_type_request_body_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.fake_any_type_request_body_with_http_info(body, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_any_type_request_body_with_http_info(self, body : Optional[Dict[str, Any]] = None, **kwargs) -> ApiResponse: # noqa: E501 """test any type request body # noqa: E501 @@ -193,7 +193,7 @@ def fake_any_type_request_body_with_http_info(self, body : Optional[Dict[str, An collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def fake_enum_ref_query_parameter(self, enum_ref : Annotated[Optional[EnumClass], Field(description="enum reference")] = None, **kwargs) -> None: # noqa: E501 """test enum reference query parameter # noqa: E501 @@ -221,7 +221,7 @@ def fake_enum_ref_query_parameter(self, enum_ref : Annotated[Optional[EnumClass] raise ValueError("Error! Please call the fake_enum_ref_query_parameter_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.fake_enum_ref_query_parameter_with_http_info(enum_ref, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_enum_ref_query_parameter_with_http_info(self, enum_ref : Annotated[Optional[EnumClass], Field(description="enum reference")] = None, **kwargs) -> ApiResponse: # noqa: E501 """test enum reference query parameter # noqa: E501 @@ -324,7 +324,7 @@ def fake_enum_ref_query_parameter_with_http_info(self, enum_ref : Annotated[Opti collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def fake_health_get(self, **kwargs) -> HealthCheckResult: # noqa: E501 """Health check endpoint # noqa: E501 @@ -350,7 +350,7 @@ def fake_health_get(self, **kwargs) -> HealthCheckResult: # noqa: E501 raise ValueError("Error! Please call the fake_health_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.fake_health_get_with_http_info(**kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_health_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 """Health check endpoint # noqa: E501 @@ -453,7 +453,7 @@ def fake_health_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def fake_http_signature_test(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], query_1 : Annotated[Optional[StrictStr], Field(description="query parameter")] = None, header_1 : Annotated[Optional[StrictStr], Field(description="header parameter")] = None, **kwargs) -> None: # noqa: E501 """test http signature authentication # noqa: E501 @@ -485,7 +485,7 @@ def fake_http_signature_test(self, pet : Annotated[Pet, Field(..., description=" raise ValueError("Error! Please call the fake_http_signature_test_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.fake_http_signature_test_with_http_info(pet, query_1, header_1, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_http_signature_test_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], query_1 : Annotated[Optional[StrictStr], Field(description="query parameter")] = None, header_1 : Annotated[Optional[StrictStr], Field(description="header parameter")] = None, **kwargs) -> ApiResponse: # noqa: E501 """test http signature authentication # noqa: E501 @@ -607,7 +607,7 @@ def fake_http_signature_test_with_http_info(self, pet : Annotated[Pet, Field(... collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def fake_outer_boolean_serialize(self, body : Annotated[Optional[StrictBool], Field(description="Input boolean as post body")] = None, **kwargs) -> bool: # noqa: E501 """fake_outer_boolean_serialize # noqa: E501 @@ -636,7 +636,7 @@ def fake_outer_boolean_serialize(self, body : Annotated[Optional[StrictBool], Fi raise ValueError("Error! Please call the fake_outer_boolean_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.fake_outer_boolean_serialize_with_http_info(body, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_outer_boolean_serialize_with_http_info(self, body : Annotated[Optional[StrictBool], Field(description="Input boolean as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 """fake_outer_boolean_serialize # noqa: E501 @@ -753,7 +753,7 @@ def fake_outer_boolean_serialize_with_http_info(self, body : Annotated[Optional[ collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def fake_outer_composite_serialize(self, outer_composite : Annotated[Optional[OuterComposite], Field(description="Input composite as post body")] = None, **kwargs) -> OuterComposite: # noqa: E501 """fake_outer_composite_serialize # noqa: E501 @@ -782,7 +782,7 @@ def fake_outer_composite_serialize(self, outer_composite : Annotated[Optional[Ou raise ValueError("Error! Please call the fake_outer_composite_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.fake_outer_composite_serialize_with_http_info(outer_composite, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_outer_composite_serialize_with_http_info(self, outer_composite : Annotated[Optional[OuterComposite], Field(description="Input composite as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 """fake_outer_composite_serialize # noqa: E501 @@ -899,7 +899,7 @@ def fake_outer_composite_serialize_with_http_info(self, outer_composite : Annota collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def fake_outer_number_serialize(self, body : Annotated[Optional[StrictFloat], Field(description="Input number as post body")] = None, **kwargs) -> float: # noqa: E501 """fake_outer_number_serialize # noqa: E501 @@ -928,7 +928,7 @@ def fake_outer_number_serialize(self, body : Annotated[Optional[StrictFloat], Fi raise ValueError("Error! Please call the fake_outer_number_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.fake_outer_number_serialize_with_http_info(body, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_outer_number_serialize_with_http_info(self, body : Annotated[Optional[StrictFloat], Field(description="Input number as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 """fake_outer_number_serialize # noqa: E501 @@ -1045,7 +1045,7 @@ def fake_outer_number_serialize_with_http_info(self, body : Annotated[Optional[S collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def fake_outer_string_serialize(self, body : Annotated[Optional[StrictStr], Field(description="Input string as post body")] = None, **kwargs) -> str: # noqa: E501 """fake_outer_string_serialize # noqa: E501 @@ -1074,7 +1074,7 @@ def fake_outer_string_serialize(self, body : Annotated[Optional[StrictStr], Fiel raise ValueError("Error! Please call the fake_outer_string_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.fake_outer_string_serialize_with_http_info(body, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_outer_string_serialize_with_http_info(self, body : Annotated[Optional[StrictStr], Field(description="Input string as post body")] = None, **kwargs) -> ApiResponse: # noqa: E501 """fake_outer_string_serialize # noqa: E501 @@ -1191,7 +1191,7 @@ def fake_outer_string_serialize_with_http_info(self, body : Annotated[Optional[S collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def fake_property_enum_integer_serialize(self, outer_object_with_enum_property : Annotated[OuterObjectWithEnumProperty, Field(..., description="Input enum (int) as post body")], **kwargs) -> OuterObjectWithEnumProperty: # noqa: E501 """fake_property_enum_integer_serialize # noqa: E501 @@ -1220,7 +1220,7 @@ def fake_property_enum_integer_serialize(self, outer_object_with_enum_property : raise ValueError("Error! Please call the fake_property_enum_integer_serialize_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_property, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_property_enum_integer_serialize_with_http_info(self, outer_object_with_enum_property : Annotated[OuterObjectWithEnumProperty, Field(..., description="Input enum (int) as post body")], **kwargs) -> ApiResponse: # noqa: E501 """fake_property_enum_integer_serialize # noqa: E501 @@ -1337,7 +1337,7 @@ def fake_property_enum_integer_serialize_with_http_info(self, outer_object_with_ collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def fake_return_list_of_objects(self, **kwargs) -> List[List[Tag]]: # noqa: E501 """test returning list of objects # noqa: E501 @@ -1363,7 +1363,7 @@ def fake_return_list_of_objects(self, **kwargs) -> List[List[Tag]]: # noqa: E50 raise ValueError("Error! Please call the fake_return_list_of_objects_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.fake_return_list_of_objects_with_http_info(**kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_return_list_of_objects_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 """test returning list of objects # noqa: E501 @@ -1466,7 +1466,7 @@ def fake_return_list_of_objects_with_http_info(self, **kwargs) -> ApiResponse: collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def fake_uuid_example(self, uuid_example : Annotated[StrictStr, Field(..., description="uuid example")], **kwargs) -> None: # noqa: E501 """test uuid example # noqa: E501 @@ -1494,7 +1494,7 @@ def fake_uuid_example(self, uuid_example : Annotated[StrictStr, Field(..., descr raise ValueError("Error! Please call the fake_uuid_example_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.fake_uuid_example_with_http_info(uuid_example, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def fake_uuid_example_with_http_info(self, uuid_example : Annotated[StrictStr, Field(..., description="uuid example")], **kwargs) -> ApiResponse: # noqa: E501 """test uuid example # noqa: E501 @@ -1597,7 +1597,7 @@ def fake_uuid_example_with_http_info(self, uuid_example : Annotated[StrictStr, F collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_body_with_binary(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], **kwargs) -> None: # noqa: E501 """test_body_with_binary # noqa: E501 @@ -1626,7 +1626,7 @@ def test_body_with_binary(self, body : Annotated[Optional[Union[StrictBytes, Str raise ValueError("Error! Please call the test_body_with_binary_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_body_with_binary_with_http_info(body, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_body_with_binary_with_http_info(self, body : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(..., description="image to upload")], **kwargs) -> ApiResponse: # noqa: E501 """test_body_with_binary # noqa: E501 @@ -1742,7 +1742,7 @@ def test_body_with_binary_with_http_info(self, body : Annotated[Optional[Union[S collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_body_with_file_schema(self, file_schema_test_class : FileSchemaTestClass, **kwargs) -> None: # noqa: E501 """test_body_with_file_schema # noqa: E501 @@ -1771,7 +1771,7 @@ def test_body_with_file_schema(self, file_schema_test_class : FileSchemaTestClas raise ValueError("Error! Please call the test_body_with_file_schema_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_body_with_file_schema_with_http_info(self, file_schema_test_class : FileSchemaTestClass, **kwargs) -> ApiResponse: # noqa: E501 """test_body_with_file_schema # noqa: E501 @@ -1882,7 +1882,7 @@ def test_body_with_file_schema_with_http_info(self, file_schema_test_class : Fil collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_body_with_query_params(self, query : StrictStr, user : User, **kwargs) -> None: # noqa: E501 """test_body_with_query_params # noqa: E501 @@ -1912,7 +1912,7 @@ def test_body_with_query_params(self, query : StrictStr, user : User, **kwargs) raise ValueError("Error! Please call the test_body_with_query_params_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_body_with_query_params_with_http_info(query, user, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_body_with_query_params_with_http_info(self, query : StrictStr, user : User, **kwargs) -> ApiResponse: # noqa: E501 """test_body_with_query_params # noqa: E501 @@ -2028,7 +2028,7 @@ def test_body_with_query_params_with_http_info(self, query : StrictStr, user : U collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_client_model(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> Client: # noqa: E501 """To test \"client\" model # noqa: E501 @@ -2057,7 +2057,7 @@ def test_client_model(self, client : Annotated[Client, Field(..., description="c raise ValueError("Error! Please call the test_client_model_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_client_model_with_http_info(client, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_client_model_with_http_info(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> ApiResponse: # noqa: E501 """To test \"client\" model # noqa: E501 @@ -2174,7 +2174,7 @@ def test_client_model_with_http_info(self, client : Annotated[Client, Field(..., collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_date_time_query_parameter(self, date_time_query : datetime, str_query : StrictStr, **kwargs) -> None: # noqa: E501 """test_date_time_query_parameter # noqa: E501 @@ -2204,7 +2204,7 @@ def test_date_time_query_parameter(self, date_time_query : datetime, str_query : raise ValueError("Error! Please call the test_date_time_query_parameter_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_date_time_query_parameter_with_http_info(date_time_query, str_query, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_date_time_query_parameter_with_http_info(self, date_time_query : datetime, str_query : StrictStr, **kwargs) -> ApiResponse: # noqa: E501 """test_date_time_query_parameter # noqa: E501 @@ -2316,7 +2316,7 @@ def test_date_time_query_parameter_with_http_info(self, date_time_query : dateti collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_endpoint_parameters(self, number : Annotated[confloat(le=543.2, ge=32.1, strict=True), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8, strict=True), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6, strict=True)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[conbytes(strict=True, max_length=64), constr(strict=True, max_length=64)]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> None: # noqa: E501 """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 @@ -2373,7 +2373,7 @@ def test_endpoint_parameters(self, number : Annotated[confloat(le=543.2, ge=32.1 raise ValueError("Error! Please call the test_endpoint_parameters_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, integer, int32, int64, float, string, binary, byte_with_max_length, var_date, date_time, password, param_callback, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_endpoint_parameters_with_http_info(self, number : Annotated[confloat(le=543.2, ge=32.1, strict=True), Field(..., description="None")], double : Annotated[confloat(le=123.4, ge=67.8, strict=True), Field(..., description="None")], pattern_without_delimiter : Annotated[constr(strict=True), Field(..., description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(..., description="None")], integer : Annotated[Optional[conint(strict=True, le=100, ge=10)], Field(description="None")] = None, int32 : Annotated[Optional[conint(strict=True, le=200, ge=20)], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[confloat(le=987.6, strict=True)], Field(description="None")] = None, string : Annotated[Optional[constr(strict=True)], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[conbytes(strict=True, max_length=64), constr(strict=True, max_length=64)]], Field(description="None")] = None, var_date : Annotated[Optional[date], Field(description="None")] = None, date_time : Annotated[Optional[datetime], Field(description="None")] = None, password : Annotated[Optional[constr(strict=True, max_length=64, min_length=10)], Field(description="None")] = None, param_callback : Annotated[Optional[StrictStr], Field(description="None")] = None, **kwargs) -> ApiResponse: # noqa: E501 """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 @@ -2568,7 +2568,7 @@ def test_endpoint_parameters_with_http_info(self, number : Annotated[confloat(le collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_group_parameters(self, required_string_group : Annotated[StrictInt, Field(..., description="Required String in group parameters")], required_boolean_group : Annotated[StrictBool, Field(..., description="Required Boolean in group parameters")], required_int64_group : Annotated[StrictInt, Field(..., description="Required Integer in group parameters")], string_group : Annotated[Optional[StrictInt], Field(description="String in group parameters")] = None, boolean_group : Annotated[Optional[StrictBool], Field(description="Boolean in group parameters")] = None, int64_group : Annotated[Optional[StrictInt], Field(description="Integer in group parameters")] = None, **kwargs) -> None: # noqa: E501 """Fake endpoint to test group parameters (optional) # noqa: E501 @@ -2607,7 +2607,7 @@ def test_group_parameters(self, required_string_group : Annotated[StrictInt, Fie raise ValueError("Error! Please call the test_group_parameters_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_group_parameters_with_http_info(required_string_group, required_boolean_group, required_int64_group, string_group, boolean_group, int64_group, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_group_parameters_with_http_info(self, required_string_group : Annotated[StrictInt, Field(..., description="Required String in group parameters")], required_boolean_group : Annotated[StrictBool, Field(..., description="Required Boolean in group parameters")], required_int64_group : Annotated[StrictInt, Field(..., description="Required Integer in group parameters")], string_group : Annotated[Optional[StrictInt], Field(description="String in group parameters")] = None, boolean_group : Annotated[Optional[StrictBool], Field(description="Boolean in group parameters")] = None, int64_group : Annotated[Optional[StrictInt], Field(description="Integer in group parameters")] = None, **kwargs) -> ApiResponse: # noqa: E501 """Fake endpoint to test group parameters (optional) # noqa: E501 @@ -2741,7 +2741,7 @@ def test_group_parameters_with_http_info(self, required_string_group : Annotated collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_inline_additional_properties(self, request_body : Annotated[Dict[str, StrictStr], Field(..., description="request body")], **kwargs) -> None: # noqa: E501 """test inline additionalProperties # noqa: E501 @@ -2770,7 +2770,7 @@ def test_inline_additional_properties(self, request_body : Annotated[Dict[str, S raise ValueError("Error! Please call the test_inline_additional_properties_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_inline_additional_properties_with_http_info(request_body, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_inline_additional_properties_with_http_info(self, request_body : Annotated[Dict[str, StrictStr], Field(..., description="request body")], **kwargs) -> ApiResponse: # noqa: E501 """test inline additionalProperties # noqa: E501 @@ -2881,7 +2881,7 @@ def test_inline_additional_properties_with_http_info(self, request_body : Annota collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_json_form_data(self, param : Annotated[StrictStr, Field(..., description="field1")], param2 : Annotated[StrictStr, Field(..., description="field2")], **kwargs) -> None: # noqa: E501 """test json serialization of form data # noqa: E501 @@ -2912,7 +2912,7 @@ def test_json_form_data(self, param : Annotated[StrictStr, Field(..., descriptio raise ValueError("Error! Please call the test_json_form_data_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_json_form_data_with_http_info(param, param2, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_json_form_data_with_http_info(self, param : Annotated[StrictStr, Field(..., description="field1")], param2 : Annotated[StrictStr, Field(..., description="field2")], **kwargs) -> ApiResponse: # noqa: E501 """test json serialization of form data # noqa: E501 @@ -3029,7 +3029,7 @@ def test_json_form_data_with_http_info(self, param : Annotated[StrictStr, Field( collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def test_query_parameter_collection_format(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> None: # noqa: E501 """test_query_parameter_collection_format # noqa: E501 @@ -3070,7 +3070,7 @@ def test_query_parameter_collection_format(self, pipe : conlist(StrictStr), iout raise ValueError("Error! Please call the test_query_parameter_collection_format_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, url, context, allow_empty, language, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_query_parameter_collection_format_with_http_info(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> ApiResponse: # noqa: E501 """test_query_parameter_collection_format # noqa: E501 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 d30572a41ea1..7268783cd528 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,7 +16,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from pydantic import Field @@ -43,7 +43,7 @@ def __init__(self, api_client=None): api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def test_classname(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> Client: # noqa: E501 """To test class name in snake case # noqa: E501 @@ -72,7 +72,7 @@ def test_classname(self, client : Annotated[Client, Field(..., description="clie raise ValueError("Error! Please call the test_classname_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.test_classname_with_http_info(client, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def test_classname_with_http_info(self, client : Annotated[Client, Field(..., description="client model")], **kwargs) -> ApiResponse: # noqa: E501 """To test class name in snake case # noqa: E501 diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py index fc6a02505035..801f0c694f08 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,7 +16,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from pydantic import Field, StrictBytes, StrictInt, StrictStr, conlist, validator @@ -46,7 +46,7 @@ def __init__(self, api_client=None): api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def add_pet(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> None: # noqa: E501 """Add a new pet to the store # noqa: E501 @@ -75,7 +75,7 @@ def add_pet(self, pet : Annotated[Pet, Field(..., description="Pet object that n raise ValueError("Error! Please call the add_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.add_pet_with_http_info(pet, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def add_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> ApiResponse: # noqa: E501 """Add a new pet to the store # noqa: E501 @@ -186,7 +186,7 @@ def add_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pe collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def delete_pet(self, pet_id : Annotated[StrictInt, Field(..., description="Pet id to delete")], api_key : Optional[StrictStr] = None, **kwargs) -> None: # noqa: E501 """Deletes a pet # noqa: E501 @@ -217,7 +217,7 @@ def delete_pet(self, pet_id : Annotated[StrictInt, Field(..., description="Pet i raise ValueError("Error! Please call the delete_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.delete_pet_with_http_info(pet_id, api_key, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def delete_pet_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="Pet id to delete")], api_key : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 """Deletes a pet # noqa: E501 @@ -327,7 +327,7 @@ def delete_pet_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., des collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def find_pets_by_status(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs) -> List[Pet]: # noqa: E501 """Finds Pets by status # noqa: E501 @@ -356,7 +356,7 @@ def find_pets_by_status(self, status : Annotated[conlist(StrictStr), Field(..., raise ValueError("Error! Please call the find_pets_by_status_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def find_pets_by_status_with_http_info(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs) -> ApiResponse: # noqa: E501 """Finds Pets by status # noqa: E501 @@ -468,7 +468,7 @@ def find_pets_by_status_with_http_info(self, status : Annotated[conlist(StrictSt collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs) -> List[Pet]: # noqa: E501 """(Deprecated) Finds Pets by tags # noqa: E501 @@ -497,7 +497,7 @@ def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr, unique_items=Tru raise ValueError("Error! Please call the find_pets_by_tags_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def find_pets_by_tags_with_http_info(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs) -> ApiResponse: # noqa: E501 """(Deprecated) Finds Pets by tags # noqa: E501 @@ -611,7 +611,7 @@ def find_pets_by_tags_with_http_info(self, tags : Annotated[conlist(StrictStr, u collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def get_pet_by_id(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to return")], **kwargs) -> Pet: # noqa: E501 """Find pet by ID # noqa: E501 @@ -640,7 +640,7 @@ def get_pet_by_id(self, pet_id : Annotated[StrictInt, Field(..., description="ID raise ValueError("Error! Please call the get_pet_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.get_pet_by_id_with_http_info(pet_id, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def get_pet_by_id_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to return")], **kwargs) -> ApiResponse: # noqa: E501 """Find pet by ID # noqa: E501 @@ -752,7 +752,7 @@ def get_pet_by_id_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def update_pet(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> None: # noqa: E501 """Update an existing pet # noqa: E501 @@ -781,7 +781,7 @@ def update_pet(self, pet : Annotated[Pet, Field(..., description="Pet object tha raise ValueError("Error! Please call the update_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.update_pet_with_http_info(pet, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def update_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description="Pet object that needs to be added to the store")], **kwargs) -> ApiResponse: # noqa: E501 """Update an existing pet # noqa: E501 @@ -892,7 +892,7 @@ def update_pet_with_http_info(self, pet : Annotated[Pet, Field(..., description= collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def update_pet_with_form(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet that needs to be updated")], name : Annotated[Optional[StrictStr], Field(description="Updated name of the pet")] = None, status : Annotated[Optional[StrictStr], Field(description="Updated status of the pet")] = None, **kwargs) -> None: # noqa: E501 """Updates a pet in the store with form data # noqa: E501 @@ -925,7 +925,7 @@ def update_pet_with_form(self, pet_id : Annotated[StrictInt, Field(..., descript raise ValueError("Error! Please call the update_pet_with_form_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.update_pet_with_form_with_http_info(pet_id, name, status, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def update_pet_with_form_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet that needs to be updated")], name : Annotated[Optional[StrictStr], Field(description="Updated name of the pet")] = None, status : Annotated[Optional[StrictStr], Field(description="Updated status of the pet")] = None, **kwargs) -> ApiResponse: # noqa: E501 """Updates a pet in the store with form data # noqa: E501 @@ -1048,7 +1048,7 @@ def update_pet_with_form_with_http_info(self, pet_id : Annotated[StrictInt, Fiel collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, **kwargs) -> ApiResponse: # noqa: E501 """uploads an image # noqa: E501 @@ -1081,7 +1081,7 @@ def upload_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID o raise ValueError("Error! Please call the upload_file_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.upload_file_with_http_info(pet_id, additional_metadata, file, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def upload_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, file : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="file to upload")] = None, **kwargs) -> ApiResponse: # noqa: E501 """uploads an image # noqa: E501 @@ -1210,7 +1210,7 @@ def upload_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., de collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def upload_file_with_required_file(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[Union[StrictBytes, StrictStr], Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, **kwargs) -> ApiResponse: # noqa: E501 """uploads an image (required) # noqa: E501 @@ -1243,7 +1243,7 @@ def upload_file_with_required_file(self, pet_id : Annotated[StrictInt, Field(... raise ValueError("Error! Please call the upload_file_with_required_file_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.upload_file_with_required_file_with_http_info(pet_id, required_file, additional_metadata, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def upload_file_with_required_file_with_http_info(self, pet_id : Annotated[StrictInt, Field(..., description="ID of pet to update")], required_file : Annotated[Union[StrictBytes, StrictStr], Field(..., description="file to upload")], additional_metadata : Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] = None, **kwargs) -> ApiResponse: # noqa: E501 """uploads an image (required) # noqa: E501 diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py index 11e41480d1b6..50ce9015c53d 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,7 +16,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from pydantic import Field, StrictStr, conint @@ -45,7 +45,7 @@ def __init__(self, api_client=None): api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def delete_order(self, order_id : Annotated[StrictStr, Field(..., description="ID of the order that needs to be deleted")], **kwargs) -> None: # noqa: E501 """Delete purchase order by ID # noqa: E501 @@ -74,7 +74,7 @@ def delete_order(self, order_id : Annotated[StrictStr, Field(..., description="I raise ValueError("Error! Please call the delete_order_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.delete_order_with_http_info(order_id, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def delete_order_with_http_info(self, order_id : Annotated[StrictStr, Field(..., description="ID of the order that needs to be deleted")], **kwargs) -> ApiResponse: # noqa: E501 """Delete purchase order by ID # noqa: E501 @@ -178,7 +178,7 @@ def delete_order_with_http_info(self, order_id : Annotated[StrictStr, Field(..., collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def get_inventory(self, **kwargs) -> Dict[str, int]: # noqa: E501 """Returns pet inventories by status # noqa: E501 @@ -205,7 +205,7 @@ def get_inventory(self, **kwargs) -> Dict[str, int]: # noqa: E501 raise ValueError("Error! Please call the get_inventory_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.get_inventory_with_http_info(**kwargs) # noqa: E501 - @validate_arguments + @validate_call def get_inventory_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 """Returns pet inventories by status # noqa: E501 @@ -309,7 +309,7 @@ def get_inventory_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def get_order_by_id(self, order_id : Annotated[conint(strict=True, le=5, ge=1), Field(..., description="ID of pet that needs to be fetched")], **kwargs) -> Order: # noqa: E501 """Find purchase order by ID # noqa: E501 @@ -338,7 +338,7 @@ def get_order_by_id(self, order_id : Annotated[conint(strict=True, le=5, ge=1), raise ValueError("Error! Please call the get_order_by_id_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.get_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def get_order_by_id_with_http_info(self, order_id : Annotated[conint(strict=True, le=5, ge=1), Field(..., description="ID of pet that needs to be fetched")], **kwargs) -> ApiResponse: # noqa: E501 """Find purchase order by ID # noqa: E501 @@ -450,7 +450,7 @@ def get_order_by_id_with_http_info(self, order_id : Annotated[conint(strict=True collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def place_order(self, order : Annotated[Order, Field(..., description="order placed for purchasing the pet")], **kwargs) -> Order: # noqa: E501 """Place an order for a pet # noqa: E501 @@ -479,7 +479,7 @@ def place_order(self, order : Annotated[Order, Field(..., description="order pla raise ValueError("Error! Please call the place_order_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.place_order_with_http_info(order, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def place_order_with_http_info(self, order : Annotated[Order, Field(..., description="order placed for purchasing the pet")], **kwargs) -> ApiResponse: # noqa: E501 """Place an order for a pet # noqa: E501 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 8761c5e5b35c..bb6a051190f3 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,7 +16,7 @@ import io import warnings -from pydantic import validate_arguments, ValidationError +from pydantic import validate_call, ValidationError from typing_extensions import Annotated from pydantic import Field, StrictStr, conlist @@ -43,7 +43,7 @@ def __init__(self, api_client=None): api_client = ApiClient.get_default() self.api_client = api_client - @validate_arguments + @validate_call def create_user(self, user : Annotated[User, Field(..., description="Created user object")], **kwargs) -> None: # noqa: E501 """Create user # noqa: E501 @@ -72,7 +72,7 @@ def create_user(self, user : Annotated[User, Field(..., description="Created use raise ValueError("Error! Please call the create_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.create_user_with_http_info(user, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def create_user_with_http_info(self, user : Annotated[User, Field(..., description="Created user object")], **kwargs) -> ApiResponse: # noqa: E501 """Create user # noqa: E501 @@ -198,7 +198,7 @@ def create_user_with_http_info(self, user : Annotated[User, Field(..., descripti collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def create_users_with_array_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501 """Creates list of users with given input array # noqa: E501 @@ -227,7 +227,7 @@ def create_users_with_array_input(self, user : Annotated[conlist(User), Field(.. raise ValueError("Error! Please call the create_users_with_array_input_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.create_users_with_array_input_with_http_info(user, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def create_users_with_array_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> ApiResponse: # noqa: E501 """Creates list of users with given input array # noqa: E501 @@ -338,7 +338,7 @@ def create_users_with_array_input_with_http_info(self, user : Annotated[conlist( collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def create_users_with_list_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501 """Creates list of users with given input array # noqa: E501 @@ -367,7 +367,7 @@ def create_users_with_list_input(self, user : Annotated[conlist(User), Field(... raise ValueError("Error! Please call the create_users_with_list_input_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.create_users_with_list_input_with_http_info(user, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def create_users_with_list_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> ApiResponse: # noqa: E501 """Creates list of users with given input array # noqa: E501 @@ -478,7 +478,7 @@ def create_users_with_list_input_with_http_info(self, user : Annotated[conlist(U collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def delete_user(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be deleted")], **kwargs) -> None: # noqa: E501 """Delete user # noqa: E501 @@ -507,7 +507,7 @@ def delete_user(self, username : Annotated[StrictStr, Field(..., description="Th raise ValueError("Error! Please call the delete_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.delete_user_with_http_info(username, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def delete_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be deleted")], **kwargs) -> ApiResponse: # noqa: E501 """Delete user # noqa: E501 @@ -611,7 +611,7 @@ def delete_user_with_http_info(self, username : Annotated[StrictStr, Field(..., collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def get_user_by_name(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be fetched. Use user1 for testing.")], **kwargs) -> User: # noqa: E501 """Get user by user name # noqa: E501 @@ -640,7 +640,7 @@ def get_user_by_name(self, username : Annotated[StrictStr, Field(..., descriptio raise ValueError("Error! Please call the get_user_by_name_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.get_user_by_name_with_http_info(username, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def get_user_by_name_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The name that needs to be fetched. Use user1 for testing.")], **kwargs) -> ApiResponse: # noqa: E501 """Get user by user name # noqa: E501 @@ -752,7 +752,7 @@ def get_user_by_name_with_http_info(self, username : Annotated[StrictStr, Field( collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def login_user(self, username : Annotated[StrictStr, Field(..., description="The user name for login")], password : Annotated[StrictStr, Field(..., description="The password for login in clear text")], **kwargs) -> str: # noqa: E501 """Logs user into the system # noqa: E501 @@ -783,7 +783,7 @@ def login_user(self, username : Annotated[StrictStr, Field(..., description="The raise ValueError("Error! Please call the login_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.login_user_with_http_info(username, password, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def login_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="The user name for login")], password : Annotated[StrictStr, Field(..., description="The password for login in clear text")], **kwargs) -> ApiResponse: # noqa: E501 """Logs user into the system # noqa: E501 @@ -900,7 +900,7 @@ def login_user_with_http_info(self, username : Annotated[StrictStr, Field(..., d collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def logout_user(self, **kwargs) -> None: # noqa: E501 """Logs out current logged in user session # noqa: E501 @@ -927,7 +927,7 @@ def logout_user(self, **kwargs) -> None: # noqa: E501 raise ValueError("Error! Please call the logout_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.logout_user_with_http_info(**kwargs) # noqa: E501 - @validate_arguments + @validate_call def logout_user_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 """Logs out current logged in user session # noqa: E501 @@ -1025,7 +1025,7 @@ def logout_user_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 collection_formats=_collection_formats, _request_auth=_params.get('_request_auth')) - @validate_arguments + @validate_call def update_user(self, username : Annotated[StrictStr, Field(..., description="name that need to be deleted")], user : Annotated[User, Field(..., description="Updated user object")], **kwargs) -> None: # noqa: E501 """Updated user # noqa: E501 @@ -1056,7 +1056,7 @@ def update_user(self, username : Annotated[StrictStr, Field(..., description="na raise ValueError("Error! Please call the update_user_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data") return self.update_user_with_http_info(username, user, **kwargs) # noqa: E501 - @validate_arguments + @validate_call def update_user_with_http_info(self, username : Annotated[StrictStr, Field(..., description="name that need to be deleted")], user : Annotated[User, Field(..., description="Updated user object")], **kwargs) -> ApiResponse: # noqa: E501 """Updated user # noqa: E501 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 a0f5848057e7..22dda9cd1174 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 @@ -29,10 +29,11 @@ class AdditionalPropertiesAnyType(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["name"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 06c924e21f91..77a275f8dd31 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 @@ -30,10 +30,11 @@ class AdditionalPropertiesClass(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["map_property", "map_of_map_property"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 022aa9c286a1..7254315fc50e 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 @@ -29,10 +29,11 @@ class AdditionalPropertiesObject(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["name"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 ab7281d0dc4d..59219a93c349 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 @@ -29,10 +29,11 @@ class AdditionalPropertiesWithDescriptionOnly(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["name"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 f0fba0386424..34eada9a625f 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 @@ -31,10 +31,11 @@ class AllOfWithSingleRef(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["username", "SingleRefType"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 08c51a32b431..678dfe222968 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/animal.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/animal.py @@ -30,10 +30,11 @@ class Animal(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["className", "color"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } # JSON field name that stores the object type __discriminator_property_name = 'className' 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 61defc0e9eb8..9342f49264cf 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 @@ -42,8 +42,9 @@ class AnyOfColor(BaseModel): actual_instance: Any any_of_schemas: List[str] = Field(ANYOFCOLOR_ANY_OF_SCHEMAS, const=True) - class Config: - validate_assignment = True + model_config = { + "validate_assignment": True, + } def __init__(self, *args, **kwargs): if args: 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 c2f26f1e873b..73731baed652 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 @@ -42,8 +42,9 @@ class AnyOfPig(BaseModel): actual_instance: Any any_of_schemas: List[str] = Field(ANYOFPIG_ANY_OF_SCHEMAS, const=True) - class Config: - validate_assignment = True + model_config = { + "validate_assignment": True, + } def __init__(self, *args, **kwargs): if args: 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 6224b7b9564d..3c176c73e294 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 @@ -31,10 +31,11 @@ class ApiResponse(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["code", "type", "message"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 0f444a85a296..1b6c9a6e1338 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 @@ -30,10 +30,11 @@ class ArrayOfArrayOfModel(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["another_property"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 45ffc93e2bbd..8e908b531f5c 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 @@ -29,10 +29,11 @@ class ArrayOfArrayOfNumberOnly(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["ArrayArrayNumber"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 ff06726b621f..cf4fa2f1039e 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 @@ -29,10 +29,11 @@ class ArrayOfNumberOnly(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["ArrayNumber"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 5e266148eb4f..e576527c23f9 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 @@ -32,10 +32,11 @@ class ArrayTest(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["array_of_string", "array_array_of_integer", "array_array_of_model"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 c9f6603166fb..4738611803df 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 @@ -30,10 +30,11 @@ class BasquePig(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["className", "color"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 3685da0822c0..0b5393374277 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/capitalization.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/capitalization.py @@ -34,10 +34,11 @@ class Capitalization(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 b5dd4c4b08da..01bf3dea821b 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/cat.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/cat.py @@ -30,10 +30,11 @@ class Cat(Animal): additional_properties: Dict[str, Any] = {} __properties = ["className", "color", "declawed"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 068827c38788..a8f297a19c64 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/category.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/category.py @@ -30,10 +30,11 @@ class Category(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["id", "name"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 68a202082b28..9a3c62cfbe72 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 @@ -30,10 +30,11 @@ class CircularReferenceModel(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["size", "nested"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 a93f1f738265..e1916aec036e 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 @@ -29,10 +29,11 @@ class ClassModel(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["_class"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 b527c6e6aeed..dfc21947aa42 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/client.py @@ -29,10 +29,11 @@ class Client(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["client"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 eda8b56415eb..914d20e0e5b7 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/color.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/color.py @@ -23,8 +23,6 @@ from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field -COLOR_ONE_OF_SCHEMAS = ["List[int]", "str"] - class Color(BaseModel): """ RGB array, RGBA array, or hex string. @@ -39,10 +37,11 @@ class Color(BaseModel): actual_instance: Union[List[int], str] else: actual_instance: Any - one_of_schemas: List[str] = Field(COLOR_ONE_OF_SCHEMAS, const=True) + one_of_schemas: List[str] = Literal["List[int]", "str"] - class Config: - validate_assignment = True + model_config = { + "validate_assignment": True, + } def __init__(self, *args, **kwargs): if args: 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 ade10d2236a1..89f8d3a162c8 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/creature.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/creature.py @@ -31,10 +31,11 @@ class Creature(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["info", "type"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 bdc45b05b777..1ff7145528d6 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 @@ -29,10 +29,11 @@ class CreatureInfo(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["name"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 206f58550469..4fec4f6fb8a2 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 @@ -30,10 +30,11 @@ class DanishPig(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["className", "size"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 4e9dc9ddf75e..ea1d52b15ccd 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 @@ -29,10 +29,11 @@ class DeprecatedObject(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["name"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 6317e1fe32a0..28bab5868275 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/dog.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/dog.py @@ -30,10 +30,11 @@ class Dog(Animal): additional_properties: Dict[str, Any] = {} __properties = ["className", "color", "breed"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 951906fd28e5..6085e77308fa 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 @@ -30,10 +30,11 @@ class DummyModel(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["category", "self_ref"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 f804f117c9b3..cae2015f7777 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 @@ -51,10 +51,11 @@ def array_enum_validate_enum(cls, value): raise ValueError("each list item must be one of ('fish', 'crab')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 8a06dc2f0cf3..a0226d95eed3 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 @@ -88,10 +88,11 @@ def enum_number_validate_enum(cls, value): raise ValueError("must be one of enum values (1.1, -1.2)") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 23636f580ea7..65814f815dee 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/file.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/file.py @@ -29,10 +29,11 @@ class File(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["sourceURI"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 efbb7d95f03d..86f565ac5e5f 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 @@ -31,10 +31,11 @@ class FileSchemaTestClass(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["file", "files"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 5a44cd22c7e6..3edf4c14bfaf 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 @@ -30,10 +30,11 @@ class FirstRef(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["category", "self_ref"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 77f2ef9a359a..b607b20b493a 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/foo.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/foo.py @@ -29,10 +29,11 @@ class Foo(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["bar"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 3eb736a411e3..4814aa51bad5 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 @@ -30,10 +30,11 @@ class FooGetDefaultResponse(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["string"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 5363f6311963..a456b64abc7e 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 @@ -85,10 +85,11 @@ def pattern_with_digits_and_delimiter_validate_regular_expression(cls, value): raise ValueError(r"must validate the regular expression /^image_\d{1,3}$/i") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 be7b0eb636b3..1b0116b2bbb5 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 @@ -30,10 +30,11 @@ class HasOnlyReadOnly(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["bar", "foo"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 5e4907ea3996..b2c7285267fd 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 @@ -29,10 +29,11 @@ class HealthCheckResult(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["NullableMessage"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 f3a50b0851b9..053eb4c2a5da 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 @@ -29,10 +29,11 @@ class InnerDictWithProperty(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["aProperty"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 ef8444eec0dd..2e60227494b0 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,8 +23,6 @@ from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field -INTORSTRING_ONE_OF_SCHEMAS = ["int", "str"] - class IntOrString(BaseModel): """ IntOrString @@ -37,10 +35,11 @@ class IntOrString(BaseModel): actual_instance: Union[int, str] else: actual_instance: Any - one_of_schemas: List[str] = Field(INTORSTRING_ONE_OF_SCHEMAS, const=True) + one_of_schemas: List[str] = Literal["int", "str"] - class Config: - validate_assignment = True + model_config = { + "validate_assignment": True, + } def __init__(self, *args, **kwargs): if args: diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/list.py b/samples/openapi3/client/petstore/python/petstore_api/models/list.py index d4381879ccb3..4ca9ce45ae57 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/list.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/list.py @@ -29,10 +29,11 @@ class List(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["123-list"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 0f0bf902f308..cdcbc232f988 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 @@ -30,10 +30,11 @@ class MapOfArrayOfModel(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["shopIdToOrgOnlineLipMap"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 4270158fd4d0..c2d729e9c9fd 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 @@ -42,10 +42,11 @@ def map_of_enum_string_validate_enum(cls, value): raise ValueError("must be one of enum values ('UPPER', 'lower')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 9345c5b2ab6b..257f9a737395 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 @@ -32,10 +32,11 @@ class MixedPropertiesAndAdditionalPropertiesClass(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["uuid", "dateTime", "map"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 689cbe20ff7c..36c02cc3ab5b 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 @@ -30,10 +30,11 @@ class Model200Response(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["name", "class"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 c825c9c206fd..606c70acb6f8 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 @@ -29,10 +29,11 @@ class ModelReturn(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["return"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 81553c5d5da7..b72b6bf5a85a 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/name.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/name.py @@ -32,10 +32,11 @@ class Name(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["name", "snake_case", "property", "123Number"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 578579888444..52f9ad12be36 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 @@ -41,10 +41,11 @@ class NullableClass(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["required_integer_prop", "integer_prop", "number_prop", "boolean_prop", "string_prop", "date_prop", "datetime_prop", "array_nullable_prop", "array_and_items_nullable_prop", "array_items_nullable", "object_nullable_prop", "object_and_items_nullable_prop", "object_items_nullable"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 059cbdc577cb..3cbde9fd5406 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 @@ -40,10 +40,11 @@ def name_validate_regular_expression(cls, value): raise ValueError(r"must validate the regular expression /^[A-Z].*/") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 78a00af5654b..9d9f9ed9df08 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 @@ -29,10 +29,11 @@ class NumberOnly(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["JustNumber"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 fe2d99527fa3..bde587fc719f 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 @@ -29,10 +29,11 @@ class ObjectToTestAdditionalProperties(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["property"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 fda4435b8be3..c2236b329861 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 @@ -33,10 +33,11 @@ class ObjectWithDeprecatedFields(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["uuid", "id", "deprecatedRef", "bars"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 282b555ca937..81763613deb3 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 @@ -25,8 +25,6 @@ from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field -ONEOFENUMSTRING_ONE_OF_SCHEMAS = ["EnumString1", "EnumString2"] - class OneOfEnumString(BaseModel): """ oneOf enum strings @@ -39,10 +37,11 @@ class OneOfEnumString(BaseModel): actual_instance: Union[EnumString1, EnumString2] else: actual_instance: Any - one_of_schemas: List[str] = Field(ONEOFENUMSTRING_ONE_OF_SCHEMAS, const=True) + one_of_schemas: List[str] = Literal["EnumString1", "EnumString2"] - class Config: - validate_assignment = True + model_config = { + "validate_assignment": True, + } def __init__(self, *args, **kwargs): if args: 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 691eb04bbb1f..8e6b41dfbc18 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/order.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/order.py @@ -44,10 +44,11 @@ def status_validate_enum(cls, value): raise ValueError("must be one of enum values ('placed', 'approved', 'delivered')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 b453339e1c87..478c1b53622b 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 @@ -31,10 +31,11 @@ class OuterComposite(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["my_number", "my_string", "my_boolean"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 a5723f0a9321..8d7ad9f5c6d2 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 @@ -32,10 +32,11 @@ class OuterObjectWithEnumProperty(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["str_value", "value"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 d597e8c4e444..f06c8c6f94e4 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/parent.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/parent.py @@ -30,10 +30,11 @@ class Parent(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["optionalDict"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 fa23256f5c60..229a0b5f6e23 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 @@ -30,10 +30,11 @@ class ParentWithOptionalDict(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["optionalDict"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 25743a7ef09a..e5ecd4d45cf7 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/pet.py @@ -46,10 +46,11 @@ def status_validate_enum(cls, value): raise ValueError("must be one of enum values ('available', 'pending', 'sold')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 1f84dd6c2714..32b739b507e7 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/pig.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/pig.py @@ -25,8 +25,6 @@ from typing import Union, Any, List, TYPE_CHECKING from pydantic import StrictStr, Field -PIG_ONE_OF_SCHEMAS = ["BasquePig", "DanishPig"] - class Pig(BaseModel): """ Pig @@ -39,10 +37,11 @@ class Pig(BaseModel): actual_instance: Union[BasquePig, DanishPig] else: actual_instance: Any - one_of_schemas: List[str] = Field(PIG_ONE_OF_SCHEMAS, const=True) + one_of_schemas: List[str] = Literal["BasquePig", "DanishPig"] - class Config: - validate_assignment = True + model_config = { + "validate_assignment": True, + } discriminator_value_class_map = { } 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 b5314f3d63e8..0bc34c0540c2 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 @@ -31,10 +31,11 @@ class PropertyNameCollision(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["_type", "type", "type_"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 cfaf97c7091e..b158341ff4c8 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 @@ -30,10 +30,11 @@ class ReadOnlyFirst(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["bar", "baz"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 2f0c99ae1b90..f4583d5fd584 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 @@ -30,10 +30,11 @@ class SecondRef(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["category", "circular_ref"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 55512492d8e9..fb6699d8ca33 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 @@ -30,10 +30,11 @@ class SelfReferenceModel(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["size", "nested"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 1c9804d5b4ae..9d4671a535e8 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 @@ -29,10 +29,11 @@ class SpecialModelName(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["$special[property.name]"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 51d955951d4f..0c1db5f7d2ec 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 @@ -42,10 +42,11 @@ def var_schema_validate_enum(cls, value): raise ValueError("must be one of enum values ('available', 'pending', 'sold')") return value - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 299159859552..76347c44fe18 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/tag.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/tag.py @@ -30,10 +30,11 @@ class Tag(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["id", "name"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 71453dcec366..7c1c35949194 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/tiger.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/tiger.py @@ -29,10 +29,11 @@ class Tiger(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["skill"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 365c77ceb141..c4791674d1b1 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/user.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/user.py @@ -36,10 +36,11 @@ class User(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" 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 8ec40c8eda1e..3dc7c65504c6 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 @@ -33,10 +33,11 @@ class WithNestedOneOf(BaseModel): additional_properties: Dict[str, Any] = {} __properties = ["size", "nested_pig", "nested_oneof_enum_string"] - class Config: - """Pydantic configuration""" - allow_population_by_field_name = True - validate_assignment = True + """Pydantic configuration""" + model_config = { + "populate_by_name": True, + "validate_assignment": True, + } def to_str(self) -> str: """Returns the string representation of the model using alias""" diff --git a/samples/openapi3/client/petstore/python/pyproject.toml b/samples/openapi3/client/petstore/python/pyproject.toml index be791aff52ab..43dc7e2fef11 100644 --- a/samples/openapi3/client/petstore/python/pyproject.toml +++ b/samples/openapi3/client/petstore/python/pyproject.toml @@ -16,7 +16,7 @@ urllib3 = ">= 1.25.3" python-dateutil = ">=2.8.2" pem = ">= 19.3.0" pycryptodome = ">= 3.9.0" -pydantic = "^1.10.5, <2" +pydantic = ">=2" aenum = ">=3.1.11" [tool.poetry.dev-dependencies] diff --git a/samples/openapi3/client/petstore/python/requirements.txt b/samples/openapi3/client/petstore/python/requirements.txt index 258c179c10b2..358a78535383 100755 --- a/samples/openapi3/client/petstore/python/requirements.txt +++ b/samples/openapi3/client/petstore/python/requirements.txt @@ -1,5 +1,5 @@ python_dateutil >= 2.5.3 setuptools >= 21.0.0 urllib3 >= 1.25.3, < 2.1.0 -pydantic >= 1.10.5, < 2 +pydantic >= 2 aenum >= 3.1.11 diff --git a/samples/openapi3/client/petstore/python/setup.py b/samples/openapi3/client/petstore/python/setup.py index 283e0441c000..2b1403fa17f7 100755 --- a/samples/openapi3/client/petstore/python/setup.py +++ b/samples/openapi3/client/petstore/python/setup.py @@ -28,7 +28,7 @@ "python-dateutil", "pem>=19.3.0", "pycryptodome>=3.9.0", - "pydantic >= 1.10.5, < 2", + "pydantic >= 2", "aenum" ] diff --git a/samples/server/petstore/python-fastapi/requirements.txt b/samples/server/petstore/python-fastapi/requirements.txt index e5a1b375c4c3..6e52599f1f75 100644 --- a/samples/server/petstore/python-fastapi/requirements.txt +++ b/samples/server/petstore/python-fastapi/requirements.txt @@ -7,7 +7,7 @@ chardet==4.0.0 click==7.1.2 dnspython==2.1.0 email-validator==1.1.2 -fastapi==0.95.2 +fastapi==0.103.0 graphene==2.1.8 graphql-core==2.3.2 graphql-relay==2.0.1 @@ -20,7 +20,7 @@ Jinja2==2.11.3 MarkupSafe==2.0.1 orjson==3.5.2 promise==2.3 -pydantic==1.8.2 +pydantic==2.3.0 python-dotenv==0.17.1 python-multipart==0.0.5 PyYAML==5.4.1