[PYTHON] generate code based on pydantic v2 (#16685)

* [python] replace validator with field_validator

* [python] replace parse_obj with model_validate

* [python] replace dict with model_dump

* [python] replace construct with model_construct

* [python] replace __fields_set__ with model_fields_set

* [python] replace __fields_set__ in the test cases with model_fields_set

* [python] replace validate_arguments with validate_call

* [python] replace max_items, min_items with max_length, min_length

* [python] replace Config class with model_config

* [python] replace allow_population_by_field_name with populate_by_name

* [python] remove {{{classname}}}_ONE_OF_SCHEMAS

* [python] update test cases

* [python] update samples

* [python] fix typos in test cases
This commit is contained in:
ふぁ
2023-09-29 17:45:46 +09:00
committed by GitHub
parent 67b129fda9
commit e2f249ba35
177 changed files with 1774 additions and 1611 deletions

View File

@@ -16,7 +16,7 @@ import re # noqa: F401
import io
import warnings
from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from pydantic import Field
from typing_extensions import Annotated
@@ -42,7 +42,7 @@ class AnotherFakeApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_arguments
@validate_call
async def call_123_test_special_tags(self, client : Annotated[Client, Field(description="client model")], **kwargs) -> Client: # noqa: E501
"""To test special tags # noqa: E501
@@ -65,7 +65,7 @@ class AnotherFakeApi:
raise ValueError(message)
return await self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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

View File

@@ -16,7 +16,7 @@ import re # noqa: F401
import io
import warnings
from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from petstore_api.models.foo_get_default_response import FooGetDefaultResponse
@@ -40,7 +40,7 @@ class DefaultApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_arguments
@validate_call
async def foo_get(self, **kwargs) -> FooGetDefaultResponse: # noqa: E501
"""foo_get # noqa: E501
@@ -60,7 +60,7 @@ class DefaultApi:
raise ValueError(message)
return await self.foo_get_with_http_info(**kwargs) # noqa: E501
@validate_arguments
@validate_call
async def foo_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501
"""foo_get # noqa: E501

View File

@@ -16,13 +16,13 @@ import re # noqa: F401
import io
import warnings
from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from pydantic import Field
from typing_extensions import Annotated
from datetime import date, datetime
from pydantic import StrictBool, StrictBytes, StrictInt, StrictStr, validator
from pydantic import StrictBool, StrictBytes, StrictInt, StrictStr, field_validator
from typing import Any, Dict, List, Optional, Union
@@ -57,7 +57,7 @@ class FakeApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_arguments
@validate_call
async def fake_any_type_request_body(self, body : Optional[Dict[str, Any]] = None, **kwargs) -> None: # noqa: E501
"""test any type request body # noqa: E501
@@ -79,7 +79,7 @@ class FakeApi:
raise ValueError(message)
return await self.fake_any_type_request_body_with_http_info(body, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -180,7 +180,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -202,7 +202,7 @@ class FakeApi:
raise ValueError(message)
return await self.fake_enum_ref_query_parameter_with_http_info(enum_ref, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -296,7 +296,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async def fake_health_get(self, **kwargs) -> HealthCheckResult: # noqa: E501
"""Health check endpoint # noqa: E501
@@ -316,7 +316,7 @@ class FakeApi:
raise ValueError(message)
return await self.fake_health_get_with_http_info(**kwargs) # noqa: E501
@validate_arguments
@validate_call
async def fake_health_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501
"""Health check endpoint # noqa: E501
@@ -410,7 +410,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -436,7 +436,7 @@ class FakeApi:
raise ValueError(message)
return await self.fake_http_signature_test_with_http_info(pet, query_1, header_1, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -549,7 +549,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -572,7 +572,7 @@ class FakeApi:
raise ValueError(message)
return await self.fake_outer_boolean_serialize_with_http_info(body, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -680,7 +680,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -703,7 +703,7 @@ class FakeApi:
raise ValueError(message)
return await self.fake_outer_composite_serialize_with_http_info(outer_composite, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -811,7 +811,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async def fake_outer_number_serialize(self, body : Annotated[Optional[float], Field(description="Input number as post body")] = None, **kwargs) -> float: # noqa: E501
"""fake_outer_number_serialize # noqa: E501
@@ -834,7 +834,7 @@ class FakeApi:
raise ValueError(message)
return await self.fake_outer_number_serialize_with_http_info(body, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -942,7 +942,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -965,7 +965,7 @@ class FakeApi:
raise ValueError(message)
return await self.fake_outer_string_serialize_with_http_info(body, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -1073,7 +1073,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -1096,7 +1096,7 @@ class FakeApi:
raise ValueError(message)
return await self.fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_property, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -1204,7 +1204,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async def fake_return_list_of_objects(self, **kwargs) -> List[List[Tag]]: # noqa: E501
"""test returning list of objects # noqa: E501
@@ -1224,7 +1224,7 @@ class FakeApi:
raise ValueError(message)
return await self.fake_return_list_of_objects_with_http_info(**kwargs) # noqa: E501
@validate_arguments
@validate_call
async def fake_return_list_of_objects_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501
"""test returning list of objects # noqa: E501
@@ -1318,7 +1318,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async def fake_uuid_example(self, uuid_example : Annotated[StrictStr, Field(description="uuid example")], **kwargs) -> None: # noqa: E501
"""test uuid example # noqa: E501
@@ -1340,7 +1340,7 @@ class FakeApi:
raise ValueError(message)
return await self.fake_uuid_example_with_http_info(uuid_example, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -1434,7 +1434,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -1457,7 +1457,7 @@ class FakeApi:
raise ValueError(message)
return await self.test_body_with_binary_with_http_info(body, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -1564,7 +1564,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async def test_body_with_file_schema(self, file_schema_test_class : FileSchemaTestClass, **kwargs) -> None: # noqa: E501
"""test_body_with_file_schema # noqa: E501
@@ -1587,7 +1587,7 @@ class FakeApi:
raise ValueError(message)
return await self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -1689,7 +1689,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async def test_body_with_query_params(self, query : StrictStr, user : User, **kwargs) -> None: # noqa: E501
"""test_body_with_query_params # noqa: E501
@@ -1713,7 +1713,7 @@ class FakeApi:
raise ValueError(message)
return await self.test_body_with_query_params_with_http_info(query, user, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -1820,7 +1820,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async def test_client_model(self, client : Annotated[Client, Field(description="client model")], **kwargs) -> Client: # noqa: E501
"""To test \"client\" model # noqa: E501
@@ -1843,7 +1843,7 @@ class FakeApi:
raise ValueError(message)
return await self.test_client_model_with_http_info(client, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -1951,7 +1951,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -1975,7 +1975,7 @@ class FakeApi:
raise ValueError(message)
return await self.test_date_time_query_parameter_with_http_info(date_time_query, str_query, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -2078,7 +2078,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async def test_endpoint_parameters(self, number : Annotated[float, Field(le=543.2, ge=32.1, description="None")], double : Annotated[float, Field(le=123.4, ge=67.8, description="None")], pattern_without_delimiter : Annotated[str, Field(strict=True, description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(description="None")], integer : Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=10)]], Field(description="None")] = None, int32 : Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=20)]], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[Annotated[float, Field(le=987.6)]], Field(description="None")] = None, string : Annotated[Optional[Annotated[str, Field(strict=True)]], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[Annotated[bytes, Field(strict=True, max_length=64)], Annotated[str, Field(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[Annotated[str, Field(min_length=10, strict=True, max_length=64)]], 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
@@ -2129,7 +2129,7 @@ class FakeApi:
raise ValueError(message)
return await 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
async def test_endpoint_parameters_with_http_info(self, number : Annotated[float, Field(le=543.2, ge=32.1, description="None")], double : Annotated[float, Field(le=123.4, ge=67.8, description="None")], pattern_without_delimiter : Annotated[str, Field(strict=True, description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(description="None")], integer : Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=10)]], Field(description="None")] = None, int32 : Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=20)]], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[Annotated[float, Field(le=987.6)]], Field(description="None")] = None, string : Annotated[Optional[Annotated[str, Field(strict=True)]], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[Annotated[bytes, Field(strict=True, max_length=64)], Annotated[str, Field(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[Annotated[str, Field(min_length=10, strict=True, max_length=64)]], 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
@@ -2315,7 +2315,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -2348,7 +2348,7 @@ class FakeApi:
raise ValueError(message)
return await 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
async 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
@@ -2473,7 +2473,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -2496,7 +2496,7 @@ class FakeApi:
raise ValueError(message)
return await self.test_inline_additional_properties_with_http_info(request_body, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -2598,7 +2598,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async def test_inline_freeform_additional_properties(self, test_inline_freeform_additional_properties_request : Annotated[TestInlineFreeformAdditionalPropertiesRequest, Field(description="request body")], **kwargs) -> None: # noqa: E501
"""test inline free-form additionalProperties # noqa: E501
@@ -2621,7 +2621,7 @@ class FakeApi:
raise ValueError(message)
return await self.test_inline_freeform_additional_properties_with_http_info(test_inline_freeform_additional_properties_request, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async def test_inline_freeform_additional_properties_with_http_info(self, test_inline_freeform_additional_properties_request : Annotated[TestInlineFreeformAdditionalPropertiesRequest, Field(description="request body")], **kwargs) -> ApiResponse: # noqa: E501
"""test inline free-form additionalProperties # noqa: E501
@@ -2723,7 +2723,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -2748,7 +2748,7 @@ class FakeApi:
raise ValueError(message)
return await self.test_json_form_data_with_http_info(param, param2, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -2856,7 +2856,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async def test_query_parameter_collection_format(self, pipe : List[StrictStr], ioutil : List[StrictStr], http : List[StrictStr], url : List[StrictStr], context : List[StrictStr], allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> None: # noqa: E501
"""test_query_parameter_collection_format # noqa: E501
@@ -2891,7 +2891,7 @@ class FakeApi:
raise ValueError(message)
return await self.test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, url, context, allow_empty, language, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async def test_query_parameter_collection_format_with_http_info(self, pipe : List[StrictStr], ioutil : List[StrictStr], http : List[StrictStr], url : List[StrictStr], context : List[StrictStr], allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> ApiResponse: # noqa: E501
"""test_query_parameter_collection_format # noqa: E501

View File

@@ -16,7 +16,7 @@ import re # noqa: F401
import io
import warnings
from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from pydantic import Field
from typing_extensions import Annotated
@@ -42,7 +42,7 @@ class FakeClassnameTags123Api:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_arguments
@validate_call
async def test_classname(self, client : Annotated[Client, Field(description="client model")], **kwargs) -> Client: # noqa: E501
"""To test class name in snake case # noqa: E501
@@ -65,7 +65,7 @@ class FakeClassnameTags123Api:
raise ValueError(message)
return await self.test_classname_with_http_info(client, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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

View File

@@ -16,11 +16,11 @@ import re # noqa: F401
import io
import warnings
from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from pydantic import Field
from typing_extensions import Annotated
from pydantic import StrictBytes, StrictInt, StrictStr, validator
from pydantic import StrictBytes, StrictInt, StrictStr, field_validator
from typing import List, Optional, Union
@@ -47,7 +47,7 @@ class PetApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_arguments
@validate_call
async 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
@@ -70,7 +70,7 @@ class PetApi:
raise ValueError(message)
return await self.add_pet_with_http_info(pet, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -172,7 +172,7 @@ class PetApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -197,7 +197,7 @@ class PetApi:
raise ValueError(message)
return await self.delete_pet_with_http_info(pet_id, api_key, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -298,7 +298,7 @@ class PetApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async def find_pets_by_status(self, status : Annotated[List[StrictStr], Field(description="Status values that need to be considered for filter")], **kwargs) -> List[Pet]: # noqa: E501
"""Finds Pets by status # noqa: E501
@@ -321,7 +321,7 @@ class PetApi:
raise ValueError(message)
return await self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async def find_pets_by_status_with_http_info(self, status : Annotated[List[StrictStr], Field(description="Status values that need to be considered for filter")], **kwargs) -> ApiResponse: # noqa: E501
"""Finds Pets by status # noqa: E501
@@ -424,7 +424,7 @@ class PetApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async def find_pets_by_tags(self, tags : Annotated[List[StrictStr], Field(description="Tags to filter by")], **kwargs) -> List[Pet]: # noqa: E501
"""(Deprecated) Finds Pets by tags # noqa: E501
@@ -447,7 +447,7 @@ class PetApi:
raise ValueError(message)
return await self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async def find_pets_by_tags_with_http_info(self, tags : Annotated[List[StrictStr], Field(description="Tags to filter by")], **kwargs) -> ApiResponse: # noqa: E501
"""(Deprecated) Finds Pets by tags # noqa: E501
@@ -552,7 +552,7 @@ class PetApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -575,7 +575,7 @@ class PetApi:
raise ValueError(message)
return await self.get_pet_by_id_with_http_info(pet_id, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -678,7 +678,7 @@ class PetApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -701,7 +701,7 @@ class PetApi:
raise ValueError(message)
return await self.update_pet_with_http_info(pet, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -803,7 +803,7 @@ class PetApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -830,7 +830,7 @@ class PetApi:
raise ValueError(message)
return await self.update_pet_with_form_with_http_info(pet_id, name, status, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -944,7 +944,7 @@ class PetApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -971,7 +971,7 @@ class PetApi:
raise ValueError(message)
return await self.upload_file_with_http_info(pet_id, additional_metadata, file, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -1091,7 +1091,7 @@ class PetApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -1118,7 +1118,7 @@ class PetApi:
raise ValueError(message)
return await self.upload_file_with_required_file_with_http_info(pet_id, required_file, additional_metadata, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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

View File

@@ -16,7 +16,7 @@ import re # noqa: F401
import io
import warnings
from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from pydantic import Field
from typing_extensions import Annotated
@@ -46,7 +46,7 @@ class StoreApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_arguments
@validate_call
async 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
@@ -69,7 +69,7 @@ class StoreApi:
raise ValueError(message)
return await self.delete_order_with_http_info(order_id, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -164,7 +164,7 @@ class StoreApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async def get_inventory(self, **kwargs) -> Dict[str, int]: # noqa: E501
"""Returns pet inventories by status # noqa: E501
@@ -185,7 +185,7 @@ class StoreApi:
raise ValueError(message)
return await self.get_inventory_with_http_info(**kwargs) # noqa: E501
@validate_arguments
@validate_call
async def get_inventory_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501
"""Returns pet inventories by status # noqa: E501
@@ -280,7 +280,7 @@ class StoreApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async def get_order_by_id(self, order_id : Annotated[int, Field(le=5, strict=True, ge=1, description="ID of pet that needs to be fetched")], **kwargs) -> Order: # noqa: E501
"""Find purchase order by ID # noqa: E501
@@ -303,7 +303,7 @@ class StoreApi:
raise ValueError(message)
return await self.get_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async def get_order_by_id_with_http_info(self, order_id : Annotated[int, Field(le=5, strict=True, ge=1, description="ID of pet that needs to be fetched")], **kwargs) -> ApiResponse: # noqa: E501
"""Find purchase order by ID # noqa: E501
@@ -406,7 +406,7 @@ class StoreApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -429,7 +429,7 @@ class StoreApi:
raise ValueError(message)
return await self.place_order_with_http_info(order, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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

View File

@@ -16,7 +16,7 @@ import re # noqa: F401
import io
import warnings
from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from pydantic import Field
from typing_extensions import Annotated
@@ -46,7 +46,7 @@ class UserApi:
api_client = ApiClient.get_default()
self.api_client = api_client
@validate_arguments
@validate_call
async def create_user(self, user : Annotated[User, Field(description="Created user object")], **kwargs) -> None: # noqa: E501
"""Create user # noqa: E501
@@ -69,7 +69,7 @@ class UserApi:
raise ValueError(message)
return await self.create_user_with_http_info(user, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async def create_user_with_http_info(self, user : Annotated[User, Field(description="Created user object")], **kwargs) -> ApiResponse: # noqa: E501
"""Create user # noqa: E501
@@ -186,7 +186,7 @@ class UserApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async def create_users_with_array_input(self, user : Annotated[List[User], Field(description="List of user object")], **kwargs) -> None: # noqa: E501
"""Creates list of users with given input array # noqa: E501
@@ -209,7 +209,7 @@ class UserApi:
raise ValueError(message)
return await self.create_users_with_array_input_with_http_info(user, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async def create_users_with_array_input_with_http_info(self, user : Annotated[List[User], Field(description="List of user object")], **kwargs) -> ApiResponse: # noqa: E501
"""Creates list of users with given input array # noqa: E501
@@ -311,7 +311,7 @@ class UserApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async def create_users_with_list_input(self, user : Annotated[List[User], Field(description="List of user object")], **kwargs) -> None: # noqa: E501
"""Creates list of users with given input array # noqa: E501
@@ -334,7 +334,7 @@ class UserApi:
raise ValueError(message)
return await self.create_users_with_list_input_with_http_info(user, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async def create_users_with_list_input_with_http_info(self, user : Annotated[List[User], Field(description="List of user object")], **kwargs) -> ApiResponse: # noqa: E501
"""Creates list of users with given input array # noqa: E501
@@ -436,7 +436,7 @@ class UserApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async def delete_user(self, username : Annotated[StrictStr, Field(description="The name that needs to be deleted")], **kwargs) -> None: # noqa: E501
"""Delete user # noqa: E501
@@ -459,7 +459,7 @@ class UserApi:
raise ValueError(message)
return await self.delete_user_with_http_info(username, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -554,7 +554,7 @@ class UserApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -577,7 +577,7 @@ class UserApi:
raise ValueError(message)
return await self.get_user_by_name_with_http_info(username, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -680,7 +680,7 @@ class UserApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -705,7 +705,7 @@ class UserApi:
raise ValueError(message)
return await self.login_user_with_http_info(username, password, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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
@@ -813,7 +813,7 @@ class UserApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async def logout_user(self, **kwargs) -> None: # noqa: E501
"""Logs out current logged in user session # noqa: E501
@@ -834,7 +834,7 @@ class UserApi:
raise ValueError(message)
return await self.logout_user_with_http_info(**kwargs) # noqa: E501
@validate_arguments
@validate_call
async def logout_user_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501
"""Logs out current logged in user session # noqa: E501
@@ -923,7 +923,7 @@ class UserApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
async 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
@@ -948,7 +948,7 @@ class UserApi:
raise ValueError(message)
return await self.update_user_with_http_info(username, user, **kwargs) # noqa: E501
@validate_arguments
@validate_call
async 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

View File

@@ -29,14 +29,15 @@ class AdditionalPropertiesAnyType(BaseModel):
additional_properties: Dict[str, Any] = {}
__properties = ["name"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class AdditionalPropertiesAnyType(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
@@ -69,9 +70,9 @@ class AdditionalPropertiesAnyType(BaseModel):
return None
if not isinstance(obj, dict):
return AdditionalPropertiesAnyType.parse_obj(obj)
return AdditionalPropertiesAnyType.model_validate(obj)
_obj = AdditionalPropertiesAnyType.parse_obj({
_obj = AdditionalPropertiesAnyType.model_validate({
"name": obj.get("name")
})
# store additional fields in additional_properties

View File

@@ -29,14 +29,15 @@ 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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class AdditionalPropertiesClass(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -63,9 +64,9 @@ class AdditionalPropertiesClass(BaseModel):
return None
if not isinstance(obj, dict):
return AdditionalPropertiesClass.parse_obj(obj)
return AdditionalPropertiesClass.model_validate(obj)
_obj = AdditionalPropertiesClass.parse_obj({
_obj = AdditionalPropertiesClass.model_validate({
"map_property": obj.get("map_property"),
"map_of_map_property": obj.get("map_of_map_property")
})

View File

@@ -29,14 +29,15 @@ class AdditionalPropertiesObject(BaseModel):
additional_properties: Dict[str, Any] = {}
__properties = ["name"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class AdditionalPropertiesObject(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
@@ -69,9 +70,9 @@ class AdditionalPropertiesObject(BaseModel):
return None
if not isinstance(obj, dict):
return AdditionalPropertiesObject.parse_obj(obj)
return AdditionalPropertiesObject.model_validate(obj)
_obj = AdditionalPropertiesObject.parse_obj({
_obj = AdditionalPropertiesObject.model_validate({
"name": obj.get("name")
})
# store additional fields in additional_properties

View File

@@ -29,14 +29,15 @@ class AdditionalPropertiesWithDescriptionOnly(BaseModel):
additional_properties: Dict[str, Any] = {}
__properties = ["name"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class AdditionalPropertiesWithDescriptionOnly(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
@@ -69,9 +70,9 @@ class AdditionalPropertiesWithDescriptionOnly(BaseModel):
return None
if not isinstance(obj, dict):
return AdditionalPropertiesWithDescriptionOnly.parse_obj(obj)
return AdditionalPropertiesWithDescriptionOnly.model_validate(obj)
_obj = AdditionalPropertiesWithDescriptionOnly.parse_obj({
_obj = AdditionalPropertiesWithDescriptionOnly.model_validate({
"name": obj.get("name")
})
# store additional fields in additional_properties

View File

@@ -31,14 +31,15 @@ class AllOfWithSingleRef(BaseModel):
single_ref_type: Optional[SingleRefType] = Field(default=None, alias="SingleRefType")
__properties = ["username", "SingleRefType"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -52,7 +53,7 @@ class AllOfWithSingleRef(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -65,9 +66,9 @@ class AllOfWithSingleRef(BaseModel):
return None
if not isinstance(obj, dict):
return AllOfWithSingleRef.parse_obj(obj)
return AllOfWithSingleRef.model_validate(obj)
_obj = AllOfWithSingleRef.parse_obj({
_obj = AllOfWithSingleRef.model_validate({
"username": obj.get("username"),
"SingleRefType": obj.get("SingleRefType")
})

View File

@@ -30,10 +30,11 @@ class Animal(BaseModel):
color: Optional[StrictStr] = 'red'
__properties = ["className", "color"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
# JSON field name that stores the object type
__discriminator_property_name = 'className'
@@ -55,7 +56,7 @@ class Animal(BaseModel):
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -69,7 +70,7 @@ class Animal(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)

View File

@@ -19,7 +19,7 @@ import pprint
import re # noqa: F401
from typing import List, Optional
from pydantic import BaseModel, Field, StrictStr, ValidationError, validator
from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from pydantic import Field
from typing_extensions import Annotated
from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict
@@ -34,9 +34,9 @@ class AnyOfColor(BaseModel):
"""
# data type: List[int]
anyof_schema_1_validator: Optional[Annotated[List[Annotated[int, Field(le=255, strict=True, ge=0)]], Field(min_items=3, max_items=3)]] = Field(default=None, description="RGB three element array with values 0-255.")
anyof_schema_1_validator: Optional[Annotated[List[Annotated[int, Field(le=255, strict=True, ge=0)]], Field(min_length=3, max_length=3)]] = Field(default=None, description="RGB three element array with values 0-255.")
# data type: List[int]
anyof_schema_2_validator: Optional[Annotated[List[Annotated[int, Field(le=255, strict=True, ge=0)]], Field(min_items=4, max_items=4)]] = Field(default=None, description="RGBA four element array with values 0-255.")
anyof_schema_2_validator: Optional[Annotated[List[Annotated[int, Field(le=255, strict=True, ge=0)]], Field(min_length=4, max_length=4)]] = Field(default=None, description="RGBA four element array with values 0-255.")
# data type: str
anyof_schema_3_validator: Optional[Annotated[str, Field(min_length=7, strict=True, max_length=7)]] = Field(default=None, description="Hex color string, such as #00FF00.")
if TYPE_CHECKING:
@@ -45,8 +45,9 @@ class AnyOfColor(BaseModel):
actual_instance: Any = None
any_of_schemas: List[str] = Literal[ANYOFCOLOR_ANY_OF_SCHEMAS]
class Config:
validate_assignment = True
model_config = {
"validate_assignment": True
}
def __init__(self, *args, **kwargs) -> None:
if args:
@@ -58,9 +59,9 @@ class AnyOfColor(BaseModel):
else:
super().__init__(**kwargs)
@validator('actual_instance')
@field_validator('actual_instance')
def actual_instance_must_validate_anyof(cls, v):
instance = AnyOfColor.construct()
instance = AnyOfColor.model_construct()
error_messages = []
# validate data type: List[int]
try:
@@ -93,7 +94,7 @@ class AnyOfColor(BaseModel):
@classmethod
def from_json(cls, json_str: str) -> AnyOfColor:
"""Returns the object represented by the json string"""
instance = AnyOfColor.construct()
instance = AnyOfColor.model_construct()
error_messages = []
# deserialize data into List[int]
try:
@@ -153,6 +154,6 @@ class AnyOfColor(BaseModel):
def to_str(self) -> str:
"""Returns the string representation of the actual instance"""
return pprint.pformat(self.dict())
return pprint.pformat(self.model_dump())

View File

@@ -19,7 +19,7 @@ import pprint
import re # noqa: F401
from typing import Optional
from pydantic import BaseModel, Field, StrictStr, ValidationError, validator
from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from petstore_api.models.basque_pig import BasquePig
from petstore_api.models.danish_pig import DanishPig
from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict
@@ -43,8 +43,9 @@ class AnyOfPig(BaseModel):
actual_instance: Any = None
any_of_schemas: List[str] = Literal[ANYOFPIG_ANY_OF_SCHEMAS]
class Config:
validate_assignment = True
model_config = {
"validate_assignment": True
}
def __init__(self, *args, **kwargs) -> None:
if args:
@@ -56,9 +57,9 @@ class AnyOfPig(BaseModel):
else:
super().__init__(**kwargs)
@validator('actual_instance')
@field_validator('actual_instance')
def actual_instance_must_validate_anyof(cls, v):
instance = AnyOfPig.construct()
instance = AnyOfPig.model_construct()
error_messages = []
# validate data type: BasquePig
if not isinstance(v, BasquePig):
@@ -85,7 +86,7 @@ class AnyOfPig(BaseModel):
@classmethod
def from_json(cls, json_str: str) -> AnyOfPig:
"""Returns the object represented by the json string"""
instance = AnyOfPig.construct()
instance = AnyOfPig.model_construct()
error_messages = []
# anyof_schema_1_validator: Optional[BasquePig] = None
try:
@@ -130,6 +131,6 @@ class AnyOfPig(BaseModel):
def to_str(self) -> str:
"""Returns the string representation of the actual instance"""
return pprint.pformat(self.dict())
return pprint.pformat(self.model_dump())

View File

@@ -30,14 +30,15 @@ class ApiResponse(BaseModel):
message: Optional[StrictStr] = None
__properties = ["code", "type", "message"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -51,7 +52,7 @@ class ApiResponse(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -64,9 +65,9 @@ class ApiResponse(BaseModel):
return None
if not isinstance(obj, dict):
return ApiResponse.parse_obj(obj)
return ApiResponse.model_validate(obj)
_obj = ApiResponse.parse_obj({
_obj = ApiResponse.model_validate({
"code": obj.get("code"),
"type": obj.get("type"),
"message": obj.get("message")

View File

@@ -29,14 +29,15 @@ class ArrayOfArrayOfModel(BaseModel):
another_property: Optional[List[List[Tag]]] = None
__properties = ["another_property"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class ArrayOfArrayOfModel(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -72,9 +73,9 @@ class ArrayOfArrayOfModel(BaseModel):
return None
if not isinstance(obj, dict):
return ArrayOfArrayOfModel.parse_obj(obj)
return ArrayOfArrayOfModel.model_validate(obj)
_obj = ArrayOfArrayOfModel.parse_obj({
_obj = ArrayOfArrayOfModel.model_validate({
"another_property": [
[Tag.from_dict(_inner_item) for _inner_item in _item]
for _item in obj.get("another_property")

View File

@@ -29,14 +29,15 @@ class ArrayOfArrayOfNumberOnly(BaseModel):
array_array_number: Optional[List[List[float]]] = Field(default=None, alias="ArrayArrayNumber")
__properties = ["ArrayArrayNumber"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class ArrayOfArrayOfNumberOnly(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -63,9 +64,9 @@ class ArrayOfArrayOfNumberOnly(BaseModel):
return None
if not isinstance(obj, dict):
return ArrayOfArrayOfNumberOnly.parse_obj(obj)
return ArrayOfArrayOfNumberOnly.model_validate(obj)
_obj = ArrayOfArrayOfNumberOnly.parse_obj({
_obj = ArrayOfArrayOfNumberOnly.model_validate({
"ArrayArrayNumber": obj.get("ArrayArrayNumber")
})
return _obj

View File

@@ -29,14 +29,15 @@ class ArrayOfNumberOnly(BaseModel):
array_number: Optional[List[float]] = Field(default=None, alias="ArrayNumber")
__properties = ["ArrayNumber"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class ArrayOfNumberOnly(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -63,9 +64,9 @@ class ArrayOfNumberOnly(BaseModel):
return None
if not isinstance(obj, dict):
return ArrayOfNumberOnly.parse_obj(obj)
return ArrayOfNumberOnly.model_validate(obj)
_obj = ArrayOfNumberOnly.parse_obj({
_obj = ArrayOfNumberOnly.model_validate({
"ArrayNumber": obj.get("ArrayNumber")
})
return _obj

View File

@@ -28,19 +28,20 @@ class ArrayTest(BaseModel):
"""
ArrayTest
"""
array_of_string: Optional[Annotated[List[StrictStr], Field(min_items=0, max_items=3)]] = None
array_of_string: Optional[Annotated[List[StrictStr], Field(min_length=0, max_length=3)]] = None
array_array_of_integer: Optional[List[List[StrictInt]]] = None
array_array_of_model: Optional[List[List[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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -54,7 +55,7 @@ class ArrayTest(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -76,9 +77,9 @@ class ArrayTest(BaseModel):
return None
if not isinstance(obj, dict):
return ArrayTest.parse_obj(obj)
return ArrayTest.model_validate(obj)
_obj = ArrayTest.parse_obj({
_obj = ArrayTest.model_validate({
"array_of_string": obj.get("array_of_string"),
"array_array_of_integer": obj.get("array_array_of_integer"),
"array_array_of_model": [

View File

@@ -30,14 +30,15 @@ class BasquePig(BaseModel):
color: StrictStr
__properties = ["className", "color"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -51,7 +52,7 @@ class BasquePig(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -64,9 +65,9 @@ class BasquePig(BaseModel):
return None
if not isinstance(obj, dict):
return BasquePig.parse_obj(obj)
return BasquePig.model_validate(obj)
_obj = BasquePig.parse_obj({
_obj = BasquePig.model_validate({
"className": obj.get("className"),
"color": obj.get("color")
})

View File

@@ -34,14 +34,15 @@ class Capitalization(BaseModel):
att_name: Optional[StrictStr] = Field(default=None, description="Name of the pet ", alias="ATT_NAME")
__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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -55,7 +56,7 @@ class Capitalization(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -68,9 +69,9 @@ class Capitalization(BaseModel):
return None
if not isinstance(obj, dict):
return Capitalization.parse_obj(obj)
return Capitalization.model_validate(obj)
_obj = Capitalization.parse_obj({
_obj = Capitalization.model_validate({
"smallCamel": obj.get("smallCamel"),
"CapitalCamel": obj.get("CapitalCamel"),
"small_Snake": obj.get("small_Snake"),

View File

@@ -29,14 +29,15 @@ class Cat(Animal):
declawed: Optional[StrictBool] = None
__properties = ["className", "color", "declawed"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class Cat(Animal):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -63,9 +64,9 @@ class Cat(Animal):
return None
if not isinstance(obj, dict):
return Cat.parse_obj(obj)
return Cat.model_validate(obj)
_obj = Cat.parse_obj({
_obj = Cat.model_validate({
"className": obj.get("className"),
"color": obj.get("color") if obj.get("color") is not None else 'red',
"declawed": obj.get("declawed")

View File

@@ -29,14 +29,15 @@ class Category(BaseModel):
name: StrictStr
__properties = ["id", "name"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class Category(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -63,9 +64,9 @@ class Category(BaseModel):
return None
if not isinstance(obj, dict):
return Category.parse_obj(obj)
return Category.model_validate(obj)
_obj = Category.parse_obj({
_obj = Category.model_validate({
"id": obj.get("id"),
"name": obj.get("name") if obj.get("name") is not None else 'default-name'
})

View File

@@ -29,14 +29,15 @@ class CircularReferenceModel(BaseModel):
nested: Optional[FirstRef] = None
__properties = ["size", "nested"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class CircularReferenceModel(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -66,9 +67,9 @@ class CircularReferenceModel(BaseModel):
return None
if not isinstance(obj, dict):
return CircularReferenceModel.parse_obj(obj)
return CircularReferenceModel.model_validate(obj)
_obj = CircularReferenceModel.parse_obj({
_obj = CircularReferenceModel.model_validate({
"size": obj.get("size"),
"nested": FirstRef.from_dict(obj.get("nested")) if obj.get("nested") is not None else None
})

View File

@@ -29,14 +29,15 @@ class ClassModel(BaseModel):
var_class: Optional[StrictStr] = Field(default=None, alias="_class")
__properties = ["_class"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class ClassModel(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -63,9 +64,9 @@ class ClassModel(BaseModel):
return None
if not isinstance(obj, dict):
return ClassModel.parse_obj(obj)
return ClassModel.model_validate(obj)
_obj = ClassModel.parse_obj({
_obj = ClassModel.model_validate({
"_class": obj.get("_class")
})
return _obj

View File

@@ -28,14 +28,15 @@ class Client(BaseModel):
client: Optional[StrictStr] = None
__properties = ["client"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -49,7 +50,7 @@ class Client(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -62,9 +63,9 @@ class Client(BaseModel):
return None
if not isinstance(obj, dict):
return Client.parse_obj(obj)
return Client.model_validate(obj)
_obj = Client.parse_obj({
_obj = Client.model_validate({
"client": obj.get("client")
})
return _obj

View File

@@ -19,7 +19,7 @@ import pprint
import re # noqa: F401
from typing import Any, List, Optional
from pydantic import BaseModel, Field, StrictStr, ValidationError, validator
from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from pydantic import Field
from typing_extensions import Annotated
from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict
@@ -33,16 +33,18 @@ class Color(BaseModel):
RGB array, RGBA array, or hex string.
"""
# data type: List[int]
oneof_schema_1_validator: Optional[Annotated[List[Annotated[int, Field(le=255, strict=True, ge=0)]], Field(min_items=3, max_items=3)]] = Field(default=None, description="RGB three element array with values 0-255.")
oneof_schema_1_validator: Optional[Annotated[List[Annotated[int, Field(le=255, strict=True, ge=0)]], Field(min_length=3, max_length=3)]] = Field(default=None, description="RGB three element array with values 0-255.")
# data type: List[int]
oneof_schema_2_validator: Optional[Annotated[List[Annotated[int, Field(le=255, strict=True, ge=0)]], Field(min_items=4, max_items=4)]] = Field(default=None, description="RGBA four element array with values 0-255.")
oneof_schema_2_validator: Optional[Annotated[List[Annotated[int, Field(le=255, strict=True, ge=0)]], Field(min_length=4, max_length=4)]] = Field(default=None, description="RGBA four element array with values 0-255.")
# data type: str
oneof_schema_3_validator: Optional[Annotated[str, Field(min_length=7, strict=True, max_length=7)]] = Field(default=None, description="Hex color string, such as #00FF00.")
actual_instance: Optional[Union[List[int], str]] = None
one_of_schemas: List[str] = Literal[COLOR_ONE_OF_SCHEMAS]
one_of_schemas: List[str] = Literal["List[int]", "str"]
model_config = {
"validate_assignment": True
}
class Config:
validate_assignment = True
def __init__(self, *args, **kwargs) -> None:
if args:
@@ -54,12 +56,12 @@ class Color(BaseModel):
else:
super().__init__(**kwargs)
@validator('actual_instance')
@field_validator('actual_instance')
def actual_instance_must_validate_oneof(cls, v):
if v is None:
return v
instance = Color.construct()
instance = Color.model_construct()
error_messages = []
match = 0
# validate data type: List[int]
@@ -96,7 +98,7 @@ class Color(BaseModel):
@classmethod
def from_json(cls, json_str: str) -> Color:
"""Returns the object represented by the json string"""
instance = Color.construct()
instance = Color.model_construct()
if json_str is None:
return instance
@@ -165,6 +167,6 @@ class Color(BaseModel):
def to_str(self) -> str:
"""Returns the string representation of the actual instance"""
return pprint.pformat(self.dict())
return pprint.pformat(self.model_dump())

View File

@@ -30,14 +30,15 @@ class Creature(BaseModel):
type: StrictStr
__properties = ["info", "type"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -51,7 +52,7 @@ class Creature(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -67,9 +68,9 @@ class Creature(BaseModel):
return None
if not isinstance(obj, dict):
return Creature.parse_obj(obj)
return Creature.model_validate(obj)
_obj = Creature.parse_obj({
_obj = Creature.model_validate({
"info": CreatureInfo.from_dict(obj.get("info")) if obj.get("info") is not None else None,
"type": obj.get("type")
})

View File

@@ -28,14 +28,15 @@ class CreatureInfo(BaseModel):
name: StrictStr
__properties = ["name"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -49,7 +50,7 @@ class CreatureInfo(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -62,9 +63,9 @@ class CreatureInfo(BaseModel):
return None
if not isinstance(obj, dict):
return CreatureInfo.parse_obj(obj)
return CreatureInfo.model_validate(obj)
_obj = CreatureInfo.parse_obj({
_obj = CreatureInfo.model_validate({
"name": obj.get("name")
})
return _obj

View File

@@ -30,14 +30,15 @@ class DanishPig(BaseModel):
size: StrictInt
__properties = ["className", "size"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -51,7 +52,7 @@ class DanishPig(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -64,9 +65,9 @@ class DanishPig(BaseModel):
return None
if not isinstance(obj, dict):
return DanishPig.parse_obj(obj)
return DanishPig.model_validate(obj)
_obj = DanishPig.parse_obj({
_obj = DanishPig.model_validate({
"className": obj.get("className"),
"size": obj.get("size")
})

View File

@@ -28,14 +28,15 @@ class DeprecatedObject(BaseModel):
name: Optional[StrictStr] = None
__properties = ["name"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -49,7 +50,7 @@ class DeprecatedObject(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -62,9 +63,9 @@ class DeprecatedObject(BaseModel):
return None
if not isinstance(obj, dict):
return DeprecatedObject.parse_obj(obj)
return DeprecatedObject.model_validate(obj)
_obj = DeprecatedObject.parse_obj({
_obj = DeprecatedObject.model_validate({
"name": obj.get("name")
})
return _obj

View File

@@ -29,14 +29,15 @@ class Dog(Animal):
breed: Optional[StrictStr] = None
__properties = ["className", "color", "breed"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class Dog(Animal):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -63,9 +64,9 @@ class Dog(Animal):
return None
if not isinstance(obj, dict):
return Dog.parse_obj(obj)
return Dog.model_validate(obj)
_obj = Dog.parse_obj({
_obj = Dog.model_validate({
"className": obj.get("className"),
"color": obj.get("color") if obj.get("color") is not None else 'red',
"breed": obj.get("breed")

View File

@@ -29,14 +29,15 @@ 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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class DummyModel(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -66,9 +67,9 @@ class DummyModel(BaseModel):
return None
if not isinstance(obj, dict):
return DummyModel.parse_obj(obj)
return DummyModel.model_validate(obj)
_obj = DummyModel.parse_obj({
_obj = DummyModel.model_validate({
"category": obj.get("category"),
"self_ref": SelfReferenceModel.from_dict(obj.get("self_ref")) if obj.get("self_ref") is not None else None
})

View File

@@ -19,7 +19,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, StrictStr, validator
from pydantic import BaseModel, StrictStr, field_validator
class EnumArrays(BaseModel):
"""
@@ -29,7 +29,7 @@ class EnumArrays(BaseModel):
array_enum: Optional[List[StrictStr]] = None
__properties = ["just_symbol", "array_enum"]
@validator('just_symbol')
@field_validator('just_symbol')
def just_symbol_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
@@ -39,7 +39,7 @@ class EnumArrays(BaseModel):
raise ValueError("must be one of enum values ('>=', '$')")
return value
@validator('array_enum')
@field_validator('array_enum')
def array_enum_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
@@ -50,14 +50,15 @@ class EnumArrays(BaseModel):
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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -71,7 +72,7 @@ class EnumArrays(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -84,9 +85,9 @@ class EnumArrays(BaseModel):
return None
if not isinstance(obj, dict):
return EnumArrays.parse_obj(obj)
return EnumArrays.model_validate(obj)
_obj = EnumArrays.parse_obj({
_obj = EnumArrays.model_validate({
"just_symbol": obj.get("just_symbol"),
"array_enum": obj.get("array_enum")
})

View File

@@ -19,7 +19,7 @@ import json
from typing import Optional
from pydantic import BaseModel, StrictInt, StrictStr, validator
from pydantic import BaseModel, StrictInt, StrictStr, field_validator
from pydantic import Field
from petstore_api.models.outer_enum import OuterEnum
from petstore_api.models.outer_enum_default_value import OuterEnumDefaultValue
@@ -41,7 +41,7 @@ class EnumTest(BaseModel):
outer_enum_integer_default_value: Optional[OuterEnumIntegerDefaultValue] = Field(default=None, alias="outerEnumIntegerDefaultValue")
__properties = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue"]
@validator('enum_string')
@field_validator('enum_string')
def enum_string_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
@@ -51,14 +51,14 @@ class EnumTest(BaseModel):
raise ValueError("must be one of enum values ('UPPER', 'lower', '')")
return value
@validator('enum_string_required')
@field_validator('enum_string_required')
def enum_string_required_validate_enum(cls, value):
"""Validates the enum"""
if value not in ('UPPER', 'lower', ''):
raise ValueError("must be one of enum values ('UPPER', 'lower', '')")
return value
@validator('enum_integer_default')
@field_validator('enum_integer_default')
def enum_integer_default_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
@@ -68,7 +68,7 @@ class EnumTest(BaseModel):
raise ValueError("must be one of enum values (1, 5, 14)")
return value
@validator('enum_integer')
@field_validator('enum_integer')
def enum_integer_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
@@ -78,7 +78,7 @@ class EnumTest(BaseModel):
raise ValueError("must be one of enum values (1, -1)")
return value
@validator('enum_number')
@field_validator('enum_number')
def enum_number_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
@@ -88,14 +88,15 @@ class EnumTest(BaseModel):
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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -109,13 +110,13 @@ class EnumTest(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
# set to None if outer_enum (nullable) is None
# and __fields_set__ contains the field
if self.outer_enum is None and "outer_enum" in self.__fields_set__:
# and model_fields_set contains the field
if self.outer_enum is None and "outer_enum" in self.model_fields_set:
_dict['outerEnum'] = None
return _dict
@@ -127,9 +128,9 @@ class EnumTest(BaseModel):
return None
if not isinstance(obj, dict):
return EnumTest.parse_obj(obj)
return EnumTest.model_validate(obj)
_obj = EnumTest.parse_obj({
_obj = EnumTest.model_validate({
"enum_string": obj.get("enum_string"),
"enum_string_required": obj.get("enum_string_required"),
"enum_integer_default": obj.get("enum_integer_default") if obj.get("enum_integer_default") is not None else 5,

View File

@@ -29,14 +29,15 @@ class File(BaseModel):
source_uri: Optional[StrictStr] = Field(default=None, description="Test capitalization", alias="sourceURI")
__properties = ["sourceURI"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class File(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -63,9 +64,9 @@ class File(BaseModel):
return None
if not isinstance(obj, dict):
return File.parse_obj(obj)
return File.model_validate(obj)
_obj = File.parse_obj({
_obj = File.model_validate({
"sourceURI": obj.get("sourceURI")
})
return _obj

View File

@@ -30,14 +30,15 @@ class FileSchemaTestClass(BaseModel):
files: Optional[List[File]] = None
__properties = ["file", "files"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -51,7 +52,7 @@ class FileSchemaTestClass(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -74,9 +75,9 @@ class FileSchemaTestClass(BaseModel):
return None
if not isinstance(obj, dict):
return FileSchemaTestClass.parse_obj(obj)
return FileSchemaTestClass.model_validate(obj)
_obj = FileSchemaTestClass.parse_obj({
_obj = FileSchemaTestClass.model_validate({
"file": File.from_dict(obj.get("file")) if obj.get("file") is not None else None,
"files": [File.from_dict(_item) for _item in obj.get("files")] if obj.get("files") is not None else None
})

View File

@@ -29,14 +29,15 @@ 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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class FirstRef(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -66,9 +67,9 @@ class FirstRef(BaseModel):
return None
if not isinstance(obj, dict):
return FirstRef.parse_obj(obj)
return FirstRef.model_validate(obj)
_obj = FirstRef.parse_obj({
_obj = FirstRef.model_validate({
"category": obj.get("category"),
"self_ref": SecondRef.from_dict(obj.get("self_ref")) if obj.get("self_ref") is not None else None
})

View File

@@ -28,14 +28,15 @@ class Foo(BaseModel):
bar: Optional[StrictStr] = 'bar'
__properties = ["bar"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -49,7 +50,7 @@ class Foo(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -62,9 +63,9 @@ class Foo(BaseModel):
return None
if not isinstance(obj, dict):
return Foo.parse_obj(obj)
return Foo.model_validate(obj)
_obj = Foo.parse_obj({
_obj = Foo.model_validate({
"bar": obj.get("bar") if obj.get("bar") is not None else 'bar'
})
return _obj

View File

@@ -29,14 +29,15 @@ class FooGetDefaultResponse(BaseModel):
string: Optional[Foo] = None
__properties = ["string"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class FooGetDefaultResponse(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -66,9 +67,9 @@ class FooGetDefaultResponse(BaseModel):
return None
if not isinstance(obj, dict):
return FooGetDefaultResponse.parse_obj(obj)
return FooGetDefaultResponse.model_validate(obj)
_obj = FooGetDefaultResponse.parse_obj({
_obj = FooGetDefaultResponse.model_validate({
"string": Foo.from_dict(obj.get("string")) if obj.get("string") is not None else None
})
return _obj

View File

@@ -19,7 +19,7 @@ import json
from datetime import date, datetime
from typing import Optional, Union
from pydantic import BaseModel, StrictBytes, StrictInt, StrictStr, validator
from pydantic import BaseModel, StrictBytes, StrictInt, StrictStr, field_validator
from decimal import Decimal
from pydantic import Field
from typing_extensions import Annotated
@@ -46,7 +46,7 @@ class FormatTest(BaseModel):
pattern_with_digits_and_delimiter: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01.")
__properties = ["integer", "int32", "int64", "number", "double", "decimal", "string", "string_with_double_quote_pattern", "byte", "binary", "date", "dateTime", "uuid", "password", "pattern_with_digits", "pattern_with_digits_and_delimiter"]
@validator('string')
@field_validator('string')
def string_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if value is None:
@@ -56,7 +56,7 @@ class FormatTest(BaseModel):
raise ValueError(r"must validate the regular expression /[a-z]/i")
return value
@validator('string_with_double_quote_pattern')
@field_validator('string_with_double_quote_pattern')
def string_with_double_quote_pattern_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if value is None:
@@ -66,7 +66,7 @@ class FormatTest(BaseModel):
raise ValueError(r"must validate the regular expression /this is \"something\"/")
return value
@validator('pattern_with_digits')
@field_validator('pattern_with_digits')
def pattern_with_digits_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if value is None:
@@ -76,7 +76,7 @@ class FormatTest(BaseModel):
raise ValueError(r"must validate the regular expression /^\d{10}$/")
return value
@validator('pattern_with_digits_and_delimiter')
@field_validator('pattern_with_digits_and_delimiter')
def pattern_with_digits_and_delimiter_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if value is None:
@@ -86,14 +86,15 @@ class FormatTest(BaseModel):
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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -107,7 +108,7 @@ class FormatTest(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -120,9 +121,9 @@ class FormatTest(BaseModel):
return None
if not isinstance(obj, dict):
return FormatTest.parse_obj(obj)
return FormatTest.model_validate(obj)
_obj = FormatTest.parse_obj({
_obj = FormatTest.model_validate({
"integer": obj.get("integer"),
"int32": obj.get("int32"),
"int64": obj.get("int64"),

View File

@@ -29,14 +29,15 @@ class HasOnlyReadOnly(BaseModel):
foo: Optional[StrictStr] = None
__properties = ["bar", "foo"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class HasOnlyReadOnly(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"bar",
"foo",
@@ -65,9 +66,9 @@ class HasOnlyReadOnly(BaseModel):
return None
if not isinstance(obj, dict):
return HasOnlyReadOnly.parse_obj(obj)
return HasOnlyReadOnly.model_validate(obj)
_obj = HasOnlyReadOnly.parse_obj({
_obj = HasOnlyReadOnly.model_validate({
"bar": obj.get("bar"),
"foo": obj.get("foo")
})

View File

@@ -29,14 +29,15 @@ class HealthCheckResult(BaseModel):
nullable_message: Optional[StrictStr] = Field(default=None, alias="NullableMessage")
__properties = ["NullableMessage"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,13 +51,13 @@ class HealthCheckResult(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
# set to None if nullable_message (nullable) is None
# and __fields_set__ contains the field
if self.nullable_message is None and "nullable_message" in self.__fields_set__:
# and model_fields_set contains the field
if self.nullable_message is None and "nullable_message" in self.model_fields_set:
_dict['NullableMessage'] = None
return _dict
@@ -68,9 +69,9 @@ class HealthCheckResult(BaseModel):
return None
if not isinstance(obj, dict):
return HealthCheckResult.parse_obj(obj)
return HealthCheckResult.model_validate(obj)
_obj = HealthCheckResult.parse_obj({
_obj = HealthCheckResult.model_validate({
"NullableMessage": obj.get("NullableMessage")
})
return _obj

View File

@@ -29,14 +29,15 @@ class InnerDictWithProperty(BaseModel):
a_property: Optional[Union[str, Any]] = Field(default=None, alias="aProperty")
__properties = ["aProperty"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class InnerDictWithProperty(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -63,9 +64,9 @@ class InnerDictWithProperty(BaseModel):
return None
if not isinstance(obj, dict):
return InnerDictWithProperty.parse_obj(obj)
return InnerDictWithProperty.model_validate(obj)
_obj = InnerDictWithProperty.parse_obj({
_obj = InnerDictWithProperty.model_validate({
"aProperty": obj.get("aProperty")
})
return _obj

View File

@@ -19,7 +19,7 @@ import pprint
import re # noqa: F401
from typing import Any, List, Optional
from pydantic import BaseModel, Field, StrictStr, ValidationError, validator
from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from pydantic import Field
from typing_extensions import Annotated
from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict
@@ -37,10 +37,12 @@ class IntOrString(BaseModel):
# data type: str
oneof_schema_2_validator: Optional[StrictStr] = None
actual_instance: Optional[Union[int, str]] = None
one_of_schemas: List[str] = Literal[INTORSTRING_ONE_OF_SCHEMAS]
one_of_schemas: List[str] = Literal["int", "str"]
model_config = {
"validate_assignment": True
}
class Config:
validate_assignment = True
def __init__(self, *args, **kwargs) -> None:
if args:
@@ -52,9 +54,9 @@ class IntOrString(BaseModel):
else:
super().__init__(**kwargs)
@validator('actual_instance')
@field_validator('actual_instance')
def actual_instance_must_validate_oneof(cls, v):
instance = IntOrString.construct()
instance = IntOrString.model_construct()
error_messages = []
match = 0
# validate data type: int
@@ -85,7 +87,7 @@ class IntOrString(BaseModel):
@classmethod
def from_json(cls, json_str: str) -> IntOrString:
"""Returns the object represented by the json string"""
instance = IntOrString.construct()
instance = IntOrString.model_construct()
error_messages = []
match = 0
@@ -142,6 +144,6 @@ class IntOrString(BaseModel):
def to_str(self) -> str:
"""Returns the string representation of the actual instance"""
return pprint.pformat(self.dict())
return pprint.pformat(self.model_dump())

View File

@@ -29,14 +29,15 @@ class List(BaseModel):
var_123_list: Optional[StrictStr] = Field(default=None, alias="123-list")
__properties = ["123-list"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class List(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -63,9 +64,9 @@ class List(BaseModel):
return None
if not isinstance(obj, dict):
return List.parse_obj(obj)
return List.model_validate(obj)
_obj = List.parse_obj({
_obj = List.model_validate({
"123-list": obj.get("123-list")
})
return _obj

View File

@@ -30,14 +30,15 @@ class MapOfArrayOfModel(BaseModel):
shop_id_to_org_online_lip_map: Optional[Dict[str, List[Tag]]] = Field(default=None, alias="shopIdToOrgOnlineLipMap")
__properties = ["shopIdToOrgOnlineLipMap"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -51,7 +52,7 @@ class MapOfArrayOfModel(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -73,9 +74,9 @@ class MapOfArrayOfModel(BaseModel):
return None
if not isinstance(obj, dict):
return MapOfArrayOfModel.parse_obj(obj)
return MapOfArrayOfModel.model_validate(obj)
_obj = MapOfArrayOfModel.parse_obj({
_obj = MapOfArrayOfModel.model_validate({
"shopIdToOrgOnlineLipMap": dict(
(_k,
[Tag.from_dict(_item) for _item in _v]

View File

@@ -19,7 +19,7 @@ import json
from typing import Dict, Optional
from pydantic import BaseModel, StrictBool, StrictStr, validator
from pydantic import BaseModel, StrictBool, StrictStr, field_validator
class MapTest(BaseModel):
"""
@@ -31,7 +31,7 @@ class MapTest(BaseModel):
indirect_map: Optional[Dict[str, StrictBool]] = None
__properties = ["map_map_of_string", "map_of_enum_string", "direct_map", "indirect_map"]
@validator('map_of_enum_string')
@field_validator('map_of_enum_string')
def map_of_enum_string_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
@@ -41,14 +41,15 @@ class MapTest(BaseModel):
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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -62,7 +63,7 @@ class MapTest(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -75,9 +76,9 @@ class MapTest(BaseModel):
return None
if not isinstance(obj, dict):
return MapTest.parse_obj(obj)
return MapTest.model_validate(obj)
_obj = MapTest.parse_obj({
_obj = MapTest.model_validate({
"map_map_of_string": obj.get("map_map_of_string"),
"map_of_enum_string": obj.get("map_of_enum_string"),
"direct_map": obj.get("direct_map"),

View File

@@ -32,14 +32,15 @@ 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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -53,7 +54,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -73,9 +74,9 @@ class MixedPropertiesAndAdditionalPropertiesClass(BaseModel):
return None
if not isinstance(obj, dict):
return MixedPropertiesAndAdditionalPropertiesClass.parse_obj(obj)
return MixedPropertiesAndAdditionalPropertiesClass.model_validate(obj)
_obj = MixedPropertiesAndAdditionalPropertiesClass.parse_obj({
_obj = MixedPropertiesAndAdditionalPropertiesClass.model_validate({
"uuid": obj.get("uuid"),
"dateTime": obj.get("dateTime"),
"map": dict(

View File

@@ -30,14 +30,15 @@ class Model200Response(BaseModel):
var_class: Optional[StrictStr] = Field(default=None, alias="class")
__properties = ["name", "class"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -51,7 +52,7 @@ class Model200Response(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -64,9 +65,9 @@ class Model200Response(BaseModel):
return None
if not isinstance(obj, dict):
return Model200Response.parse_obj(obj)
return Model200Response.model_validate(obj)
_obj = Model200Response.parse_obj({
_obj = Model200Response.model_validate({
"name": obj.get("name"),
"class": obj.get("class")
})

View File

@@ -29,14 +29,15 @@ class ModelReturn(BaseModel):
var_return: Optional[StrictInt] = Field(default=None, alias="return")
__properties = ["return"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class ModelReturn(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -63,9 +64,9 @@ class ModelReturn(BaseModel):
return None
if not isinstance(obj, dict):
return ModelReturn.parse_obj(obj)
return ModelReturn.model_validate(obj)
_obj = ModelReturn.parse_obj({
_obj = ModelReturn.model_validate({
"return": obj.get("return")
})
return _obj

View File

@@ -32,14 +32,15 @@ class Name(BaseModel):
var_123_number: Optional[StrictInt] = Field(default=None, alias="123Number")
__properties = ["name", "snake_case", "property", "123Number"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -53,7 +54,7 @@ class Name(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"snake_case",
"var_123_number",
@@ -68,9 +69,9 @@ class Name(BaseModel):
return None
if not isinstance(obj, dict):
return Name.parse_obj(obj)
return Name.model_validate(obj)
_obj = Name.parse_obj({
_obj = Name.model_validate({
"name": obj.get("name"),
"snake_case": obj.get("snake_case"),
"property": obj.get("property"),

View File

@@ -41,14 +41,15 @@ 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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -62,7 +63,7 @@ class NullableClass(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
@@ -73,58 +74,58 @@ class NullableClass(BaseModel):
_dict[_key] = _value
# set to None if required_integer_prop (nullable) is None
# and __fields_set__ contains the field
if self.required_integer_prop is None and "required_integer_prop" in self.__fields_set__:
# and model_fields_set contains the field
if self.required_integer_prop is None and "required_integer_prop" in self.model_fields_set:
_dict['required_integer_prop'] = None
# set to None if integer_prop (nullable) is None
# and __fields_set__ contains the field
if self.integer_prop is None and "integer_prop" in self.__fields_set__:
# and model_fields_set contains the field
if self.integer_prop is None and "integer_prop" in self.model_fields_set:
_dict['integer_prop'] = None
# set to None if number_prop (nullable) is None
# and __fields_set__ contains the field
if self.number_prop is None and "number_prop" in self.__fields_set__:
# and model_fields_set contains the field
if self.number_prop is None and "number_prop" in self.model_fields_set:
_dict['number_prop'] = None
# set to None if boolean_prop (nullable) is None
# and __fields_set__ contains the field
if self.boolean_prop is None and "boolean_prop" in self.__fields_set__:
# and model_fields_set contains the field
if self.boolean_prop is None and "boolean_prop" in self.model_fields_set:
_dict['boolean_prop'] = None
# set to None if string_prop (nullable) is None
# and __fields_set__ contains the field
if self.string_prop is None and "string_prop" in self.__fields_set__:
# and model_fields_set contains the field
if self.string_prop is None and "string_prop" in self.model_fields_set:
_dict['string_prop'] = None
# set to None if date_prop (nullable) is None
# and __fields_set__ contains the field
if self.date_prop is None and "date_prop" in self.__fields_set__:
# and model_fields_set contains the field
if self.date_prop is None and "date_prop" in self.model_fields_set:
_dict['date_prop'] = None
# set to None if datetime_prop (nullable) is None
# and __fields_set__ contains the field
if self.datetime_prop is None and "datetime_prop" in self.__fields_set__:
# and model_fields_set contains the field
if self.datetime_prop is None and "datetime_prop" in self.model_fields_set:
_dict['datetime_prop'] = None
# set to None if array_nullable_prop (nullable) is None
# and __fields_set__ contains the field
if self.array_nullable_prop is None and "array_nullable_prop" in self.__fields_set__:
# and model_fields_set contains the field
if self.array_nullable_prop is None and "array_nullable_prop" in self.model_fields_set:
_dict['array_nullable_prop'] = None
# set to None if array_and_items_nullable_prop (nullable) is None
# and __fields_set__ contains the field
if self.array_and_items_nullable_prop is None and "array_and_items_nullable_prop" in self.__fields_set__:
# and model_fields_set contains the field
if self.array_and_items_nullable_prop is None and "array_and_items_nullable_prop" in self.model_fields_set:
_dict['array_and_items_nullable_prop'] = None
# set to None if object_nullable_prop (nullable) is None
# and __fields_set__ contains the field
if self.object_nullable_prop is None and "object_nullable_prop" in self.__fields_set__:
# and model_fields_set contains the field
if self.object_nullable_prop is None and "object_nullable_prop" in self.model_fields_set:
_dict['object_nullable_prop'] = None
# set to None if object_and_items_nullable_prop (nullable) is None
# and __fields_set__ contains the field
if self.object_and_items_nullable_prop is None and "object_and_items_nullable_prop" in self.__fields_set__:
# and model_fields_set contains the field
if self.object_and_items_nullable_prop is None and "object_and_items_nullable_prop" in self.model_fields_set:
_dict['object_and_items_nullable_prop'] = None
return _dict
@@ -136,9 +137,9 @@ class NullableClass(BaseModel):
return None
if not isinstance(obj, dict):
return NullableClass.parse_obj(obj)
return NullableClass.model_validate(obj)
_obj = NullableClass.parse_obj({
_obj = NullableClass.model_validate({
"required_integer_prop": obj.get("required_integer_prop"),
"integer_prop": obj.get("integer_prop"),
"number_prop": obj.get("number_prop"),

View File

@@ -19,7 +19,7 @@ import json
from typing import Optional
from pydantic import BaseModel, StrictInt, validator
from pydantic import BaseModel, StrictInt, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -31,7 +31,7 @@ class NullableProperty(BaseModel):
name: Optional[Annotated[str, Field(strict=True)]]
__properties = ["id", "name"]
@validator('name')
@field_validator('name')
def name_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if value is None:
@@ -41,14 +41,15 @@ class NullableProperty(BaseModel):
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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -62,13 +63,13 @@ class NullableProperty(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
# set to None if name (nullable) is None
# and __fields_set__ contains the field
if self.name is None and "name" in self.__fields_set__:
# and model_fields_set contains the field
if self.name is None and "name" in self.model_fields_set:
_dict['name'] = None
return _dict
@@ -80,9 +81,9 @@ class NullableProperty(BaseModel):
return None
if not isinstance(obj, dict):
return NullableProperty.parse_obj(obj)
return NullableProperty.model_validate(obj)
_obj = NullableProperty.parse_obj({
_obj = NullableProperty.model_validate({
"id": obj.get("id"),
"name": obj.get("name")
})

View File

@@ -29,14 +29,15 @@ class NumberOnly(BaseModel):
just_number: Optional[float] = Field(default=None, alias="JustNumber")
__properties = ["JustNumber"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class NumberOnly(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -63,9 +64,9 @@ class NumberOnly(BaseModel):
return None
if not isinstance(obj, dict):
return NumberOnly.parse_obj(obj)
return NumberOnly.model_validate(obj)
_obj = NumberOnly.parse_obj({
_obj = NumberOnly.model_validate({
"JustNumber": obj.get("JustNumber")
})
return _obj

View File

@@ -29,14 +29,15 @@ class ObjectToTestAdditionalProperties(BaseModel):
var_property: Optional[StrictBool] = Field(default=False, description="Property", alias="property")
__properties = ["property"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class ObjectToTestAdditionalProperties(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -63,9 +64,9 @@ class ObjectToTestAdditionalProperties(BaseModel):
return None
if not isinstance(obj, dict):
return ObjectToTestAdditionalProperties.parse_obj(obj)
return ObjectToTestAdditionalProperties.model_validate(obj)
_obj = ObjectToTestAdditionalProperties.parse_obj({
_obj = ObjectToTestAdditionalProperties.model_validate({
"property": obj.get("property") if obj.get("property") is not None else False
})
return _obj

View File

@@ -33,14 +33,15 @@ class ObjectWithDeprecatedFields(BaseModel):
bars: Optional[List[StrictStr]] = None
__properties = ["uuid", "id", "deprecatedRef", "bars"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -54,7 +55,7 @@ class ObjectWithDeprecatedFields(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -70,9 +71,9 @@ class ObjectWithDeprecatedFields(BaseModel):
return None
if not isinstance(obj, dict):
return ObjectWithDeprecatedFields.parse_obj(obj)
return ObjectWithDeprecatedFields.model_validate(obj)
_obj = ObjectWithDeprecatedFields.parse_obj({
_obj = ObjectWithDeprecatedFields.model_validate({
"uuid": obj.get("uuid"),
"id": obj.get("id"),
"deprecatedRef": DeprecatedObject.from_dict(obj.get("deprecatedRef")) if obj.get("deprecatedRef") is not None else None,

View File

@@ -19,7 +19,7 @@ import pprint
import re # noqa: F401
from typing import Any, List, Optional
from pydantic import BaseModel, Field, StrictStr, ValidationError, validator
from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from petstore_api.models.enum_string1 import EnumString1
from petstore_api.models.enum_string2 import EnumString2
from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict
@@ -37,10 +37,12 @@ class OneOfEnumString(BaseModel):
# data type: EnumString2
oneof_schema_2_validator: Optional[EnumString2] = None
actual_instance: Optional[Union[EnumString1, EnumString2]] = None
one_of_schemas: List[str] = Literal[ONEOFENUMSTRING_ONE_OF_SCHEMAS]
one_of_schemas: List[str] = Literal["EnumString1", "EnumString2"]
model_config = {
"validate_assignment": True
}
class Config:
validate_assignment = True
def __init__(self, *args, **kwargs) -> None:
if args:
@@ -52,9 +54,9 @@ class OneOfEnumString(BaseModel):
else:
super().__init__(**kwargs)
@validator('actual_instance')
@field_validator('actual_instance')
def actual_instance_must_validate_oneof(cls, v):
instance = OneOfEnumString.construct()
instance = OneOfEnumString.model_construct()
error_messages = []
match = 0
# validate data type: EnumString1
@@ -83,7 +85,7 @@ class OneOfEnumString(BaseModel):
@classmethod
def from_json(cls, json_str: str) -> OneOfEnumString:
"""Returns the object represented by the json string"""
instance = OneOfEnumString.construct()
instance = OneOfEnumString.model_construct()
error_messages = []
match = 0
@@ -134,6 +136,6 @@ class OneOfEnumString(BaseModel):
def to_str(self) -> str:
"""Returns the string representation of the actual instance"""
return pprint.pformat(self.dict())
return pprint.pformat(self.model_dump())

View File

@@ -19,7 +19,7 @@ import json
from datetime import datetime
from typing import Optional
from pydantic import BaseModel, StrictBool, StrictInt, StrictStr, validator
from pydantic import BaseModel, StrictBool, StrictInt, StrictStr, field_validator
from pydantic import Field
class Order(BaseModel):
@@ -34,7 +34,7 @@ class Order(BaseModel):
complete: Optional[StrictBool] = False
__properties = ["id", "petId", "quantity", "shipDate", "status", "complete"]
@validator('status')
@field_validator('status')
def status_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
@@ -44,14 +44,15 @@ class Order(BaseModel):
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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -65,7 +66,7 @@ class Order(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -78,9 +79,9 @@ class Order(BaseModel):
return None
if not isinstance(obj, dict):
return Order.parse_obj(obj)
return Order.model_validate(obj)
_obj = Order.parse_obj({
_obj = Order.model_validate({
"id": obj.get("id"),
"petId": obj.get("petId"),
"quantity": obj.get("quantity"),

View File

@@ -30,14 +30,15 @@ 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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -51,7 +52,7 @@ class OuterComposite(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -64,9 +65,9 @@ class OuterComposite(BaseModel):
return None
if not isinstance(obj, dict):
return OuterComposite.parse_obj(obj)
return OuterComposite.model_validate(obj)
_obj = OuterComposite.parse_obj({
_obj = OuterComposite.model_validate({
"my_number": obj.get("my_number"),
"my_string": obj.get("my_string"),
"my_boolean": obj.get("my_boolean")

View File

@@ -31,14 +31,15 @@ class OuterObjectWithEnumProperty(BaseModel):
value: OuterEnumInteger
__properties = ["str_value", "value"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -52,13 +53,13 @@ class OuterObjectWithEnumProperty(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
# set to None if str_value (nullable) is None
# and __fields_set__ contains the field
if self.str_value is None and "str_value" in self.__fields_set__:
# and model_fields_set contains the field
if self.str_value is None and "str_value" in self.model_fields_set:
_dict['str_value'] = None
return _dict
@@ -70,9 +71,9 @@ class OuterObjectWithEnumProperty(BaseModel):
return None
if not isinstance(obj, dict):
return OuterObjectWithEnumProperty.parse_obj(obj)
return OuterObjectWithEnumProperty.model_validate(obj)
_obj = OuterObjectWithEnumProperty.parse_obj({
_obj = OuterObjectWithEnumProperty.model_validate({
"str_value": obj.get("str_value"),
"value": obj.get("value")
})

View File

@@ -30,14 +30,15 @@ class Parent(BaseModel):
optional_dict: Optional[Dict[str, InnerDictWithProperty]] = Field(default=None, alias="optionalDict")
__properties = ["optionalDict"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -51,7 +52,7 @@ class Parent(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -71,9 +72,9 @@ class Parent(BaseModel):
return None
if not isinstance(obj, dict):
return Parent.parse_obj(obj)
return Parent.model_validate(obj)
_obj = Parent.parse_obj({
_obj = Parent.model_validate({
"optionalDict": dict(
(_k, InnerDictWithProperty.from_dict(_v))
for _k, _v in obj.get("optionalDict").items()

View File

@@ -30,14 +30,15 @@ class ParentWithOptionalDict(BaseModel):
optional_dict: Optional[Dict[str, InnerDictWithProperty]] = Field(default=None, alias="optionalDict")
__properties = ["optionalDict"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -51,7 +52,7 @@ class ParentWithOptionalDict(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -71,9 +72,9 @@ class ParentWithOptionalDict(BaseModel):
return None
if not isinstance(obj, dict):
return ParentWithOptionalDict.parse_obj(obj)
return ParentWithOptionalDict.model_validate(obj)
_obj = ParentWithOptionalDict.parse_obj({
_obj = ParentWithOptionalDict.model_validate({
"optionalDict": dict(
(_k, InnerDictWithProperty.from_dict(_v))
for _k, _v in obj.get("optionalDict").items()

View File

@@ -19,7 +19,7 @@ import json
from typing import List, Optional
from pydantic import BaseModel, StrictInt, StrictStr, validator
from pydantic import BaseModel, StrictInt, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
from petstore_api.models.category import Category
@@ -32,12 +32,12 @@ class Pet(BaseModel):
id: Optional[StrictInt] = None
category: Optional[Category] = None
name: StrictStr
photo_urls: Annotated[List[StrictStr], Field(min_items=0)] = Field(alias="photoUrls")
photo_urls: Annotated[List[StrictStr], Field(min_length=0)] = Field(alias="photoUrls")
tags: Optional[List[Tag]] = None
status: Optional[StrictStr] = Field(default=None, description="pet status in the store")
__properties = ["id", "category", "name", "photoUrls", "tags", "status"]
@validator('status')
@field_validator('status')
def status_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
@@ -47,14 +47,15 @@ class Pet(BaseModel):
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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -68,7 +69,7 @@ class Pet(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -91,9 +92,9 @@ class Pet(BaseModel):
return None
if not isinstance(obj, dict):
return Pet.parse_obj(obj)
return Pet.model_validate(obj)
_obj = Pet.parse_obj({
_obj = Pet.model_validate({
"id": obj.get("id"),
"category": Category.from_dict(obj.get("category")) if obj.get("category") is not None else None,
"name": obj.get("name"),

View File

@@ -19,7 +19,7 @@ import pprint
import re # noqa: F401
from typing import Any, List, Optional
from pydantic import BaseModel, Field, StrictStr, ValidationError, validator
from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from petstore_api.models.basque_pig import BasquePig
from petstore_api.models.danish_pig import DanishPig
from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict
@@ -37,10 +37,12 @@ class Pig(BaseModel):
# data type: DanishPig
oneof_schema_2_validator: Optional[DanishPig] = None
actual_instance: Optional[Union[BasquePig, DanishPig]] = None
one_of_schemas: List[str] = Literal[PIG_ONE_OF_SCHEMAS]
one_of_schemas: List[str] = Literal["BasquePig", "DanishPig"]
model_config = {
"validate_assignment": True
}
class Config:
validate_assignment = True
discriminator_value_class_map: Dict[str, str] = {
}
@@ -55,9 +57,9 @@ class Pig(BaseModel):
else:
super().__init__(**kwargs)
@validator('actual_instance')
@field_validator('actual_instance')
def actual_instance_must_validate_oneof(cls, v):
instance = Pig.construct()
instance = Pig.model_construct()
error_messages = []
match = 0
# validate data type: BasquePig
@@ -86,7 +88,7 @@ class Pig(BaseModel):
@classmethod
def from_json(cls, json_str: str) -> Pig:
"""Returns the object represented by the json string"""
instance = Pig.construct()
instance = Pig.model_construct()
error_messages = []
match = 0
@@ -137,6 +139,6 @@ class Pig(BaseModel):
def to_str(self) -> str:
"""Returns the string representation of the actual instance"""
return pprint.pformat(self.dict())
return pprint.pformat(self.model_dump())

View File

@@ -31,14 +31,15 @@ class PropertyNameCollision(BaseModel):
type_: Optional[StrictStr] = None
__properties = ["_type", "type", "type_"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -52,7 +53,7 @@ class PropertyNameCollision(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -65,9 +66,9 @@ class PropertyNameCollision(BaseModel):
return None
if not isinstance(obj, dict):
return PropertyNameCollision.parse_obj(obj)
return PropertyNameCollision.model_validate(obj)
_obj = PropertyNameCollision.parse_obj({
_obj = PropertyNameCollision.model_validate({
"_type": obj.get("_type"),
"type": obj.get("type"),
"type_": obj.get("type_")

View File

@@ -29,14 +29,15 @@ class ReadOnlyFirst(BaseModel):
baz: Optional[StrictStr] = None
__properties = ["bar", "baz"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class ReadOnlyFirst(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"bar",
},
@@ -64,9 +65,9 @@ class ReadOnlyFirst(BaseModel):
return None
if not isinstance(obj, dict):
return ReadOnlyFirst.parse_obj(obj)
return ReadOnlyFirst.model_validate(obj)
_obj = ReadOnlyFirst.parse_obj({
_obj = ReadOnlyFirst.model_validate({
"bar": obj.get("bar"),
"baz": obj.get("baz")
})

View File

@@ -29,14 +29,15 @@ 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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class SecondRef(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -66,9 +67,9 @@ class SecondRef(BaseModel):
return None
if not isinstance(obj, dict):
return SecondRef.parse_obj(obj)
return SecondRef.model_validate(obj)
_obj = SecondRef.parse_obj({
_obj = SecondRef.model_validate({
"category": obj.get("category"),
"circular_ref": CircularReferenceModel.from_dict(obj.get("circular_ref")) if obj.get("circular_ref") is not None else None
})

View File

@@ -29,14 +29,15 @@ class SelfReferenceModel(BaseModel):
nested: Optional[DummyModel] = None
__properties = ["size", "nested"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class SelfReferenceModel(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -66,9 +67,9 @@ class SelfReferenceModel(BaseModel):
return None
if not isinstance(obj, dict):
return SelfReferenceModel.parse_obj(obj)
return SelfReferenceModel.model_validate(obj)
_obj = SelfReferenceModel.parse_obj({
_obj = SelfReferenceModel.model_validate({
"size": obj.get("size"),
"nested": DummyModel.from_dict(obj.get("nested")) if obj.get("nested") is not None else None
})

View File

@@ -29,14 +29,15 @@ class SpecialModelName(BaseModel):
special_property_name: Optional[StrictInt] = Field(default=None, alias="$special[property.name]")
__properties = ["$special[property.name]"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class SpecialModelName(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -63,9 +64,9 @@ class SpecialModelName(BaseModel):
return None
if not isinstance(obj, dict):
return SpecialModelName.parse_obj(obj)
return SpecialModelName.model_validate(obj)
_obj = SpecialModelName.parse_obj({
_obj = SpecialModelName.model_validate({
"$special[property.name]": obj.get("$special[property.name]")
})
return _obj

View File

@@ -19,7 +19,7 @@ import json
from typing import Optional
from pydantic import BaseModel, StrictInt, StrictStr, validator
from pydantic import BaseModel, StrictInt, StrictStr, field_validator
from pydantic import Field
from petstore_api.models.category import Category
@@ -32,7 +32,7 @@ class SpecialName(BaseModel):
var_schema: Optional[StrictStr] = Field(default=None, description="pet status in the store", alias="schema")
__properties = ["property", "async", "schema"]
@validator('var_schema')
@field_validator('var_schema')
def var_schema_validate_enum(cls, value):
"""Validates the enum"""
if value is None:
@@ -42,14 +42,15 @@ class SpecialName(BaseModel):
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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -63,7 +64,7 @@ class SpecialName(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -79,9 +80,9 @@ class SpecialName(BaseModel):
return None
if not isinstance(obj, dict):
return SpecialName.parse_obj(obj)
return SpecialName.model_validate(obj)
_obj = SpecialName.parse_obj({
_obj = SpecialName.model_validate({
"property": obj.get("property"),
"async": Category.from_dict(obj.get("async")) if obj.get("async") is not None else None,
"schema": obj.get("schema")

View File

@@ -29,14 +29,15 @@ class Tag(BaseModel):
name: Optional[StrictStr] = None
__properties = ["id", "name"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class Tag(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -63,9 +64,9 @@ class Tag(BaseModel):
return None
if not isinstance(obj, dict):
return Tag.parse_obj(obj)
return Tag.model_validate(obj)
_obj = Tag.parse_obj({
_obj = Tag.model_validate({
"id": obj.get("id"),
"name": obj.get("name")
})

View File

@@ -30,14 +30,15 @@ class TestInlineFreeformAdditionalPropertiesRequest(BaseModel):
additional_properties: Dict[str, Any] = {}
__properties = ["someProperty"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -51,7 +52,7 @@ class TestInlineFreeformAdditionalPropertiesRequest(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
@@ -70,9 +71,9 @@ class TestInlineFreeformAdditionalPropertiesRequest(BaseModel):
return None
if not isinstance(obj, dict):
return TestInlineFreeformAdditionalPropertiesRequest.parse_obj(obj)
return TestInlineFreeformAdditionalPropertiesRequest.model_validate(obj)
_obj = TestInlineFreeformAdditionalPropertiesRequest.parse_obj({
_obj = TestInlineFreeformAdditionalPropertiesRequest.model_validate({
"someProperty": obj.get("someProperty")
})
# store additional fields in additional_properties

View File

@@ -28,14 +28,15 @@ class Tiger(BaseModel):
skill: Optional[StrictStr] = None
__properties = ["skill"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -49,7 +50,7 @@ class Tiger(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -62,9 +63,9 @@ class Tiger(BaseModel):
return None
if not isinstance(obj, dict):
return Tiger.parse_obj(obj)
return Tiger.model_validate(obj)
_obj = Tiger.parse_obj({
_obj = Tiger.model_validate({
"skill": obj.get("skill")
})
return _obj

View File

@@ -36,14 +36,15 @@ class User(BaseModel):
user_status: Optional[StrictInt] = Field(default=None, description="User Status", alias="userStatus")
__properties = ["id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -57,7 +58,7 @@ class User(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -70,9 +71,9 @@ class User(BaseModel):
return None
if not isinstance(obj, dict):
return User.parse_obj(obj)
return User.model_validate(obj)
_obj = User.parse_obj({
_obj = User.model_validate({
"id": obj.get("id"),
"username": obj.get("username"),
"firstName": obj.get("firstName"),

View File

@@ -32,14 +32,15 @@ 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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -53,7 +54,7 @@ class WithNestedOneOf(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
},
exclude_none=True)
@@ -72,9 +73,9 @@ class WithNestedOneOf(BaseModel):
return None
if not isinstance(obj, dict):
return WithNestedOneOf.parse_obj(obj)
return WithNestedOneOf.model_validate(obj)
_obj = WithNestedOneOf.parse_obj({
_obj = WithNestedOneOf.model_validate({
"size": obj.get("size"),
"nested_pig": Pig.from_dict(obj.get("nested_pig")) if obj.get("nested_pig") is not None else None,
"nested_oneof_enum_string": OneOfEnumString.from_dict(obj.get("nested_oneof_enum_string")) if obj.get("nested_oneof_enum_string") is not None else None

View File

@@ -16,7 +16,7 @@ import re # noqa: F401
import io
import warnings
from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from pydantic import Field
from typing_extensions import Annotated
@@ -42,7 +42,7 @@ class AnotherFakeApi:
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 @@ class AnotherFakeApi:
raise ValueError(message)
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

View File

@@ -16,7 +16,7 @@ import re # noqa: F401
import io
import warnings
from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from petstore_api.models.foo_get_default_response import FooGetDefaultResponse
@@ -40,7 +40,7 @@ class DefaultApi:
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 @@ class DefaultApi:
raise ValueError(message)
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

View File

@@ -16,13 +16,13 @@ import re # noqa: F401
import io
import warnings
from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from pydantic import Field
from typing_extensions import Annotated
from datetime import date, datetime
from pydantic import StrictBool, StrictBytes, StrictFloat, StrictInt, StrictStr, validator
from pydantic import StrictBool, StrictBytes, StrictFloat, StrictInt, StrictStr, field_validator
from typing import Any, Dict, List, Optional, Union
@@ -57,7 +57,7 @@ class FakeApi:
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
@@ -86,7 +86,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -196,7 +196,7 @@ class FakeApi:
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
@@ -225,7 +225,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -328,7 +328,7 @@ class FakeApi:
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
@@ -355,7 +355,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -458,7 +458,7 @@ class FakeApi:
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
@@ -491,7 +491,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -613,7 +613,7 @@ class FakeApi:
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
@@ -643,7 +643,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -760,7 +760,7 @@ class FakeApi:
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
@@ -790,7 +790,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -907,7 +907,7 @@ class FakeApi:
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
@@ -937,7 +937,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -1054,7 +1054,7 @@ class FakeApi:
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
@@ -1084,7 +1084,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -1201,7 +1201,7 @@ class FakeApi:
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
@@ -1231,7 +1231,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -1348,7 +1348,7 @@ class FakeApi:
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
@@ -1375,7 +1375,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -1478,7 +1478,7 @@ class FakeApi:
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
@@ -1507,7 +1507,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -1610,7 +1610,7 @@ class FakeApi:
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
@@ -1640,7 +1640,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -1756,7 +1756,7 @@ class FakeApi:
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
@@ -1786,7 +1786,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -1897,7 +1897,7 @@ class FakeApi:
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
@@ -1928,7 +1928,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -2044,7 +2044,7 @@ class FakeApi:
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
@@ -2074,7 +2074,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -2191,7 +2191,7 @@ class FakeApi:
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
@@ -2222,7 +2222,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -2334,7 +2334,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
def test_endpoint_parameters(self, number : Annotated[float, Field(le=543.2, strict=True, ge=32.1, description="None")], double : Annotated[float, Field(le=123.4, strict=True, ge=67.8, description="None")], pattern_without_delimiter : Annotated[str, Field(strict=True, description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(description="None")], integer : Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=10)]], Field(description="None")] = None, int32 : Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=20)]], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[Annotated[float, Field(le=987.6, strict=True)]], Field(description="None")] = None, string : Annotated[Optional[Annotated[str, Field(strict=True)]], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[Annotated[bytes, Field(strict=True, max_length=64)], Annotated[str, Field(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[Annotated[str, Field(min_length=10, strict=True, max_length=64)]], 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
@@ -2392,7 +2392,7 @@ class FakeApi:
raise ValueError(message)
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[float, Field(le=543.2, strict=True, ge=32.1, description="None")], double : Annotated[float, Field(le=123.4, strict=True, ge=67.8, description="None")], pattern_without_delimiter : Annotated[str, Field(strict=True, description="None")], byte : Annotated[Union[StrictBytes, StrictStr], Field(description="None")], integer : Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=10)]], Field(description="None")] = None, int32 : Annotated[Optional[Annotated[int, Field(le=200, strict=True, ge=20)]], Field(description="None")] = None, int64 : Annotated[Optional[StrictInt], Field(description="None")] = None, float : Annotated[Optional[Annotated[float, Field(le=987.6, strict=True)]], Field(description="None")] = None, string : Annotated[Optional[Annotated[str, Field(strict=True)]], Field(description="None")] = None, binary : Annotated[Optional[Union[StrictBytes, StrictStr]], Field(description="None")] = None, byte_with_max_length : Annotated[Optional[Union[Annotated[bytes, Field(strict=True, max_length=64)], Annotated[str, Field(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[Annotated[str, Field(min_length=10, strict=True, max_length=64)]], 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
@@ -2587,7 +2587,7 @@ class FakeApi:
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
@@ -2627,7 +2627,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -2761,7 +2761,7 @@ class FakeApi:
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
@@ -2791,7 +2791,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -2902,7 +2902,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
def test_inline_freeform_additional_properties(self, test_inline_freeform_additional_properties_request : Annotated[TestInlineFreeformAdditionalPropertiesRequest, Field(description="request body")], **kwargs) -> None: # noqa: E501
"""test inline free-form additionalProperties # noqa: E501
@@ -2932,7 +2932,7 @@ class FakeApi:
raise ValueError(message)
return self.test_inline_freeform_additional_properties_with_http_info(test_inline_freeform_additional_properties_request, **kwargs) # noqa: E501
@validate_arguments
@validate_call
def test_inline_freeform_additional_properties_with_http_info(self, test_inline_freeform_additional_properties_request : Annotated[TestInlineFreeformAdditionalPropertiesRequest, Field(description="request body")], **kwargs) -> ApiResponse: # noqa: E501
"""test inline free-form additionalProperties # noqa: E501
@@ -3043,7 +3043,7 @@ class FakeApi:
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
@@ -3075,7 +3075,7 @@ class FakeApi:
raise ValueError(message)
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
@@ -3192,7 +3192,7 @@ class FakeApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
def test_query_parameter_collection_format(self, pipe : List[StrictStr], ioutil : List[StrictStr], http : List[StrictStr], url : List[StrictStr], context : List[StrictStr], allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> None: # noqa: E501
"""test_query_parameter_collection_format # noqa: E501
@@ -3234,7 +3234,7 @@ class FakeApi:
raise ValueError(message)
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 : List[StrictStr], ioutil : List[StrictStr], http : List[StrictStr], url : List[StrictStr], context : List[StrictStr], allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> ApiResponse: # noqa: E501
"""test_query_parameter_collection_format # noqa: E501

View File

@@ -16,7 +16,7 @@ import re # noqa: F401
import io
import warnings
from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from pydantic import Field
from typing_extensions import Annotated
@@ -42,7 +42,7 @@ class FakeClassnameTags123Api:
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 @@ class FakeClassnameTags123Api:
raise ValueError(message)
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

View File

@@ -16,11 +16,11 @@ import re # noqa: F401
import io
import warnings
from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from pydantic import Field
from typing_extensions import Annotated
from pydantic import StrictBytes, StrictInt, StrictStr, validator
from pydantic import StrictBytes, StrictInt, StrictStr, field_validator
from typing import List, Optional, Union
@@ -47,7 +47,7 @@ class PetApi:
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
@@ -77,7 +77,7 @@ class PetApi:
raise ValueError(message)
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
@@ -188,7 +188,7 @@ class PetApi:
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
@@ -220,7 +220,7 @@ class PetApi:
raise ValueError(message)
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
@@ -330,7 +330,7 @@ class PetApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
def find_pets_by_status(self, status : Annotated[List[StrictStr], Field(description="Status values that need to be considered for filter")], **kwargs) -> List[Pet]: # noqa: E501
"""Finds Pets by status # noqa: E501
@@ -360,7 +360,7 @@ class PetApi:
raise ValueError(message)
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[List[StrictStr], Field(description="Status values that need to be considered for filter")], **kwargs) -> ApiResponse: # noqa: E501
"""Finds Pets by status # noqa: E501
@@ -472,7 +472,7 @@ class PetApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
def find_pets_by_tags(self, tags : Annotated[List[StrictStr], Field(description="Tags to filter by")], **kwargs) -> List[Pet]: # noqa: E501
"""(Deprecated) Finds Pets by tags # noqa: E501
@@ -502,7 +502,7 @@ class PetApi:
raise ValueError(message)
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[List[StrictStr], Field(description="Tags to filter by")], **kwargs) -> ApiResponse: # noqa: E501
"""(Deprecated) Finds Pets by tags # noqa: E501
@@ -616,7 +616,7 @@ class PetApi:
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
@@ -646,7 +646,7 @@ class PetApi:
raise ValueError(message)
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
@@ -758,7 +758,7 @@ class PetApi:
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
@@ -788,7 +788,7 @@ class PetApi:
raise ValueError(message)
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
@@ -899,7 +899,7 @@ class PetApi:
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
@@ -933,7 +933,7 @@ class PetApi:
raise ValueError(message)
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
@@ -1056,7 +1056,7 @@ class PetApi:
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
@@ -1090,7 +1090,7 @@ class PetApi:
raise ValueError(message)
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
@@ -1219,7 +1219,7 @@ class PetApi:
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
@@ -1253,7 +1253,7 @@ class PetApi:
raise ValueError(message)
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

View File

@@ -16,7 +16,7 @@ import re # noqa: F401
import io
import warnings
from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from pydantic import Field
from typing_extensions import Annotated
@@ -46,7 +46,7 @@ class StoreApi:
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
@@ -76,7 +76,7 @@ class StoreApi:
raise ValueError(message)
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
@@ -180,7 +180,7 @@ class StoreApi:
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
@@ -208,7 +208,7 @@ class StoreApi:
raise ValueError(message)
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
@@ -312,7 +312,7 @@ class StoreApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
def get_order_by_id(self, order_id : Annotated[int, Field(le=5, strict=True, ge=1, description="ID of pet that needs to be fetched")], **kwargs) -> Order: # noqa: E501
"""Find purchase order by ID # noqa: E501
@@ -342,7 +342,7 @@ class StoreApi:
raise ValueError(message)
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[int, Field(le=5, strict=True, ge=1, description="ID of pet that needs to be fetched")], **kwargs) -> ApiResponse: # noqa: E501
"""Find purchase order by ID # noqa: E501
@@ -454,7 +454,7 @@ class StoreApi:
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
@@ -484,7 +484,7 @@ class StoreApi:
raise ValueError(message)
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

View File

@@ -16,7 +16,7 @@ import re # noqa: F401
import io
import warnings
from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from pydantic import Field
from typing_extensions import Annotated
@@ -46,7 +46,7 @@ class UserApi:
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
@@ -76,7 +76,7 @@ class UserApi:
raise ValueError(message)
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
@@ -202,7 +202,7 @@ class UserApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
def create_users_with_array_input(self, user : Annotated[List[User], Field(description="List of user object")], **kwargs) -> None: # noqa: E501
"""Creates list of users with given input array # noqa: E501
@@ -232,7 +232,7 @@ class UserApi:
raise ValueError(message)
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[List[User], Field(description="List of user object")], **kwargs) -> ApiResponse: # noqa: E501
"""Creates list of users with given input array # noqa: E501
@@ -343,7 +343,7 @@ class UserApi:
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))
@validate_arguments
@validate_call
def create_users_with_list_input(self, user : Annotated[List[User], Field(description="List of user object")], **kwargs) -> None: # noqa: E501
"""Creates list of users with given input array # noqa: E501
@@ -373,7 +373,7 @@ class UserApi:
raise ValueError(message)
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[List[User], Field(description="List of user object")], **kwargs) -> ApiResponse: # noqa: E501
"""Creates list of users with given input array # noqa: E501
@@ -484,7 +484,7 @@ class UserApi:
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
@@ -514,7 +514,7 @@ class UserApi:
raise ValueError(message)
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
@@ -618,7 +618,7 @@ class UserApi:
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
@@ -648,7 +648,7 @@ class UserApi:
raise ValueError(message)
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
@@ -760,7 +760,7 @@ class UserApi:
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
@@ -792,7 +792,7 @@ class UserApi:
raise ValueError(message)
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
@@ -909,7 +909,7 @@ class UserApi:
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
@@ -937,7 +937,7 @@ class UserApi:
raise ValueError(message)
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
@@ -1035,7 +1035,7 @@ class UserApi:
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
@@ -1067,7 +1067,7 @@ class UserApi:
raise ValueError(message)
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

View File

@@ -29,14 +29,15 @@ class AdditionalPropertiesAnyType(BaseModel):
additional_properties: Dict[str, Any] = {}
__properties = ["name"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class AdditionalPropertiesAnyType(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
@@ -69,9 +70,9 @@ class AdditionalPropertiesAnyType(BaseModel):
return None
if not isinstance(obj, dict):
return AdditionalPropertiesAnyType.parse_obj(obj)
return AdditionalPropertiesAnyType.model_validate(obj)
_obj = AdditionalPropertiesAnyType.parse_obj({
_obj = AdditionalPropertiesAnyType.model_validate({
"name": obj.get("name")
})
# store additional fields in additional_properties

View File

@@ -30,14 +30,15 @@ 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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -51,7 +52,7 @@ class AdditionalPropertiesClass(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
@@ -70,9 +71,9 @@ class AdditionalPropertiesClass(BaseModel):
return None
if not isinstance(obj, dict):
return AdditionalPropertiesClass.parse_obj(obj)
return AdditionalPropertiesClass.model_validate(obj)
_obj = AdditionalPropertiesClass.parse_obj({
_obj = AdditionalPropertiesClass.model_validate({
"map_property": obj.get("map_property"),
"map_of_map_property": obj.get("map_of_map_property")
})

View File

@@ -29,14 +29,15 @@ class AdditionalPropertiesObject(BaseModel):
additional_properties: Dict[str, Any] = {}
__properties = ["name"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class AdditionalPropertiesObject(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
@@ -69,9 +70,9 @@ class AdditionalPropertiesObject(BaseModel):
return None
if not isinstance(obj, dict):
return AdditionalPropertiesObject.parse_obj(obj)
return AdditionalPropertiesObject.model_validate(obj)
_obj = AdditionalPropertiesObject.parse_obj({
_obj = AdditionalPropertiesObject.model_validate({
"name": obj.get("name")
})
# store additional fields in additional_properties

View File

@@ -29,14 +29,15 @@ class AdditionalPropertiesWithDescriptionOnly(BaseModel):
additional_properties: Dict[str, Any] = {}
__properties = ["name"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -50,7 +51,7 @@ class AdditionalPropertiesWithDescriptionOnly(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
@@ -69,9 +70,9 @@ class AdditionalPropertiesWithDescriptionOnly(BaseModel):
return None
if not isinstance(obj, dict):
return AdditionalPropertiesWithDescriptionOnly.parse_obj(obj)
return AdditionalPropertiesWithDescriptionOnly.model_validate(obj)
_obj = AdditionalPropertiesWithDescriptionOnly.parse_obj({
_obj = AdditionalPropertiesWithDescriptionOnly.model_validate({
"name": obj.get("name")
})
# store additional fields in additional_properties

View File

@@ -32,14 +32,15 @@ class AllOfWithSingleRef(BaseModel):
additional_properties: Dict[str, Any] = {}
__properties = ["username", "SingleRefType"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -53,7 +54,7 @@ class AllOfWithSingleRef(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
@@ -72,9 +73,9 @@ class AllOfWithSingleRef(BaseModel):
return None
if not isinstance(obj, dict):
return AllOfWithSingleRef.parse_obj(obj)
return AllOfWithSingleRef.model_validate(obj)
_obj = AllOfWithSingleRef.parse_obj({
_obj = AllOfWithSingleRef.model_validate({
"username": obj.get("username"),
"SingleRefType": obj.get("SingleRefType")
})

View File

@@ -31,10 +31,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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
# JSON field name that stores the object type
__discriminator_property_name = 'className'
@@ -56,7 +57,7 @@ class Animal(BaseModel):
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -70,7 +71,7 @@ class Animal(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},

View File

@@ -19,7 +19,7 @@ import pprint
import re # noqa: F401
from typing import List, Optional
from pydantic import BaseModel, Field, StrictStr, ValidationError, validator
from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from pydantic import Field
from typing_extensions import Annotated
from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict
@@ -34,9 +34,9 @@ class AnyOfColor(BaseModel):
"""
# data type: List[int]
anyof_schema_1_validator: Optional[Annotated[List[Annotated[int, Field(le=255, strict=True, ge=0)]], Field(min_items=3, max_items=3)]] = Field(default=None, description="RGB three element array with values 0-255.")
anyof_schema_1_validator: Optional[Annotated[List[Annotated[int, Field(le=255, strict=True, ge=0)]], Field(min_length=3, max_length=3)]] = Field(default=None, description="RGB three element array with values 0-255.")
# data type: List[int]
anyof_schema_2_validator: Optional[Annotated[List[Annotated[int, Field(le=255, strict=True, ge=0)]], Field(min_items=4, max_items=4)]] = Field(default=None, description="RGBA four element array with values 0-255.")
anyof_schema_2_validator: Optional[Annotated[List[Annotated[int, Field(le=255, strict=True, ge=0)]], Field(min_length=4, max_length=4)]] = Field(default=None, description="RGBA four element array with values 0-255.")
# data type: str
anyof_schema_3_validator: Optional[Annotated[str, Field(min_length=7, strict=True, max_length=7)]] = Field(default=None, description="Hex color string, such as #00FF00.")
if TYPE_CHECKING:
@@ -45,8 +45,9 @@ class AnyOfColor(BaseModel):
actual_instance: Any = None
any_of_schemas: List[str] = Literal[ANYOFCOLOR_ANY_OF_SCHEMAS]
class Config:
validate_assignment = True
model_config = {
"validate_assignment": True
}
def __init__(self, *args, **kwargs) -> None:
if args:
@@ -58,9 +59,9 @@ class AnyOfColor(BaseModel):
else:
super().__init__(**kwargs)
@validator('actual_instance')
@field_validator('actual_instance')
def actual_instance_must_validate_anyof(cls, v):
instance = AnyOfColor.construct()
instance = AnyOfColor.model_construct()
error_messages = []
# validate data type: List[int]
try:
@@ -93,7 +94,7 @@ class AnyOfColor(BaseModel):
@classmethod
def from_json(cls, json_str: str) -> AnyOfColor:
"""Returns the object represented by the json string"""
instance = AnyOfColor.construct()
instance = AnyOfColor.model_construct()
error_messages = []
# deserialize data into List[int]
try:
@@ -153,6 +154,6 @@ class AnyOfColor(BaseModel):
def to_str(self) -> str:
"""Returns the string representation of the actual instance"""
return pprint.pformat(self.dict())
return pprint.pformat(self.model_dump())

View File

@@ -19,7 +19,7 @@ import pprint
import re # noqa: F401
from typing import Optional
from pydantic import BaseModel, Field, StrictStr, ValidationError, validator
from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from petstore_api.models.basque_pig import BasquePig
from petstore_api.models.danish_pig import DanishPig
from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict
@@ -43,8 +43,9 @@ class AnyOfPig(BaseModel):
actual_instance: Any = None
any_of_schemas: List[str] = Literal[ANYOFPIG_ANY_OF_SCHEMAS]
class Config:
validate_assignment = True
model_config = {
"validate_assignment": True
}
def __init__(self, *args, **kwargs) -> None:
if args:
@@ -56,9 +57,9 @@ class AnyOfPig(BaseModel):
else:
super().__init__(**kwargs)
@validator('actual_instance')
@field_validator('actual_instance')
def actual_instance_must_validate_anyof(cls, v):
instance = AnyOfPig.construct()
instance = AnyOfPig.model_construct()
error_messages = []
# validate data type: BasquePig
if not isinstance(v, BasquePig):
@@ -85,7 +86,7 @@ class AnyOfPig(BaseModel):
@classmethod
def from_json(cls, json_str: str) -> AnyOfPig:
"""Returns the object represented by the json string"""
instance = AnyOfPig.construct()
instance = AnyOfPig.model_construct()
error_messages = []
# anyof_schema_1_validator: Optional[BasquePig] = None
try:
@@ -130,6 +131,6 @@ class AnyOfPig(BaseModel):
def to_str(self) -> str:
"""Returns the string representation of the actual instance"""
return pprint.pformat(self.dict())
return pprint.pformat(self.model_dump())

View File

@@ -31,14 +31,15 @@ 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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -52,7 +53,7 @@ class ApiResponse(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
@@ -71,9 +72,9 @@ class ApiResponse(BaseModel):
return None
if not isinstance(obj, dict):
return ApiResponse.parse_obj(obj)
return ApiResponse.model_validate(obj)
_obj = ApiResponse.parse_obj({
_obj = ApiResponse.model_validate({
"code": obj.get("code"),
"type": obj.get("type"),
"message": obj.get("message")

View File

@@ -30,14 +30,15 @@ class ArrayOfArrayOfModel(BaseModel):
additional_properties: Dict[str, Any] = {}
__properties = ["another_property"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -51,7 +52,7 @@ class ArrayOfArrayOfModel(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
@@ -79,9 +80,9 @@ class ArrayOfArrayOfModel(BaseModel):
return None
if not isinstance(obj, dict):
return ArrayOfArrayOfModel.parse_obj(obj)
return ArrayOfArrayOfModel.model_validate(obj)
_obj = ArrayOfArrayOfModel.parse_obj({
_obj = ArrayOfArrayOfModel.model_validate({
"another_property": [
[Tag.from_dict(_inner_item) for _inner_item in _item]
for _item in obj.get("another_property")

View File

@@ -30,14 +30,15 @@ class ArrayOfArrayOfNumberOnly(BaseModel):
additional_properties: Dict[str, Any] = {}
__properties = ["ArrayArrayNumber"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -51,7 +52,7 @@ class ArrayOfArrayOfNumberOnly(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
@@ -70,9 +71,9 @@ class ArrayOfArrayOfNumberOnly(BaseModel):
return None
if not isinstance(obj, dict):
return ArrayOfArrayOfNumberOnly.parse_obj(obj)
return ArrayOfArrayOfNumberOnly.model_validate(obj)
_obj = ArrayOfArrayOfNumberOnly.parse_obj({
_obj = ArrayOfArrayOfNumberOnly.model_validate({
"ArrayArrayNumber": obj.get("ArrayArrayNumber")
})
# store additional fields in additional_properties

View File

@@ -30,14 +30,15 @@ class ArrayOfNumberOnly(BaseModel):
additional_properties: Dict[str, Any] = {}
__properties = ["ArrayNumber"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -51,7 +52,7 @@ class ArrayOfNumberOnly(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
@@ -70,9 +71,9 @@ class ArrayOfNumberOnly(BaseModel):
return None
if not isinstance(obj, dict):
return ArrayOfNumberOnly.parse_obj(obj)
return ArrayOfNumberOnly.model_validate(obj)
_obj = ArrayOfNumberOnly.parse_obj({
_obj = ArrayOfNumberOnly.model_validate({
"ArrayNumber": obj.get("ArrayNumber")
})
# store additional fields in additional_properties

View File

@@ -28,20 +28,21 @@ class ArrayTest(BaseModel):
"""
ArrayTest
"""
array_of_string: Optional[Annotated[List[StrictStr], Field(min_items=0, max_items=3)]] = None
array_of_string: Optional[Annotated[List[StrictStr], Field(min_length=0, max_length=3)]] = None
array_array_of_integer: Optional[List[List[StrictInt]]] = None
array_array_of_model: Optional[List[List[ReadOnlyFirst]]] = None
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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -55,7 +56,7 @@ class ArrayTest(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
@@ -83,9 +84,9 @@ class ArrayTest(BaseModel):
return None
if not isinstance(obj, dict):
return ArrayTest.parse_obj(obj)
return ArrayTest.model_validate(obj)
_obj = ArrayTest.parse_obj({
_obj = ArrayTest.model_validate({
"array_of_string": obj.get("array_of_string"),
"array_array_of_integer": obj.get("array_array_of_integer"),
"array_array_of_model": [

View File

@@ -31,14 +31,15 @@ class BasquePig(BaseModel):
additional_properties: Dict[str, Any] = {}
__properties = ["className", "color"]
class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -52,7 +53,7 @@ class BasquePig(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
@@ -71,9 +72,9 @@ class BasquePig(BaseModel):
return None
if not isinstance(obj, dict):
return BasquePig.parse_obj(obj)
return BasquePig.model_validate(obj)
_obj = BasquePig.parse_obj({
_obj = BasquePig.model_validate({
"className": obj.get("className"),
"color": obj.get("color")
})

View File

@@ -35,14 +35,15 @@ 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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -56,7 +57,7 @@ class Capitalization(BaseModel):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
@@ -75,9 +76,9 @@ class Capitalization(BaseModel):
return None
if not isinstance(obj, dict):
return Capitalization.parse_obj(obj)
return Capitalization.model_validate(obj)
_obj = Capitalization.parse_obj({
_obj = Capitalization.model_validate({
"smallCamel": obj.get("smallCamel"),
"CapitalCamel": obj.get("CapitalCamel"),
"small_Snake": obj.get("small_Snake"),

View File

@@ -30,14 +30,15 @@ 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
model_config = {
"populate_by_name": True,
"validate_assignment": True
}
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.dict(by_alias=True))
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
@@ -51,7 +52,7 @@ class Cat(Animal):
def to_dict(self):
"""Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True,
_dict = self.model_dump(by_alias=True,
exclude={
"additional_properties"
},
@@ -70,9 +71,9 @@ class Cat(Animal):
return None
if not isinstance(obj, dict):
return Cat.parse_obj(obj)
return Cat.model_validate(obj)
_obj = Cat.parse_obj({
_obj = Cat.model_validate({
"className": obj.get("className"),
"color": obj.get("color") if obj.get("color") is not None else 'red',
"declawed": obj.get("declawed")

Some files were not shown because too many files have changed in this diff Show More