[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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
177 changed files with 1774 additions and 1611 deletions

View File

@ -911,13 +911,13 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
pydanticImports.add("Field"); pydanticImports.add("Field");
pydanticImports.add("StrictStr"); pydanticImports.add("StrictStr");
pydanticImports.add("ValidationError"); pydanticImports.add("ValidationError");
pydanticImports.add("validator"); pydanticImports.add("field_validator");
} else if (!model.anyOf.isEmpty()) { // anyOF } else if (!model.anyOf.isEmpty()) { // anyOF
codegenProperties = model.getComposedSchemas().getAnyOf(); codegenProperties = model.getComposedSchemas().getAnyOf();
pydanticImports.add("Field"); pydanticImports.add("Field");
pydanticImports.add("StrictStr"); pydanticImports.add("StrictStr");
pydanticImports.add("ValidationError"); pydanticImports.add("ValidationError");
pydanticImports.add("validator"); pydanticImports.add("field_validator");
} else { // typical model } else { // typical model
codegenProperties = model.vars; codegenProperties = model.vars;
@ -1768,10 +1768,10 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
private PythonType arrayType(IJsonSchemaValidationProperties cp) { private PythonType arrayType(IJsonSchemaValidationProperties cp) {
PythonType pt = new PythonType(); PythonType pt = new PythonType();
if (cp.getMaxItems() != null) { if (cp.getMaxItems() != null) {
pt.constrain("max_items", cp.getMaxItems()); pt.constrain("max_length", cp.getMaxItems());
} }
if (cp.getMinItems()!= null) { if (cp.getMinItems()!= null) {
pt.constrain("min_items", cp.getMinItems()); pt.constrain("min_length", cp.getMinItems());
} }
if (cp.getUniqueItems()) { if (cp.getUniqueItems()) {
// A unique "array" is a set // A unique "array" is a set
@ -1807,7 +1807,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
} }
if (cp.getPattern() != null) { if (cp.getPattern() != null) {
pydanticImports.add("validator"); pydanticImports.add("field_validator");
// use validator instead as regex doesn't support flags, e.g. IGNORECASE // use validator instead as regex doesn't support flags, e.g. IGNORECASE
//fieldCustomization.add(Locale.ROOT, String.format(Locale.ROOT, "regex=r'%s'", cp.getPattern())); //fieldCustomization.add(Locale.ROOT, String.format(Locale.ROOT, "regex=r'%s'", cp.getPattern()));
} }
@ -1938,7 +1938,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
strt.constrain("min_length", cp.getMinLength()); strt.constrain("min_length", cp.getMinLength());
} }
if (cp.getPattern() != null) { if (cp.getPattern() != null) {
pydanticImports.add("validator"); pydanticImports.add("field_validator");
// use validator instead as regex doesn't support flags, e.g. IGNORECASE // use validator instead as regex doesn't support flags, e.g. IGNORECASE
//fieldCustomization.add(Locale.ROOT, String.format(Locale.ROOT, "regex=r'%s'", cp.getPattern())); //fieldCustomization.add(Locale.ROOT, String.format(Locale.ROOT, "regex=r'%s'", cp.getPattern()));
} }
@ -2042,7 +2042,7 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co
} }
if (cp.getIsEnum()) { if (cp.getIsEnum()) {
pydanticImports.add("validator"); pydanticImports.add("field_validator");
} }
if (cp.getIsArray()) { if (cp.getIsArray()) {

View File

@ -6,7 +6,7 @@ import re # noqa: F401
import io import io
import warnings import warnings
from pydantic import validate_arguments, ValidationError from pydantic import validate_call, ValidationError
{{#imports}} {{#imports}}
{{import}} {{import}}
@ -34,7 +34,7 @@ class {{classname}}:
self.api_client = api_client self.api_client = api_client
{{#operation}} {{#operation}}
@validate_arguments @validate_call
{{#asyncio}} {{#asyncio}}
async def {{operationId}}(self, {{#allParams}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/allParams}}**kwargs) -> {{{returnType}}}{{^returnType}}None{{/returnType}}: # noqa: E501 async def {{operationId}}(self, {{#allParams}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/allParams}}**kwargs) -> {{{returnType}}}{{^returnType}}None{{/returnType}}: # noqa: E501
{{/asyncio}} {{/asyncio}}
@ -77,7 +77,7 @@ class {{classname}}:
raise ValueError(message) raise ValueError(message)
return {{#asyncio}}await {{/asyncio}}self.{{operationId}}_with_http_info({{#allParams}}{{paramName}}, {{/allParams}}**kwargs) # noqa: E501 return {{#asyncio}}await {{/asyncio}}self.{{operationId}}_with_http_info({{#allParams}}{{paramName}}, {{/allParams}}**kwargs) # noqa: E501
@validate_arguments @validate_call
{{#asyncio}} {{#asyncio}}
async def {{operationId}}_with_http_info(self, {{#allParams}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/allParams}}**kwargs) -> ApiResponse: # noqa: E501 async def {{operationId}}_with_http_info(self, {{#allParams}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/allParams}}**kwargs) -> ApiResponse: # noqa: E501
{{/asyncio}} {{/asyncio}}

View File

@ -33,8 +33,9 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
actual_instance: Any = None actual_instance: Any = None
any_of_schemas: List[str] = Literal[{{#lambda.uppercase}}{{{classname}}}{{/lambda.uppercase}}_ANY_OF_SCHEMAS] any_of_schemas: List[str] = Literal[{{#lambda.uppercase}}{{{classname}}}{{/lambda.uppercase}}_ANY_OF_SCHEMAS]
class Config: model_config = {
validate_assignment = True "validate_assignment": True
}
{{#discriminator}} {{#discriminator}}
discriminator_value_class_map: Dict[str, str] = { discriminator_value_class_map: Dict[str, str] = {
@ -54,14 +55,14 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
else: else:
super().__init__(**kwargs) super().__init__(**kwargs)
@validator('actual_instance') @field_validator('actual_instance')
def actual_instance_must_validate_anyof(cls, v): def actual_instance_must_validate_anyof(cls, v):
{{#isNullable}} {{#isNullable}}
if v is None: if v is None:
return v return v
{{/isNullable}} {{/isNullable}}
instance = {{{classname}}}.construct() instance = {{{classname}}}.model_construct()
error_messages = [] error_messages = []
{{#composedSchemas.anyOf}} {{#composedSchemas.anyOf}}
# validate data type: {{{dataType}}} # validate data type: {{{dataType}}}
@ -102,7 +103,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
@classmethod @classmethod
def from_json(cls, json_str: str) -> {{{classname}}}: def from_json(cls, json_str: str) -> {{{classname}}}:
"""Returns the object represented by the json string""" """Returns the object represented by the json string"""
instance = {{{classname}}}.construct() instance = {{{classname}}}.model_construct()
{{#isNullable}} {{#isNullable}}
if json_str is None: if json_str is None:
return instance return instance
@ -174,7 +175,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the actual instance""" """Returns the string representation of the actual instance"""
return pprint.pformat(self.dict()) return pprint.pformat(self.model_dump())
{{#vendorExtensions.x-py-postponed-model-imports.size}} {{#vendorExtensions.x-py-postponed-model-imports.size}}
{{#vendorExtensions.x-py-postponed-model-imports}} {{#vendorExtensions.x-py-postponed-model-imports}}

View File

@ -27,7 +27,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
{{#vars}} {{#vars}}
{{#vendorExtensions.x-regex}} {{#vendorExtensions.x-regex}}
@validator('{{{name}}}') @field_validator('{{{name}}}')
def {{{name}}}_validate_regular_expression(cls, value): def {{{name}}}_validate_regular_expression(cls, value):
"""Validates the regular expression""" """Validates the regular expression"""
{{^required}} {{^required}}
@ -48,7 +48,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
{{/vendorExtensions.x-regex}} {{/vendorExtensions.x-regex}}
{{#isEnum}} {{#isEnum}}
@validator('{{{name}}}') @field_validator('{{{name}}}')
def {{{name}}}_validate_enum(cls, value): def {{{name}}}_validate_enum(cls, value):
"""Validates the enum""" """Validates the enum"""
{{^required}} {{^required}}
@ -76,10 +76,11 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
{{/isEnum}} {{/isEnum}}
{{/vars}} {{/vars}}
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
{{#hasChildren}} {{#hasChildren}}
{{#discriminator}} {{#discriminator}}
@ -110,7 +111,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
{{/hasChildren}} {{/hasChildren}}
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -124,7 +125,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
{{#vendorExtensions.x-py-readonly}} {{#vendorExtensions.x-py-readonly}}
"{{{.}}}", "{{{.}}}",
@ -211,8 +212,8 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
{{#allVars}} {{#allVars}}
{{#isNullable}} {{#isNullable}}
# set to None if {{{name}}} (nullable) is None # set to None if {{{name}}} (nullable) is None
# and __fields_set__ contains the field # and model_fields_set contains the field
if self.{{name}} is None and "{{{name}}}" in self.__fields_set__: if self.{{name}} is None and "{{{name}}}" in self.model_fields_set:
_dict['{{{baseName}}}'] = None _dict['{{{baseName}}}'] = None
{{/isNullable}} {{/isNullable}}
@ -240,7 +241,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
return None return None
if not isinstance(obj, dict): if not isinstance(obj, dict):
return {{{classname}}}.parse_obj(obj) return {{{classname}}}.model_validate(obj)
{{#disallowAdditionalPropertiesIfNotPresent}} {{#disallowAdditionalPropertiesIfNotPresent}}
{{^isAdditionalPropertiesTrue}} {{^isAdditionalPropertiesTrue}}
@ -251,7 +252,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
{{/isAdditionalPropertiesTrue}} {{/isAdditionalPropertiesTrue}}
{{/disallowAdditionalPropertiesIfNotPresent}} {{/disallowAdditionalPropertiesIfNotPresent}}
_obj = {{{classname}}}.parse_obj({ _obj = {{{classname}}}.model_validate({
{{#allVars}} {{#allVars}}
{{#isContainer}} {{#isContainer}}
{{#isArray}} {{#isArray}}

View File

@ -27,10 +27,12 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
{{vendorExtensions.x-py-name}}: {{{vendorExtensions.x-py-typing}}} {{vendorExtensions.x-py-name}}: {{{vendorExtensions.x-py-typing}}}
{{/composedSchemas.oneOf}} {{/composedSchemas.oneOf}}
actual_instance: Optional[Union[{{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}]] = None actual_instance: Optional[Union[{{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}]] = None
one_of_schemas: List[str] = Literal[{{#lambda.uppercase}}{{{classname}}}{{/lambda.uppercase}}_ONE_OF_SCHEMAS] one_of_schemas: List[str] = Literal[{{#oneOf}}"{{.}}"{{^-last}}, {{/-last}}{{/oneOf}}]
model_config = {
"validate_assignment": True
}
class Config:
validate_assignment = True
{{#discriminator}} {{#discriminator}}
discriminator_value_class_map: Dict[str, str] = { discriminator_value_class_map: Dict[str, str] = {
@ -50,14 +52,14 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
else: else:
super().__init__(**kwargs) super().__init__(**kwargs)
@validator('actual_instance') @field_validator('actual_instance')
def actual_instance_must_validate_oneof(cls, v): def actual_instance_must_validate_oneof(cls, v):
{{#isNullable}} {{#isNullable}}
if v is None: if v is None:
return v return v
{{/isNullable}} {{/isNullable}}
instance = {{{classname}}}.construct() instance = {{{classname}}}.model_construct()
error_messages = [] error_messages = []
match = 0 match = 0
{{#composedSchemas.oneOf}} {{#composedSchemas.oneOf}}
@ -101,7 +103,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
@classmethod @classmethod
def from_json(cls, json_str: str) -> {{{classname}}}: def from_json(cls, json_str: str) -> {{{classname}}}:
"""Returns the object represented by the json string""" """Returns the object represented by the json string"""
instance = {{{classname}}}.construct() instance = {{{classname}}}.model_construct()
{{#isNullable}} {{#isNullable}}
if json_str is None: if json_str is None:
return instance return instance
@ -197,7 +199,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the actual instance""" """Returns the string representation of the actual instance"""
return pprint.pformat(self.dict()) return pprint.pformat(self.model_dump())
{{#vendorExtensions.x-py-postponed-model-imports.size}} {{#vendorExtensions.x-py-postponed-model-imports.size}}
{{#vendorExtensions.x-py-postponed-model-imports}} {{#vendorExtensions.x-py-postponed-model-imports}}

View File

@ -17,7 +17,7 @@ import re # noqa: F401
import io import io
import warnings import warnings
from pydantic import validate_arguments, ValidationError from pydantic import validate_call, ValidationError
from openapi_client.api_client import ApiClient from openapi_client.api_client import ApiClient
@ -40,7 +40,7 @@ class AuthApi:
api_client = ApiClient.get_default() api_client = ApiClient.get_default()
self.api_client = api_client self.api_client = api_client
@validate_arguments @validate_call
def test_auth_http_basic(self, **kwargs) -> str: # noqa: E501 def test_auth_http_basic(self, **kwargs) -> str: # noqa: E501
"""To test HTTP basic authentication # noqa: E501 """To test HTTP basic authentication # noqa: E501
@ -68,7 +68,7 @@ class AuthApi:
raise ValueError(message) raise ValueError(message)
return self.test_auth_http_basic_with_http_info(**kwargs) # noqa: E501 return self.test_auth_http_basic_with_http_info(**kwargs) # noqa: E501
@validate_arguments @validate_call
def test_auth_http_basic_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 def test_auth_http_basic_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501
"""To test HTTP basic authentication # noqa: E501 """To test HTTP basic authentication # noqa: E501

View File

@ -17,7 +17,7 @@ import re # noqa: F401
import io import io
import warnings import warnings
from pydantic import validate_arguments, ValidationError from pydantic import validate_call, ValidationError
from pydantic import Field from pydantic import Field
from typing_extensions import Annotated from typing_extensions import Annotated
@ -48,7 +48,7 @@ class BodyApi:
api_client = ApiClient.get_default() api_client = ApiClient.get_default()
self.api_client = api_client self.api_client = api_client
@validate_arguments @validate_call
def test_binary_gif(self, **kwargs) -> bytearray: # noqa: E501 def test_binary_gif(self, **kwargs) -> bytearray: # noqa: E501
"""Test binary (gif) response body # noqa: E501 """Test binary (gif) response body # noqa: E501
@ -76,7 +76,7 @@ class BodyApi:
raise ValueError(message) raise ValueError(message)
return self.test_binary_gif_with_http_info(**kwargs) # noqa: E501 return self.test_binary_gif_with_http_info(**kwargs) # noqa: E501
@validate_arguments @validate_call
def test_binary_gif_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 def test_binary_gif_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501
"""Test binary (gif) response body # noqa: E501 """Test binary (gif) response body # noqa: E501
@ -180,7 +180,7 @@ class BodyApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _request_auth=_params.get('_request_auth'))
@validate_arguments @validate_call
def test_body_application_octetstream_binary(self, body : Optional[Union[StrictBytes, StrictStr]] = None, **kwargs) -> str: # noqa: E501 def test_body_application_octetstream_binary(self, body : Optional[Union[StrictBytes, StrictStr]] = None, **kwargs) -> str: # noqa: E501
"""Test body parameter(s) # noqa: E501 """Test body parameter(s) # noqa: E501
@ -210,7 +210,7 @@ class BodyApi:
raise ValueError(message) raise ValueError(message)
return self.test_body_application_octetstream_binary_with_http_info(body, **kwargs) # noqa: E501 return self.test_body_application_octetstream_binary_with_http_info(body, **kwargs) # noqa: E501
@validate_arguments @validate_call
def test_body_application_octetstream_binary_with_http_info(self, body : Optional[Union[StrictBytes, StrictStr]] = None, **kwargs) -> ApiResponse: # noqa: E501 def test_body_application_octetstream_binary_with_http_info(self, body : Optional[Union[StrictBytes, StrictStr]] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test body parameter(s) # noqa: E501 """Test body parameter(s) # noqa: E501
@ -332,7 +332,7 @@ class BodyApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _request_auth=_params.get('_request_auth'))
@validate_arguments @validate_call
def test_body_multipart_formdata_array_of_binary(self, files : List[Union[StrictBytes, StrictStr]], **kwargs) -> str: # noqa: E501 def test_body_multipart_formdata_array_of_binary(self, files : List[Union[StrictBytes, StrictStr]], **kwargs) -> str: # noqa: E501
"""Test array of binary in multipart mime # noqa: E501 """Test array of binary in multipart mime # noqa: E501
@ -362,7 +362,7 @@ class BodyApi:
raise ValueError(message) raise ValueError(message)
return self.test_body_multipart_formdata_array_of_binary_with_http_info(files, **kwargs) # noqa: E501 return self.test_body_multipart_formdata_array_of_binary_with_http_info(files, **kwargs) # noqa: E501
@validate_arguments @validate_call
def test_body_multipart_formdata_array_of_binary_with_http_info(self, files : List[Union[StrictBytes, StrictStr]], **kwargs) -> ApiResponse: # noqa: E501 def test_body_multipart_formdata_array_of_binary_with_http_info(self, files : List[Union[StrictBytes, StrictStr]], **kwargs) -> ApiResponse: # noqa: E501
"""Test array of binary in multipart mime # noqa: E501 """Test array of binary in multipart mime # noqa: E501
@ -480,7 +480,7 @@ class BodyApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _request_auth=_params.get('_request_auth'))
@validate_arguments @validate_call
def test_echo_body_free_form_object_response_string(self, body : Annotated[Optional[Dict[str, Any]], Field(description="Free form object")] = None, **kwargs) -> str: # noqa: E501 def test_echo_body_free_form_object_response_string(self, body : Annotated[Optional[Dict[str, Any]], Field(description="Free form object")] = None, **kwargs) -> str: # noqa: E501
"""Test free form object # noqa: E501 """Test free form object # noqa: E501
@ -510,7 +510,7 @@ class BodyApi:
raise ValueError(message) raise ValueError(message)
return self.test_echo_body_free_form_object_response_string_with_http_info(body, **kwargs) # noqa: E501 return self.test_echo_body_free_form_object_response_string_with_http_info(body, **kwargs) # noqa: E501
@validate_arguments @validate_call
def test_echo_body_free_form_object_response_string_with_http_info(self, body : Annotated[Optional[Dict[str, Any]], Field(description="Free form object")] = None, **kwargs) -> ApiResponse: # noqa: E501 def test_echo_body_free_form_object_response_string_with_http_info(self, body : Annotated[Optional[Dict[str, Any]], Field(description="Free form object")] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test free form object # noqa: E501 """Test free form object # noqa: E501
@ -627,7 +627,7 @@ class BodyApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _request_auth=_params.get('_request_auth'))
@validate_arguments @validate_call
def test_echo_body_pet(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> Pet: # noqa: E501 def test_echo_body_pet(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> Pet: # noqa: E501
"""Test body parameter(s) # noqa: E501 """Test body parameter(s) # noqa: E501
@ -657,7 +657,7 @@ class BodyApi:
raise ValueError(message) raise ValueError(message)
return self.test_echo_body_pet_with_http_info(pet, **kwargs) # noqa: E501 return self.test_echo_body_pet_with_http_info(pet, **kwargs) # noqa: E501
@validate_arguments @validate_call
def test_echo_body_pet_with_http_info(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> ApiResponse: # noqa: E501 def test_echo_body_pet_with_http_info(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test body parameter(s) # noqa: E501 """Test body parameter(s) # noqa: E501
@ -774,7 +774,7 @@ class BodyApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _request_auth=_params.get('_request_auth'))
@validate_arguments @validate_call
def test_echo_body_pet_response_string(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> str: # noqa: E501 def test_echo_body_pet_response_string(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> str: # noqa: E501
"""Test empty response body # noqa: E501 """Test empty response body # noqa: E501
@ -804,7 +804,7 @@ class BodyApi:
raise ValueError(message) raise ValueError(message)
return self.test_echo_body_pet_response_string_with_http_info(pet, **kwargs) # noqa: E501 return self.test_echo_body_pet_response_string_with_http_info(pet, **kwargs) # noqa: E501
@validate_arguments @validate_call
def test_echo_body_pet_response_string_with_http_info(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> ApiResponse: # noqa: E501 def test_echo_body_pet_response_string_with_http_info(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test empty response body # noqa: E501 """Test empty response body # noqa: E501
@ -921,7 +921,7 @@ class BodyApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _request_auth=_params.get('_request_auth'))
@validate_arguments @validate_call
def test_echo_body_tag_response_string(self, tag : Annotated[Optional[Tag], Field(description="Tag object")] = None, **kwargs) -> str: # noqa: E501 def test_echo_body_tag_response_string(self, tag : Annotated[Optional[Tag], Field(description="Tag object")] = None, **kwargs) -> str: # noqa: E501
"""Test empty json (request body) # noqa: E501 """Test empty json (request body) # noqa: E501
@ -951,7 +951,7 @@ class BodyApi:
raise ValueError(message) raise ValueError(message)
return self.test_echo_body_tag_response_string_with_http_info(tag, **kwargs) # noqa: E501 return self.test_echo_body_tag_response_string_with_http_info(tag, **kwargs) # noqa: E501
@validate_arguments @validate_call
def test_echo_body_tag_response_string_with_http_info(self, tag : Annotated[Optional[Tag], Field(description="Tag object")] = None, **kwargs) -> ApiResponse: # noqa: E501 def test_echo_body_tag_response_string_with_http_info(self, tag : Annotated[Optional[Tag], Field(description="Tag object")] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test empty json (request body) # noqa: E501 """Test empty json (request body) # noqa: E501

View File

@ -17,7 +17,7 @@ import re # noqa: F401
import io import io
import warnings import warnings
from pydantic import validate_arguments, ValidationError from pydantic import validate_call, ValidationError
from pydantic import StrictBool, StrictInt, StrictStr from pydantic import StrictBool, StrictInt, StrictStr
@ -44,7 +44,7 @@ class FormApi:
api_client = ApiClient.get_default() api_client = ApiClient.get_default()
self.api_client = api_client self.api_client = api_client
@validate_arguments @validate_call
def test_form_integer_boolean_string(self, integer_form : Optional[StrictInt] = None, boolean_form : Optional[StrictBool] = None, string_form : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501 def test_form_integer_boolean_string(self, integer_form : Optional[StrictInt] = None, boolean_form : Optional[StrictBool] = None, string_form : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501
"""Test form parameter(s) # noqa: E501 """Test form parameter(s) # noqa: E501
@ -78,7 +78,7 @@ class FormApi:
raise ValueError(message) raise ValueError(message)
return self.test_form_integer_boolean_string_with_http_info(integer_form, boolean_form, string_form, **kwargs) # noqa: E501 return self.test_form_integer_boolean_string_with_http_info(integer_form, boolean_form, string_form, **kwargs) # noqa: E501
@validate_arguments @validate_call
def test_form_integer_boolean_string_with_http_info(self, integer_form : Optional[StrictInt] = None, boolean_form : Optional[StrictBool] = None, string_form : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 def test_form_integer_boolean_string_with_http_info(self, integer_form : Optional[StrictInt] = None, boolean_form : Optional[StrictBool] = None, string_form : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test form parameter(s) # noqa: E501 """Test form parameter(s) # noqa: E501
@ -207,7 +207,7 @@ class FormApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _request_auth=_params.get('_request_auth'))
@validate_arguments @validate_call
def test_form_oneof(self, form1 : Optional[StrictStr] = None, form2 : Optional[StrictInt] = None, form3 : Optional[StrictStr] = None, form4 : Optional[StrictBool] = None, id : Optional[StrictInt] = None, name : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501 def test_form_oneof(self, form1 : Optional[StrictStr] = None, form2 : Optional[StrictInt] = None, form3 : Optional[StrictStr] = None, form4 : Optional[StrictBool] = None, id : Optional[StrictInt] = None, name : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501
"""Test form parameter(s) for oneOf schema # noqa: E501 """Test form parameter(s) for oneOf schema # noqa: E501
@ -247,7 +247,7 @@ class FormApi:
raise ValueError(message) raise ValueError(message)
return self.test_form_oneof_with_http_info(form1, form2, form3, form4, id, name, **kwargs) # noqa: E501 return self.test_form_oneof_with_http_info(form1, form2, form3, form4, id, name, **kwargs) # noqa: E501
@validate_arguments @validate_call
def test_form_oneof_with_http_info(self, form1 : Optional[StrictStr] = None, form2 : Optional[StrictInt] = None, form3 : Optional[StrictStr] = None, form4 : Optional[StrictBool] = None, id : Optional[StrictInt] = None, name : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 def test_form_oneof_with_http_info(self, form1 : Optional[StrictStr] = None, form2 : Optional[StrictInt] = None, form3 : Optional[StrictStr] = None, form4 : Optional[StrictBool] = None, id : Optional[StrictInt] = None, name : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test form parameter(s) for oneOf schema # noqa: E501 """Test form parameter(s) for oneOf schema # noqa: E501

View File

@ -17,7 +17,7 @@ import re # noqa: F401
import io import io
import warnings import warnings
from pydantic import validate_arguments, ValidationError from pydantic import validate_call, ValidationError
from pydantic import StrictBool, StrictInt, StrictStr from pydantic import StrictBool, StrictInt, StrictStr
@ -44,7 +44,7 @@ class HeaderApi:
api_client = ApiClient.get_default() api_client = ApiClient.get_default()
self.api_client = api_client self.api_client = api_client
@validate_arguments @validate_call
def test_header_integer_boolean_string(self, integer_header : Optional[StrictInt] = None, boolean_header : Optional[StrictBool] = None, string_header : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501 def test_header_integer_boolean_string(self, integer_header : Optional[StrictInt] = None, boolean_header : Optional[StrictBool] = None, string_header : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501
"""Test header parameter(s) # noqa: E501 """Test header parameter(s) # noqa: E501
@ -78,7 +78,7 @@ class HeaderApi:
raise ValueError(message) raise ValueError(message)
return self.test_header_integer_boolean_string_with_http_info(integer_header, boolean_header, string_header, **kwargs) # noqa: E501 return self.test_header_integer_boolean_string_with_http_info(integer_header, boolean_header, string_header, **kwargs) # noqa: E501
@validate_arguments @validate_call
def test_header_integer_boolean_string_with_http_info(self, integer_header : Optional[StrictInt] = None, boolean_header : Optional[StrictBool] = None, string_header : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 def test_header_integer_boolean_string_with_http_info(self, integer_header : Optional[StrictInt] = None, boolean_header : Optional[StrictBool] = None, string_header : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test header parameter(s) # noqa: E501 """Test header parameter(s) # noqa: E501

View File

@ -17,7 +17,7 @@ import re # noqa: F401
import io import io
import warnings import warnings
from pydantic import validate_arguments, ValidationError from pydantic import validate_call, ValidationError
from pydantic import StrictInt, StrictStr from pydantic import StrictInt, StrictStr
@ -42,7 +42,7 @@ class PathApi:
api_client = ApiClient.get_default() api_client = ApiClient.get_default()
self.api_client = api_client self.api_client = api_client
@validate_arguments @validate_call
def tests_path_string_path_string_integer_path_integer(self, path_string : StrictStr, path_integer : StrictInt, **kwargs) -> str: # noqa: E501 def tests_path_string_path_string_integer_path_integer(self, path_string : StrictStr, path_integer : StrictInt, **kwargs) -> str: # noqa: E501
"""Test path parameter(s) # noqa: E501 """Test path parameter(s) # noqa: E501
@ -74,7 +74,7 @@ class PathApi:
raise ValueError(message) raise ValueError(message)
return self.tests_path_string_path_string_integer_path_integer_with_http_info(path_string, path_integer, **kwargs) # noqa: E501 return self.tests_path_string_path_string_integer_path_integer_with_http_info(path_string, path_integer, **kwargs) # noqa: E501
@validate_arguments @validate_call
def tests_path_string_path_string_integer_path_integer_with_http_info(self, path_string : StrictStr, path_integer : StrictInt, **kwargs) -> ApiResponse: # noqa: E501 def tests_path_string_path_string_integer_path_integer_with_http_info(self, path_string : StrictStr, path_integer : StrictInt, **kwargs) -> ApiResponse: # noqa: E501
"""Test path parameter(s) # noqa: E501 """Test path parameter(s) # noqa: E501

View File

@ -17,7 +17,7 @@ import re # noqa: F401
import io import io
import warnings import warnings
from pydantic import validate_arguments, ValidationError from pydantic import validate_call, ValidationError
from datetime import date, datetime from datetime import date, datetime
@ -49,7 +49,7 @@ class QueryApi:
api_client = ApiClient.get_default() api_client = ApiClient.get_default()
self.api_client = api_client self.api_client = api_client
@validate_arguments @validate_call
def test_enum_ref_string(self, enum_ref_string_query : Optional[StringEnumRef] = None, **kwargs) -> str: # noqa: E501 def test_enum_ref_string(self, enum_ref_string_query : Optional[StringEnumRef] = None, **kwargs) -> str: # noqa: E501
"""Test query parameter(s) # noqa: E501 """Test query parameter(s) # noqa: E501
@ -79,7 +79,7 @@ class QueryApi:
raise ValueError(message) raise ValueError(message)
return self.test_enum_ref_string_with_http_info(enum_ref_string_query, **kwargs) # noqa: E501 return self.test_enum_ref_string_with_http_info(enum_ref_string_query, **kwargs) # noqa: E501
@validate_arguments @validate_call
def test_enum_ref_string_with_http_info(self, enum_ref_string_query : Optional[StringEnumRef] = None, **kwargs) -> ApiResponse: # noqa: E501 def test_enum_ref_string_with_http_info(self, enum_ref_string_query : Optional[StringEnumRef] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test query parameter(s) # noqa: E501 """Test query parameter(s) # noqa: E501
@ -189,7 +189,7 @@ class QueryApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _request_auth=_params.get('_request_auth'))
@validate_arguments @validate_call
def test_query_datetime_date_string(self, datetime_query : Optional[datetime] = None, date_query : Optional[date] = None, string_query : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501 def test_query_datetime_date_string(self, datetime_query : Optional[datetime] = None, date_query : Optional[date] = None, string_query : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501
"""Test query parameter(s) # noqa: E501 """Test query parameter(s) # noqa: E501
@ -223,7 +223,7 @@ class QueryApi:
raise ValueError(message) raise ValueError(message)
return self.test_query_datetime_date_string_with_http_info(datetime_query, date_query, string_query, **kwargs) # noqa: E501 return self.test_query_datetime_date_string_with_http_info(datetime_query, date_query, string_query, **kwargs) # noqa: E501
@validate_arguments @validate_call
def test_query_datetime_date_string_with_http_info(self, datetime_query : Optional[datetime] = None, date_query : Optional[date] = None, string_query : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 def test_query_datetime_date_string_with_http_info(self, datetime_query : Optional[datetime] = None, date_query : Optional[date] = None, string_query : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test query parameter(s) # noqa: E501 """Test query parameter(s) # noqa: E501
@ -351,7 +351,7 @@ class QueryApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _request_auth=_params.get('_request_auth'))
@validate_arguments @validate_call
def test_query_integer_boolean_string(self, integer_query : Optional[StrictInt] = None, boolean_query : Optional[StrictBool] = None, string_query : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501 def test_query_integer_boolean_string(self, integer_query : Optional[StrictInt] = None, boolean_query : Optional[StrictBool] = None, string_query : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501
"""Test query parameter(s) # noqa: E501 """Test query parameter(s) # noqa: E501
@ -385,7 +385,7 @@ class QueryApi:
raise ValueError(message) raise ValueError(message)
return self.test_query_integer_boolean_string_with_http_info(integer_query, boolean_query, string_query, **kwargs) # noqa: E501 return self.test_query_integer_boolean_string_with_http_info(integer_query, boolean_query, string_query, **kwargs) # noqa: E501
@validate_arguments @validate_call
def test_query_integer_boolean_string_with_http_info(self, integer_query : Optional[StrictInt] = None, boolean_query : Optional[StrictBool] = None, string_query : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501 def test_query_integer_boolean_string_with_http_info(self, integer_query : Optional[StrictInt] = None, boolean_query : Optional[StrictBool] = None, string_query : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test query parameter(s) # noqa: E501 """Test query parameter(s) # noqa: E501
@ -507,7 +507,7 @@ class QueryApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _request_auth=_params.get('_request_auth'))
@validate_arguments @validate_call
def test_query_style_deep_object_explode_true_object(self, query_object : Optional[Pet] = None, **kwargs) -> str: # noqa: E501 def test_query_style_deep_object_explode_true_object(self, query_object : Optional[Pet] = None, **kwargs) -> str: # noqa: E501
"""Test query parameter(s) # noqa: E501 """Test query parameter(s) # noqa: E501
@ -537,7 +537,7 @@ class QueryApi:
raise ValueError(message) raise ValueError(message)
return self.test_query_style_deep_object_explode_true_object_with_http_info(query_object, **kwargs) # noqa: E501 return self.test_query_style_deep_object_explode_true_object_with_http_info(query_object, **kwargs) # noqa: E501
@validate_arguments @validate_call
def test_query_style_deep_object_explode_true_object_with_http_info(self, query_object : Optional[Pet] = None, **kwargs) -> ApiResponse: # noqa: E501 def test_query_style_deep_object_explode_true_object_with_http_info(self, query_object : Optional[Pet] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test query parameter(s) # noqa: E501 """Test query parameter(s) # noqa: E501
@ -647,7 +647,7 @@ class QueryApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _request_auth=_params.get('_request_auth'))
@validate_arguments @validate_call
def test_query_style_deep_object_explode_true_object_all_of(self, query_object : Optional[Any] = None, **kwargs) -> str: # noqa: E501 def test_query_style_deep_object_explode_true_object_all_of(self, query_object : Optional[Any] = None, **kwargs) -> str: # noqa: E501
"""Test query parameter(s) # noqa: E501 """Test query parameter(s) # noqa: E501
@ -677,7 +677,7 @@ class QueryApi:
raise ValueError(message) raise ValueError(message)
return self.test_query_style_deep_object_explode_true_object_all_of_with_http_info(query_object, **kwargs) # noqa: E501 return self.test_query_style_deep_object_explode_true_object_all_of_with_http_info(query_object, **kwargs) # noqa: E501
@validate_arguments @validate_call
def test_query_style_deep_object_explode_true_object_all_of_with_http_info(self, query_object : Optional[Any] = None, **kwargs) -> ApiResponse: # noqa: E501 def test_query_style_deep_object_explode_true_object_all_of_with_http_info(self, query_object : Optional[Any] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test query parameter(s) # noqa: E501 """Test query parameter(s) # noqa: E501
@ -787,7 +787,7 @@ class QueryApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _request_auth=_params.get('_request_auth'))
@validate_arguments @validate_call
def test_query_style_form_explode_true_array_string(self, query_object : Optional[TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter] = None, **kwargs) -> str: # noqa: E501 def test_query_style_form_explode_true_array_string(self, query_object : Optional[TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter] = None, **kwargs) -> str: # noqa: E501
"""Test query parameter(s) # noqa: E501 """Test query parameter(s) # noqa: E501
@ -817,7 +817,7 @@ class QueryApi:
raise ValueError(message) raise ValueError(message)
return self.test_query_style_form_explode_true_array_string_with_http_info(query_object, **kwargs) # noqa: E501 return self.test_query_style_form_explode_true_array_string_with_http_info(query_object, **kwargs) # noqa: E501
@validate_arguments @validate_call
def test_query_style_form_explode_true_array_string_with_http_info(self, query_object : Optional[TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter] = None, **kwargs) -> ApiResponse: # noqa: E501 def test_query_style_form_explode_true_array_string_with_http_info(self, query_object : Optional[TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test query parameter(s) # noqa: E501 """Test query parameter(s) # noqa: E501
@ -927,7 +927,7 @@ class QueryApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _request_auth=_params.get('_request_auth'))
@validate_arguments @validate_call
def test_query_style_form_explode_true_object(self, query_object : Optional[Pet] = None, **kwargs) -> str: # noqa: E501 def test_query_style_form_explode_true_object(self, query_object : Optional[Pet] = None, **kwargs) -> str: # noqa: E501
"""Test query parameter(s) # noqa: E501 """Test query parameter(s) # noqa: E501
@ -957,7 +957,7 @@ class QueryApi:
raise ValueError(message) raise ValueError(message)
return self.test_query_style_form_explode_true_object_with_http_info(query_object, **kwargs) # noqa: E501 return self.test_query_style_form_explode_true_object_with_http_info(query_object, **kwargs) # noqa: E501
@validate_arguments @validate_call
def test_query_style_form_explode_true_object_with_http_info(self, query_object : Optional[Pet] = None, **kwargs) -> ApiResponse: # noqa: E501 def test_query_style_form_explode_true_object_with_http_info(self, query_object : Optional[Pet] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test query parameter(s) # noqa: E501 """Test query parameter(s) # noqa: E501
@ -1067,7 +1067,7 @@ class QueryApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _request_auth=_params.get('_request_auth'))
@validate_arguments @validate_call
def test_query_style_form_explode_true_object_all_of(self, query_object : Optional[Any] = None, **kwargs) -> str: # noqa: E501 def test_query_style_form_explode_true_object_all_of(self, query_object : Optional[Any] = None, **kwargs) -> str: # noqa: E501
"""Test query parameter(s) # noqa: E501 """Test query parameter(s) # noqa: E501
@ -1097,7 +1097,7 @@ class QueryApi:
raise ValueError(message) raise ValueError(message)
return self.test_query_style_form_explode_true_object_all_of_with_http_info(query_object, **kwargs) # noqa: E501 return self.test_query_style_form_explode_true_object_all_of_with_http_info(query_object, **kwargs) # noqa: E501
@validate_arguments @validate_call
def test_query_style_form_explode_true_object_all_of_with_http_info(self, query_object : Optional[Any] = None, **kwargs) -> ApiResponse: # noqa: E501 def test_query_style_form_explode_true_object_all_of_with_http_info(self, query_object : Optional[Any] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test query parameter(s) # noqa: E501 """Test query parameter(s) # noqa: E501

View File

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

View File

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

View File

@ -33,14 +33,15 @@ class DataQuery(Query):
var_date: Optional[datetime] = Field(default=None, description="A date", alias="date") var_date: Optional[datetime] = Field(default=None, description="A date", alias="date")
__properties = ["id", "outcomes", "suffix", "text", "date"] __properties = ["id", "outcomes", "suffix", "text", "date"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -54,7 +55,7 @@ class DataQuery(Query):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -67,9 +68,9 @@ class DataQuery(Query):
return None return None
if not isinstance(obj, dict): if not isinstance(obj, dict):
return DataQuery.parse_obj(obj) return DataQuery.model_validate(obj)
_obj = DataQuery.parse_obj({ _obj = DataQuery.model_validate({
"id": obj.get("id"), "id": obj.get("id"),
"outcomes": obj.get("outcomes"), "outcomes": obj.get("outcomes"),
"suffix": obj.get("suffix"), "suffix": obj.get("suffix"),

View File

@ -20,7 +20,7 @@ import json
from typing import List, Optional from typing import List, Optional
from pydantic import BaseModel, StrictInt, StrictStr, validator from pydantic import BaseModel, StrictInt, StrictStr, field_validator
from openapi_client.models.string_enum_ref import StringEnumRef from openapi_client.models.string_enum_ref import StringEnumRef
class DefaultValue(BaseModel): class DefaultValue(BaseModel):
@ -37,7 +37,7 @@ class DefaultValue(BaseModel):
string_nullable: Optional[StrictStr] = None string_nullable: Optional[StrictStr] = None
__properties = ["array_string_enum_ref_default", "array_string_enum_default", "array_string_default", "array_integer_default", "array_string", "array_string_nullable", "array_string_extension_nullable", "string_nullable"] __properties = ["array_string_enum_ref_default", "array_string_enum_default", "array_string_default", "array_integer_default", "array_string", "array_string_nullable", "array_string_extension_nullable", "string_nullable"]
@validator('array_string_enum_default') @field_validator('array_string_enum_default')
def array_string_enum_default_validate_enum(cls, value): def array_string_enum_default_validate_enum(cls, value):
"""Validates the enum""" """Validates the enum"""
if value is None: if value is None:
@ -48,14 +48,15 @@ class DefaultValue(BaseModel):
raise ValueError("each list item must be one of ('success', 'failure', 'unclassified')") raise ValueError("each list item must be one of ('success', 'failure', 'unclassified')")
return value return value
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -69,23 +70,23 @@ class DefaultValue(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
# set to None if array_string_nullable (nullable) is None # set to None if array_string_nullable (nullable) is None
# and __fields_set__ contains the field # and model_fields_set contains the field
if self.array_string_nullable is None and "array_string_nullable" in self.__fields_set__: if self.array_string_nullable is None and "array_string_nullable" in self.model_fields_set:
_dict['array_string_nullable'] = None _dict['array_string_nullable'] = None
# set to None if array_string_extension_nullable (nullable) is None # set to None if array_string_extension_nullable (nullable) is None
# and __fields_set__ contains the field # and model_fields_set contains the field
if self.array_string_extension_nullable is None and "array_string_extension_nullable" in self.__fields_set__: if self.array_string_extension_nullable is None and "array_string_extension_nullable" in self.model_fields_set:
_dict['array_string_extension_nullable'] = None _dict['array_string_extension_nullable'] = None
# set to None if string_nullable (nullable) is None # set to None if string_nullable (nullable) is None
# and __fields_set__ contains the field # and model_fields_set contains the field
if self.string_nullable is None and "string_nullable" in self.__fields_set__: if self.string_nullable is None and "string_nullable" in self.model_fields_set:
_dict['string_nullable'] = None _dict['string_nullable'] = None
return _dict return _dict
@ -97,9 +98,9 @@ class DefaultValue(BaseModel):
return None return None
if not isinstance(obj, dict): if not isinstance(obj, dict):
return DefaultValue.parse_obj(obj) return DefaultValue.model_validate(obj)
_obj = DefaultValue.parse_obj({ _obj = DefaultValue.model_validate({
"array_string_enum_ref_default": obj.get("array_string_enum_ref_default"), "array_string_enum_ref_default": obj.get("array_string_enum_ref_default"),
"array_string_enum_default": obj.get("array_string_enum_default"), "array_string_enum_default": obj.get("array_string_enum_default"),
"array_string_default": obj.get("array_string_default"), "array_string_default": obj.get("array_string_default"),

View File

@ -32,14 +32,15 @@ class NumberPropertiesOnly(BaseModel):
double: Optional[Union[Annotated[float, Field(le=50.2, strict=True, ge=0.8)], Annotated[int, Field(le=50, strict=True, ge=1)]]] = None double: Optional[Union[Annotated[float, Field(le=50.2, strict=True, ge=0.8)], Annotated[int, Field(le=50, strict=True, ge=1)]]] = None
__properties = ["number", "double"] __properties = ["number", "double"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -53,7 +54,7 @@ class NumberPropertiesOnly(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -66,9 +67,9 @@ class NumberPropertiesOnly(BaseModel):
return None return None
if not isinstance(obj, dict): if not isinstance(obj, dict):
return NumberPropertiesOnly.parse_obj(obj) return NumberPropertiesOnly.model_validate(obj)
_obj = NumberPropertiesOnly.parse_obj({ _obj = NumberPropertiesOnly.model_validate({
"number": obj.get("number"), "number": obj.get("number"),
"double": obj.get("double") "double": obj.get("double")
}) })

View File

@ -20,7 +20,7 @@ import json
from typing import List, Optional 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 pydantic import Field
from openapi_client.models.category import Category from openapi_client.models.category import Category
from openapi_client.models.tag import Tag from openapi_client.models.tag import Tag
@ -37,7 +37,7 @@ class Pet(BaseModel):
status: Optional[StrictStr] = Field(default=None, description="pet status in the store") status: Optional[StrictStr] = Field(default=None, description="pet status in the store")
__properties = ["id", "name", "category", "photoUrls", "tags", "status"] __properties = ["id", "name", "category", "photoUrls", "tags", "status"]
@validator('status') @field_validator('status')
def status_validate_enum(cls, value): def status_validate_enum(cls, value):
"""Validates the enum""" """Validates the enum"""
if value is None: if value is None:
@ -47,14 +47,15 @@ class Pet(BaseModel):
raise ValueError("must be one of enum values ('available', 'pending', 'sold')") raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
return value return value
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -68,7 +69,7 @@ class Pet(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -91,9 +92,9 @@ class Pet(BaseModel):
return None return None
if not isinstance(obj, dict): 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"), "id": obj.get("id"),
"name": obj.get("name"), "name": obj.get("name"),
"category": Category.from_dict(obj.get("category")) if obj.get("category") is not None else None, "category": Category.from_dict(obj.get("category")) if obj.get("category") is not None else None,

View File

@ -20,7 +20,7 @@ import json
from typing import List, Optional 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 pydantic import Field
class Query(BaseModel): class Query(BaseModel):
@ -31,7 +31,7 @@ class Query(BaseModel):
outcomes: Optional[List[StrictStr]] = None outcomes: Optional[List[StrictStr]] = None
__properties = ["id", "outcomes"] __properties = ["id", "outcomes"]
@validator('outcomes') @field_validator('outcomes')
def outcomes_validate_enum(cls, value): def outcomes_validate_enum(cls, value):
"""Validates the enum""" """Validates the enum"""
if value is None: if value is None:
@ -42,14 +42,15 @@ class Query(BaseModel):
raise ValueError("each list item must be one of ('SUCCESS', 'FAILURE', 'SKIPPED')") raise ValueError("each list item must be one of ('SUCCESS', 'FAILURE', 'SKIPPED')")
return value return value
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -63,7 +64,7 @@ class Query(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)

View File

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

View File

@ -32,14 +32,15 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(BaseMod
name: Optional[StrictStr] = None name: Optional[StrictStr] = None
__properties = ["size", "color", "id", "name"] __properties = ["size", "color", "id", "name"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -53,7 +54,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(BaseMod
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -66,9 +67,9 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(BaseMod
return None return None
if not isinstance(obj, dict): if not isinstance(obj, dict):
return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.parse_obj(obj) return TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.model_validate(obj)
_obj = TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.parse_obj({ _obj = TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter.model_validate({
"size": obj.get("size"), "size": obj.get("size"),
"color": obj.get("color"), "color": obj.get("color"),
"id": obj.get("id"), "id": obj.get("id"),

View File

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

View File

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

View File

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

View File

@ -16,13 +16,13 @@ import re # noqa: F401
import io import io
import warnings import warnings
from pydantic import validate_arguments, ValidationError from pydantic import validate_call, ValidationError
from pydantic import Field from pydantic import Field
from typing_extensions import Annotated from typing_extensions import Annotated
from datetime import date, datetime 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 from typing import Any, Dict, List, Optional, Union
@ -57,7 +57,7 @@ class FakeApi:
api_client = ApiClient.get_default() api_client = ApiClient.get_default()
self.api_client = api_client 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 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 """test any type request body # noqa: E501
@ -79,7 +79,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.fake_any_type_request_body_with_http_info(body, **kwargs) # noqa: E501 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 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 """test any type request body # noqa: E501
@ -180,7 +180,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """test enum reference query parameter # noqa: E501
@ -202,7 +202,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.fake_enum_ref_query_parameter_with_http_info(enum_ref, **kwargs) # noqa: E501 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 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 """test enum reference query parameter # noqa: E501
@ -296,7 +296,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _request_auth=_params.get('_request_auth'))
@validate_arguments @validate_call
async def fake_health_get(self, **kwargs) -> HealthCheckResult: # noqa: E501 async def fake_health_get(self, **kwargs) -> HealthCheckResult: # noqa: E501
"""Health check endpoint # noqa: E501 """Health check endpoint # noqa: E501
@ -316,7 +316,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.fake_health_get_with_http_info(**kwargs) # noqa: E501 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 async def fake_health_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501
"""Health check endpoint # noqa: E501 """Health check endpoint # noqa: E501
@ -410,7 +410,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """test http signature authentication # noqa: E501
@ -436,7 +436,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.fake_http_signature_test_with_http_info(pet, query_1, header_1, **kwargs) # noqa: E501 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 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 """test http signature authentication # noqa: E501
@ -549,7 +549,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """fake_outer_boolean_serialize # noqa: E501
@ -572,7 +572,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.fake_outer_boolean_serialize_with_http_info(body, **kwargs) # noqa: E501 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 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 """fake_outer_boolean_serialize # noqa: E501
@ -680,7 +680,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """fake_outer_composite_serialize # noqa: E501
@ -703,7 +703,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.fake_outer_composite_serialize_with_http_info(outer_composite, **kwargs) # noqa: E501 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 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 """fake_outer_composite_serialize # noqa: E501
@ -811,7 +811,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """fake_outer_number_serialize # noqa: E501
@ -834,7 +834,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.fake_outer_number_serialize_with_http_info(body, **kwargs) # noqa: E501 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 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 """fake_outer_number_serialize # noqa: E501
@ -942,7 +942,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """fake_outer_string_serialize # noqa: E501
@ -965,7 +965,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.fake_outer_string_serialize_with_http_info(body, **kwargs) # noqa: E501 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 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 """fake_outer_string_serialize # noqa: E501
@ -1073,7 +1073,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """fake_property_enum_integer_serialize # noqa: E501
@ -1096,7 +1096,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.fake_property_enum_integer_serialize_with_http_info(outer_object_with_enum_property, **kwargs) # noqa: E501 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 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 """fake_property_enum_integer_serialize # noqa: E501
@ -1204,7 +1204,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _request_auth=_params.get('_request_auth'))
@validate_arguments @validate_call
async def fake_return_list_of_objects(self, **kwargs) -> List[List[Tag]]: # noqa: E501 async def fake_return_list_of_objects(self, **kwargs) -> List[List[Tag]]: # noqa: E501
"""test returning list of objects # noqa: E501 """test returning list of objects # noqa: E501
@ -1224,7 +1224,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.fake_return_list_of_objects_with_http_info(**kwargs) # noqa: E501 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 async def fake_return_list_of_objects_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501
"""test returning list of objects # noqa: E501 """test returning list of objects # noqa: E501
@ -1318,7 +1318,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 async def fake_uuid_example(self, uuid_example : Annotated[StrictStr, Field(description="uuid example")], **kwargs) -> None: # noqa: E501
"""test uuid example # noqa: E501 """test uuid example # noqa: E501
@ -1340,7 +1340,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.fake_uuid_example_with_http_info(uuid_example, **kwargs) # noqa: E501 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 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 """test uuid example # noqa: E501
@ -1434,7 +1434,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """test_body_with_binary # noqa: E501
@ -1457,7 +1457,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.test_body_with_binary_with_http_info(body, **kwargs) # noqa: E501 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 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 """test_body_with_binary # noqa: E501
@ -1564,7 +1564,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 async def test_body_with_file_schema(self, file_schema_test_class : FileSchemaTestClass, **kwargs) -> None: # noqa: E501
"""test_body_with_file_schema # noqa: E501 """test_body_with_file_schema # noqa: E501
@ -1587,7 +1587,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501 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 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 """test_body_with_file_schema # noqa: E501
@ -1689,7 +1689,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 async def test_body_with_query_params(self, query : StrictStr, user : User, **kwargs) -> None: # noqa: E501
"""test_body_with_query_params # noqa: E501 """test_body_with_query_params # noqa: E501
@ -1713,7 +1713,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.test_body_with_query_params_with_http_info(query, user, **kwargs) # noqa: E501 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 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 """test_body_with_query_params # noqa: E501
@ -1820,7 +1820,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 async def test_client_model(self, client : Annotated[Client, Field(description="client model")], **kwargs) -> Client: # noqa: E501
"""To test \"client\" model # noqa: E501 """To test \"client\" model # noqa: E501
@ -1843,7 +1843,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.test_client_model_with_http_info(client, **kwargs) # noqa: E501 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 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 """To test \"client\" model # noqa: E501
@ -1951,7 +1951,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """test_date_time_query_parameter # noqa: E501
@ -1975,7 +1975,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.test_date_time_query_parameter_with_http_info(date_time_query, str_query, **kwargs) # noqa: E501 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 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 """test_date_time_query_parameter # noqa: E501
@ -2078,7 +2078,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
@ -2129,7 +2129,7 @@ class FakeApi:
raise ValueError(message) 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 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 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 """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501
@ -2315,7 +2315,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """Fake endpoint to test group parameters (optional) # noqa: E501
@ -2348,7 +2348,7 @@ class FakeApi:
raise ValueError(message) 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 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 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 """Fake endpoint to test group parameters (optional) # noqa: E501
@ -2473,7 +2473,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """test inline additionalProperties # noqa: E501
@ -2496,7 +2496,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.test_inline_additional_properties_with_http_info(request_body, **kwargs) # noqa: E501 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 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 """test inline additionalProperties # noqa: E501
@ -2598,7 +2598,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """test inline free-form additionalProperties # noqa: E501
@ -2621,7 +2621,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.test_inline_freeform_additional_properties_with_http_info(test_inline_freeform_additional_properties_request, **kwargs) # noqa: E501 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 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 """test inline free-form additionalProperties # noqa: E501
@ -2723,7 +2723,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """test json serialization of form data # noqa: E501
@ -2748,7 +2748,7 @@ class FakeApi:
raise ValueError(message) raise ValueError(message)
return await self.test_json_form_data_with_http_info(param, param2, **kwargs) # noqa: E501 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 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 """test json serialization of form data # noqa: E501
@ -2856,7 +2856,7 @@ class FakeApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """test_query_parameter_collection_format # noqa: E501
@ -2891,7 +2891,7 @@ class FakeApi:
raise ValueError(message) 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 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 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 """test_query_parameter_collection_format # noqa: E501

View File

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

View File

@ -16,11 +16,11 @@ import re # noqa: F401
import io import io
import warnings import warnings
from pydantic import validate_arguments, ValidationError from pydantic import validate_call, ValidationError
from pydantic import Field from pydantic import Field
from typing_extensions import Annotated 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 from typing import List, Optional, Union
@ -47,7 +47,7 @@ class PetApi:
api_client = ApiClient.get_default() api_client = ApiClient.get_default()
self.api_client = api_client 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 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 """Add a new pet to the store # noqa: E501
@ -70,7 +70,7 @@ class PetApi:
raise ValueError(message) raise ValueError(message)
return await self.add_pet_with_http_info(pet, **kwargs) # noqa: E501 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 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 """Add a new pet to the store # noqa: E501
@ -172,7 +172,7 @@ class PetApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """Deletes a pet # noqa: E501
@ -197,7 +197,7 @@ class PetApi:
raise ValueError(message) raise ValueError(message)
return await self.delete_pet_with_http_info(pet_id, api_key, **kwargs) # noqa: E501 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 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 """Deletes a pet # noqa: E501
@ -298,7 +298,7 @@ class PetApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """Finds Pets by status # noqa: E501
@ -321,7 +321,7 @@ class PetApi:
raise ValueError(message) raise ValueError(message)
return await self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501 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 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 """Finds Pets by status # noqa: E501
@ -424,7 +424,7 @@ class PetApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """(Deprecated) Finds Pets by tags # noqa: E501
@ -447,7 +447,7 @@ class PetApi:
raise ValueError(message) raise ValueError(message)
return await self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501 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 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 """(Deprecated) Finds Pets by tags # noqa: E501
@ -552,7 +552,7 @@ class PetApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """Find pet by ID # noqa: E501
@ -575,7 +575,7 @@ class PetApi:
raise ValueError(message) raise ValueError(message)
return await self.get_pet_by_id_with_http_info(pet_id, **kwargs) # noqa: E501 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 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 """Find pet by ID # noqa: E501
@ -678,7 +678,7 @@ class PetApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """Update an existing pet # noqa: E501
@ -701,7 +701,7 @@ class PetApi:
raise ValueError(message) raise ValueError(message)
return await self.update_pet_with_http_info(pet, **kwargs) # noqa: E501 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 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 """Update an existing pet # noqa: E501
@ -803,7 +803,7 @@ class PetApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """Updates a pet in the store with form data # noqa: E501
@ -830,7 +830,7 @@ class PetApi:
raise ValueError(message) raise ValueError(message)
return await self.update_pet_with_form_with_http_info(pet_id, name, status, **kwargs) # noqa: E501 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 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 """Updates a pet in the store with form data # noqa: E501
@ -944,7 +944,7 @@ class PetApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """uploads an image # noqa: E501
@ -971,7 +971,7 @@ class PetApi:
raise ValueError(message) raise ValueError(message)
return await self.upload_file_with_http_info(pet_id, additional_metadata, file, **kwargs) # noqa: E501 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 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 """uploads an image # noqa: E501
@ -1091,7 +1091,7 @@ class PetApi:
collection_formats=_collection_formats, collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth')) _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 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 """uploads an image (required) # noqa: E501
@ -1118,7 +1118,7 @@ class PetApi:
raise ValueError(message) raise ValueError(message)
return await self.upload_file_with_required_file_with_http_info(pet_id, required_file, additional_metadata, **kwargs) # noqa: E501 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 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 """uploads an image (required) # noqa: E501

View File

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

View File

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

View File

@ -29,14 +29,15 @@ class AdditionalPropertiesAnyType(BaseModel):
additional_properties: Dict[str, Any] = {} additional_properties: Dict[str, Any] = {}
__properties = ["name"] __properties = ["name"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -50,7 +51,7 @@ class AdditionalPropertiesAnyType(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
"additional_properties" "additional_properties"
}, },
@ -69,9 +70,9 @@ class AdditionalPropertiesAnyType(BaseModel):
return None return None
if not isinstance(obj, dict): 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") "name": obj.get("name")
}) })
# store additional fields in additional_properties # 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 map_of_map_property: Optional[Dict[str, Dict[str, StrictStr]]] = None
__properties = ["map_property", "map_of_map_property"] __properties = ["map_property", "map_of_map_property"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -50,7 +51,7 @@ class AdditionalPropertiesClass(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -63,9 +64,9 @@ class AdditionalPropertiesClass(BaseModel):
return None return None
if not isinstance(obj, dict): 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_property": obj.get("map_property"),
"map_of_map_property": obj.get("map_of_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] = {} additional_properties: Dict[str, Any] = {}
__properties = ["name"] __properties = ["name"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -50,7 +51,7 @@ class AdditionalPropertiesObject(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
"additional_properties" "additional_properties"
}, },
@ -69,9 +70,9 @@ class AdditionalPropertiesObject(BaseModel):
return None return None
if not isinstance(obj, dict): 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") "name": obj.get("name")
}) })
# store additional fields in additional_properties # store additional fields in additional_properties

View File

@ -29,14 +29,15 @@ class AdditionalPropertiesWithDescriptionOnly(BaseModel):
additional_properties: Dict[str, Any] = {} additional_properties: Dict[str, Any] = {}
__properties = ["name"] __properties = ["name"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -50,7 +51,7 @@ class AdditionalPropertiesWithDescriptionOnly(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
"additional_properties" "additional_properties"
}, },
@ -69,9 +70,9 @@ class AdditionalPropertiesWithDescriptionOnly(BaseModel):
return None return None
if not isinstance(obj, dict): 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") "name": obj.get("name")
}) })
# store additional fields in additional_properties # 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") single_ref_type: Optional[SingleRefType] = Field(default=None, alias="SingleRefType")
__properties = ["username", "SingleRefType"] __properties = ["username", "SingleRefType"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -52,7 +53,7 @@ class AllOfWithSingleRef(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -65,9 +66,9 @@ class AllOfWithSingleRef(BaseModel):
return None return None
if not isinstance(obj, dict): 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"), "username": obj.get("username"),
"SingleRefType": obj.get("SingleRefType") "SingleRefType": obj.get("SingleRefType")
}) })

View File

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

View File

@ -19,7 +19,7 @@ import pprint
import re # noqa: F401 import re # noqa: F401
from typing import List, Optional 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 pydantic import Field
from typing_extensions import Annotated from typing_extensions import Annotated
from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict
@ -34,9 +34,9 @@ class AnyOfColor(BaseModel):
""" """
# data type: List[int] # 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] # 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 # 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.") 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: if TYPE_CHECKING:
@ -45,8 +45,9 @@ class AnyOfColor(BaseModel):
actual_instance: Any = None actual_instance: Any = None
any_of_schemas: List[str] = Literal[ANYOFCOLOR_ANY_OF_SCHEMAS] any_of_schemas: List[str] = Literal[ANYOFCOLOR_ANY_OF_SCHEMAS]
class Config: model_config = {
validate_assignment = True "validate_assignment": True
}
def __init__(self, *args, **kwargs) -> None: def __init__(self, *args, **kwargs) -> None:
if args: if args:
@ -58,9 +59,9 @@ class AnyOfColor(BaseModel):
else: else:
super().__init__(**kwargs) super().__init__(**kwargs)
@validator('actual_instance') @field_validator('actual_instance')
def actual_instance_must_validate_anyof(cls, v): def actual_instance_must_validate_anyof(cls, v):
instance = AnyOfColor.construct() instance = AnyOfColor.model_construct()
error_messages = [] error_messages = []
# validate data type: List[int] # validate data type: List[int]
try: try:
@ -93,7 +94,7 @@ class AnyOfColor(BaseModel):
@classmethod @classmethod
def from_json(cls, json_str: str) -> AnyOfColor: def from_json(cls, json_str: str) -> AnyOfColor:
"""Returns the object represented by the json string""" """Returns the object represented by the json string"""
instance = AnyOfColor.construct() instance = AnyOfColor.model_construct()
error_messages = [] error_messages = []
# deserialize data into List[int] # deserialize data into List[int]
try: try:
@ -153,6 +154,6 @@ class AnyOfColor(BaseModel):
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the actual instance""" """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 import re # noqa: F401
from typing import Optional 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.basque_pig import BasquePig
from petstore_api.models.danish_pig import DanishPig from petstore_api.models.danish_pig import DanishPig
from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict
@ -43,8 +43,9 @@ class AnyOfPig(BaseModel):
actual_instance: Any = None actual_instance: Any = None
any_of_schemas: List[str] = Literal[ANYOFPIG_ANY_OF_SCHEMAS] any_of_schemas: List[str] = Literal[ANYOFPIG_ANY_OF_SCHEMAS]
class Config: model_config = {
validate_assignment = True "validate_assignment": True
}
def __init__(self, *args, **kwargs) -> None: def __init__(self, *args, **kwargs) -> None:
if args: if args:
@ -56,9 +57,9 @@ class AnyOfPig(BaseModel):
else: else:
super().__init__(**kwargs) super().__init__(**kwargs)
@validator('actual_instance') @field_validator('actual_instance')
def actual_instance_must_validate_anyof(cls, v): def actual_instance_must_validate_anyof(cls, v):
instance = AnyOfPig.construct() instance = AnyOfPig.model_construct()
error_messages = [] error_messages = []
# validate data type: BasquePig # validate data type: BasquePig
if not isinstance(v, BasquePig): if not isinstance(v, BasquePig):
@ -85,7 +86,7 @@ class AnyOfPig(BaseModel):
@classmethod @classmethod
def from_json(cls, json_str: str) -> AnyOfPig: def from_json(cls, json_str: str) -> AnyOfPig:
"""Returns the object represented by the json string""" """Returns the object represented by the json string"""
instance = AnyOfPig.construct() instance = AnyOfPig.model_construct()
error_messages = [] error_messages = []
# anyof_schema_1_validator: Optional[BasquePig] = None # anyof_schema_1_validator: Optional[BasquePig] = None
try: try:
@ -130,6 +131,6 @@ class AnyOfPig(BaseModel):
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the actual instance""" """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 message: Optional[StrictStr] = None
__properties = ["code", "type", "message"] __properties = ["code", "type", "message"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -51,7 +52,7 @@ class ApiResponse(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -64,9 +65,9 @@ class ApiResponse(BaseModel):
return None return None
if not isinstance(obj, dict): 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"), "code": obj.get("code"),
"type": obj.get("type"), "type": obj.get("type"),
"message": obj.get("message") "message": obj.get("message")

View File

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

View File

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

View File

@ -28,19 +28,20 @@ class ArrayTest(BaseModel):
""" """
ArrayTest 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_integer: Optional[List[List[StrictInt]]] = None
array_array_of_model: Optional[List[List[ReadOnlyFirst]]] = None array_array_of_model: Optional[List[List[ReadOnlyFirst]]] = None
__properties = ["array_of_string", "array_array_of_integer", "array_array_of_model"] __properties = ["array_of_string", "array_array_of_integer", "array_array_of_model"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -54,7 +55,7 @@ class ArrayTest(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -76,9 +77,9 @@ class ArrayTest(BaseModel):
return None return None
if not isinstance(obj, dict): 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_of_string": obj.get("array_of_string"),
"array_array_of_integer": obj.get("array_array_of_integer"), "array_array_of_integer": obj.get("array_array_of_integer"),
"array_array_of_model": [ "array_array_of_model": [

View File

@ -30,14 +30,15 @@ class BasquePig(BaseModel):
color: StrictStr color: StrictStr
__properties = ["className", "color"] __properties = ["className", "color"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -51,7 +52,7 @@ class BasquePig(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -64,9 +65,9 @@ class BasquePig(BaseModel):
return None return None
if not isinstance(obj, dict): 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"), "className": obj.get("className"),
"color": obj.get("color") "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") 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"] __properties = ["smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -55,7 +56,7 @@ class Capitalization(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -68,9 +69,9 @@ class Capitalization(BaseModel):
return None return None
if not isinstance(obj, dict): 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"), "smallCamel": obj.get("smallCamel"),
"CapitalCamel": obj.get("CapitalCamel"), "CapitalCamel": obj.get("CapitalCamel"),
"small_Snake": obj.get("small_Snake"), "small_Snake": obj.get("small_Snake"),

View File

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

View File

@ -29,14 +29,15 @@ class Category(BaseModel):
name: StrictStr name: StrictStr
__properties = ["id", "name"] __properties = ["id", "name"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -50,7 +51,7 @@ class Category(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -63,9 +64,9 @@ class Category(BaseModel):
return None return None
if not isinstance(obj, dict): 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"), "id": obj.get("id"),
"name": obj.get("name") if obj.get("name") is not None else 'default-name' "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 nested: Optional[FirstRef] = None
__properties = ["size", "nested"] __properties = ["size", "nested"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -50,7 +51,7 @@ class CircularReferenceModel(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -66,9 +67,9 @@ class CircularReferenceModel(BaseModel):
return None return None
if not isinstance(obj, dict): 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"), "size": obj.get("size"),
"nested": FirstRef.from_dict(obj.get("nested")) if obj.get("nested") is not None else None "nested": FirstRef.from_dict(obj.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") var_class: Optional[StrictStr] = Field(default=None, alias="_class")
__properties = ["_class"] __properties = ["_class"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -50,7 +51,7 @@ class ClassModel(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -63,9 +64,9 @@ class ClassModel(BaseModel):
return None return None
if not isinstance(obj, dict): 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") "_class": obj.get("_class")
}) })
return _obj return _obj

View File

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

View File

@ -19,7 +19,7 @@ import pprint
import re # noqa: F401 import re # noqa: F401
from typing import Any, List, Optional 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 pydantic import Field
from typing_extensions import Annotated from typing_extensions import Annotated
from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict
@ -33,16 +33,18 @@ class Color(BaseModel):
RGB array, RGBA array, or hex string. RGB array, RGBA array, or hex string.
""" """
# data type: List[int] # 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] # 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 # 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.") 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 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: def __init__(self, *args, **kwargs) -> None:
if args: if args:
@ -54,12 +56,12 @@ class Color(BaseModel):
else: else:
super().__init__(**kwargs) super().__init__(**kwargs)
@validator('actual_instance') @field_validator('actual_instance')
def actual_instance_must_validate_oneof(cls, v): def actual_instance_must_validate_oneof(cls, v):
if v is None: if v is None:
return v return v
instance = Color.construct() instance = Color.model_construct()
error_messages = [] error_messages = []
match = 0 match = 0
# validate data type: List[int] # validate data type: List[int]
@ -96,7 +98,7 @@ class Color(BaseModel):
@classmethod @classmethod
def from_json(cls, json_str: str) -> Color: def from_json(cls, json_str: str) -> Color:
"""Returns the object represented by the json string""" """Returns the object represented by the json string"""
instance = Color.construct() instance = Color.model_construct()
if json_str is None: if json_str is None:
return instance return instance
@ -165,6 +167,6 @@ class Color(BaseModel):
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the actual instance""" """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 type: StrictStr
__properties = ["info", "type"] __properties = ["info", "type"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -51,7 +52,7 @@ class Creature(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -67,9 +68,9 @@ class Creature(BaseModel):
return None return None
if not isinstance(obj, dict): 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, "info": CreatureInfo.from_dict(obj.get("info")) if obj.get("info") is not None else None,
"type": obj.get("type") "type": obj.get("type")
}) })

View File

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

View File

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

View File

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

View File

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

View File

@ -29,14 +29,15 @@ class DummyModel(BaseModel):
self_ref: Optional[SelfReferenceModel] = None self_ref: Optional[SelfReferenceModel] = None
__properties = ["category", "self_ref"] __properties = ["category", "self_ref"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -50,7 +51,7 @@ class DummyModel(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -66,9 +67,9 @@ class DummyModel(BaseModel):
return None return None
if not isinstance(obj, dict): 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"), "category": obj.get("category"),
"self_ref": SelfReferenceModel.from_dict(obj.get("self_ref")) if obj.get("self_ref") is not None else None "self_ref": SelfReferenceModel.from_dict(obj.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 typing import List, Optional
from pydantic import BaseModel, StrictStr, validator from pydantic import BaseModel, StrictStr, field_validator
class EnumArrays(BaseModel): class EnumArrays(BaseModel):
""" """
@ -29,7 +29,7 @@ class EnumArrays(BaseModel):
array_enum: Optional[List[StrictStr]] = None array_enum: Optional[List[StrictStr]] = None
__properties = ["just_symbol", "array_enum"] __properties = ["just_symbol", "array_enum"]
@validator('just_symbol') @field_validator('just_symbol')
def just_symbol_validate_enum(cls, value): def just_symbol_validate_enum(cls, value):
"""Validates the enum""" """Validates the enum"""
if value is None: if value is None:
@ -39,7 +39,7 @@ class EnumArrays(BaseModel):
raise ValueError("must be one of enum values ('>=', '$')") raise ValueError("must be one of enum values ('>=', '$')")
return value return value
@validator('array_enum') @field_validator('array_enum')
def array_enum_validate_enum(cls, value): def array_enum_validate_enum(cls, value):
"""Validates the enum""" """Validates the enum"""
if value is None: if value is None:
@ -50,14 +50,15 @@ class EnumArrays(BaseModel):
raise ValueError("each list item must be one of ('fish', 'crab')") raise ValueError("each list item must be one of ('fish', 'crab')")
return value return value
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -71,7 +72,7 @@ class EnumArrays(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -84,9 +85,9 @@ class EnumArrays(BaseModel):
return None return None
if not isinstance(obj, dict): 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"), "just_symbol": obj.get("just_symbol"),
"array_enum": obj.get("array_enum") "array_enum": obj.get("array_enum")
}) })

View File

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

View File

@ -30,14 +30,15 @@ class FileSchemaTestClass(BaseModel):
files: Optional[List[File]] = None files: Optional[List[File]] = None
__properties = ["file", "files"] __properties = ["file", "files"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -51,7 +52,7 @@ class FileSchemaTestClass(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -74,9 +75,9 @@ class FileSchemaTestClass(BaseModel):
return None return None
if not isinstance(obj, dict): 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, "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 "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 self_ref: Optional[SecondRef] = None
__properties = ["category", "self_ref"] __properties = ["category", "self_ref"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -50,7 +51,7 @@ class FirstRef(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -66,9 +67,9 @@ class FirstRef(BaseModel):
return None return None
if not isinstance(obj, dict): 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"), "category": obj.get("category"),
"self_ref": SecondRef.from_dict(obj.get("self_ref")) if obj.get("self_ref") is not None else None "self_ref": SecondRef.from_dict(obj.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' bar: Optional[StrictStr] = 'bar'
__properties = ["bar"] __properties = ["bar"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -49,7 +50,7 @@ class Foo(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -62,9 +63,9 @@ class Foo(BaseModel):
return None return None
if not isinstance(obj, dict): 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' "bar": obj.get("bar") if obj.get("bar") is not None else 'bar'
}) })
return _obj return _obj

View File

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

View File

@ -19,7 +19,7 @@ import json
from datetime import date, datetime from datetime import date, datetime
from typing import Optional, Union 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 decimal import Decimal
from pydantic import Field from pydantic import Field
from typing_extensions import Annotated 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.") 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"] __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): def string_validate_regular_expression(cls, value):
"""Validates the regular expression""" """Validates the regular expression"""
if value is None: if value is None:
@ -56,7 +56,7 @@ class FormatTest(BaseModel):
raise ValueError(r"must validate the regular expression /[a-z]/i") raise ValueError(r"must validate the regular expression /[a-z]/i")
return value 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): def string_with_double_quote_pattern_validate_regular_expression(cls, value):
"""Validates the regular expression""" """Validates the regular expression"""
if value is None: if value is None:
@ -66,7 +66,7 @@ class FormatTest(BaseModel):
raise ValueError(r"must validate the regular expression /this is \"something\"/") raise ValueError(r"must validate the regular expression /this is \"something\"/")
return value return value
@validator('pattern_with_digits') @field_validator('pattern_with_digits')
def pattern_with_digits_validate_regular_expression(cls, value): def pattern_with_digits_validate_regular_expression(cls, value):
"""Validates the regular expression""" """Validates the regular expression"""
if value is None: if value is None:
@ -76,7 +76,7 @@ class FormatTest(BaseModel):
raise ValueError(r"must validate the regular expression /^\d{10}$/") raise ValueError(r"must validate the regular expression /^\d{10}$/")
return value 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): def pattern_with_digits_and_delimiter_validate_regular_expression(cls, value):
"""Validates the regular expression""" """Validates the regular expression"""
if value is None: if value is None:
@ -86,14 +86,15 @@ class FormatTest(BaseModel):
raise ValueError(r"must validate the regular expression /^image_\d{1,3}$/i") raise ValueError(r"must validate the regular expression /^image_\d{1,3}$/i")
return value return value
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -107,7 +108,7 @@ class FormatTest(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -120,9 +121,9 @@ class FormatTest(BaseModel):
return None return None
if not isinstance(obj, dict): 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"), "integer": obj.get("integer"),
"int32": obj.get("int32"), "int32": obj.get("int32"),
"int64": obj.get("int64"), "int64": obj.get("int64"),

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@ import pprint
import re # noqa: F401 import re # noqa: F401
from typing import Any, List, Optional 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 pydantic import Field
from typing_extensions import Annotated from typing_extensions import Annotated
from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict
@ -37,10 +37,12 @@ class IntOrString(BaseModel):
# data type: str # data type: str
oneof_schema_2_validator: Optional[StrictStr] = None oneof_schema_2_validator: Optional[StrictStr] = None
actual_instance: Optional[Union[int, str]] = 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: def __init__(self, *args, **kwargs) -> None:
if args: if args:
@ -52,9 +54,9 @@ class IntOrString(BaseModel):
else: else:
super().__init__(**kwargs) super().__init__(**kwargs)
@validator('actual_instance') @field_validator('actual_instance')
def actual_instance_must_validate_oneof(cls, v): def actual_instance_must_validate_oneof(cls, v):
instance = IntOrString.construct() instance = IntOrString.model_construct()
error_messages = [] error_messages = []
match = 0 match = 0
# validate data type: int # validate data type: int
@ -85,7 +87,7 @@ class IntOrString(BaseModel):
@classmethod @classmethod
def from_json(cls, json_str: str) -> IntOrString: def from_json(cls, json_str: str) -> IntOrString:
"""Returns the object represented by the json string""" """Returns the object represented by the json string"""
instance = IntOrString.construct() instance = IntOrString.model_construct()
error_messages = [] error_messages = []
match = 0 match = 0
@ -142,6 +144,6 @@ class IntOrString(BaseModel):
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the actual instance""" """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") var_123_list: Optional[StrictStr] = Field(default=None, alias="123-list")
__properties = ["123-list"] __properties = ["123-list"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -50,7 +51,7 @@ class List(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -63,9 +64,9 @@ class List(BaseModel):
return None return None
if not isinstance(obj, dict): 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") "123-list": obj.get("123-list")
}) })
return _obj 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") shop_id_to_org_online_lip_map: Optional[Dict[str, List[Tag]]] = Field(default=None, alias="shopIdToOrgOnlineLipMap")
__properties = ["shopIdToOrgOnlineLipMap"] __properties = ["shopIdToOrgOnlineLipMap"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -51,7 +52,7 @@ class MapOfArrayOfModel(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -73,9 +74,9 @@ class MapOfArrayOfModel(BaseModel):
return None return None
if not isinstance(obj, dict): 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( "shopIdToOrgOnlineLipMap": dict(
(_k, (_k,
[Tag.from_dict(_item) for _item in _v] [Tag.from_dict(_item) for _item in _v]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -19,7 +19,7 @@ import pprint
import re # noqa: F401 import re # noqa: F401
from typing import Any, List, Optional 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_string1 import EnumString1
from petstore_api.models.enum_string2 import EnumString2 from petstore_api.models.enum_string2 import EnumString2
from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict
@ -37,10 +37,12 @@ class OneOfEnumString(BaseModel):
# data type: EnumString2 # data type: EnumString2
oneof_schema_2_validator: Optional[EnumString2] = None oneof_schema_2_validator: Optional[EnumString2] = None
actual_instance: Optional[Union[EnumString1, 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: def __init__(self, *args, **kwargs) -> None:
if args: if args:
@ -52,9 +54,9 @@ class OneOfEnumString(BaseModel):
else: else:
super().__init__(**kwargs) super().__init__(**kwargs)
@validator('actual_instance') @field_validator('actual_instance')
def actual_instance_must_validate_oneof(cls, v): def actual_instance_must_validate_oneof(cls, v):
instance = OneOfEnumString.construct() instance = OneOfEnumString.model_construct()
error_messages = [] error_messages = []
match = 0 match = 0
# validate data type: EnumString1 # validate data type: EnumString1
@ -83,7 +85,7 @@ class OneOfEnumString(BaseModel):
@classmethod @classmethod
def from_json(cls, json_str: str) -> OneOfEnumString: def from_json(cls, json_str: str) -> OneOfEnumString:
"""Returns the object represented by the json string""" """Returns the object represented by the json string"""
instance = OneOfEnumString.construct() instance = OneOfEnumString.model_construct()
error_messages = [] error_messages = []
match = 0 match = 0
@ -134,6 +136,6 @@ class OneOfEnumString(BaseModel):
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the actual instance""" """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 datetime import datetime
from typing import Optional 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 from pydantic import Field
class Order(BaseModel): class Order(BaseModel):
@ -34,7 +34,7 @@ class Order(BaseModel):
complete: Optional[StrictBool] = False complete: Optional[StrictBool] = False
__properties = ["id", "petId", "quantity", "shipDate", "status", "complete"] __properties = ["id", "petId", "quantity", "shipDate", "status", "complete"]
@validator('status') @field_validator('status')
def status_validate_enum(cls, value): def status_validate_enum(cls, value):
"""Validates the enum""" """Validates the enum"""
if value is None: if value is None:
@ -44,14 +44,15 @@ class Order(BaseModel):
raise ValueError("must be one of enum values ('placed', 'approved', 'delivered')") raise ValueError("must be one of enum values ('placed', 'approved', 'delivered')")
return value return value
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -65,7 +66,7 @@ class Order(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -78,9 +79,9 @@ class Order(BaseModel):
return None return None
if not isinstance(obj, dict): 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"), "id": obj.get("id"),
"petId": obj.get("petId"), "petId": obj.get("petId"),
"quantity": obj.get("quantity"), "quantity": obj.get("quantity"),

View File

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

View File

@ -31,14 +31,15 @@ class OuterObjectWithEnumProperty(BaseModel):
value: OuterEnumInteger value: OuterEnumInteger
__properties = ["str_value", "value"] __properties = ["str_value", "value"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -52,13 +53,13 @@ class OuterObjectWithEnumProperty(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
# set to None if str_value (nullable) is None # set to None if str_value (nullable) is None
# and __fields_set__ contains the field # and model_fields_set contains the field
if self.str_value is None and "str_value" in self.__fields_set__: if self.str_value is None and "str_value" in self.model_fields_set:
_dict['str_value'] = None _dict['str_value'] = None
return _dict return _dict
@ -70,9 +71,9 @@ class OuterObjectWithEnumProperty(BaseModel):
return None return None
if not isinstance(obj, dict): 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"), "str_value": obj.get("str_value"),
"value": obj.get("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") optional_dict: Optional[Dict[str, InnerDictWithProperty]] = Field(default=None, alias="optionalDict")
__properties = ["optionalDict"] __properties = ["optionalDict"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -51,7 +52,7 @@ class Parent(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -71,9 +72,9 @@ class Parent(BaseModel):
return None return None
if not isinstance(obj, dict): 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( "optionalDict": dict(
(_k, InnerDictWithProperty.from_dict(_v)) (_k, InnerDictWithProperty.from_dict(_v))
for _k, _v in obj.get("optionalDict").items() 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") optional_dict: Optional[Dict[str, InnerDictWithProperty]] = Field(default=None, alias="optionalDict")
__properties = ["optionalDict"] __properties = ["optionalDict"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -51,7 +52,7 @@ class ParentWithOptionalDict(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -71,9 +72,9 @@ class ParentWithOptionalDict(BaseModel):
return None return None
if not isinstance(obj, dict): 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( "optionalDict": dict(
(_k, InnerDictWithProperty.from_dict(_v)) (_k, InnerDictWithProperty.from_dict(_v))
for _k, _v in obj.get("optionalDict").items() for _k, _v in obj.get("optionalDict").items()

View File

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

View File

@ -19,7 +19,7 @@ import pprint
import re # noqa: F401 import re # noqa: F401
from typing import Any, List, Optional 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.basque_pig import BasquePig
from petstore_api.models.danish_pig import DanishPig from petstore_api.models.danish_pig import DanishPig
from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict from typing import Union, Any, List, TYPE_CHECKING, Optional, Dict
@ -37,10 +37,12 @@ class Pig(BaseModel):
# data type: DanishPig # data type: DanishPig
oneof_schema_2_validator: Optional[DanishPig] = None oneof_schema_2_validator: Optional[DanishPig] = None
actual_instance: Optional[Union[BasquePig, 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] = { discriminator_value_class_map: Dict[str, str] = {
} }
@ -55,9 +57,9 @@ class Pig(BaseModel):
else: else:
super().__init__(**kwargs) super().__init__(**kwargs)
@validator('actual_instance') @field_validator('actual_instance')
def actual_instance_must_validate_oneof(cls, v): def actual_instance_must_validate_oneof(cls, v):
instance = Pig.construct() instance = Pig.model_construct()
error_messages = [] error_messages = []
match = 0 match = 0
# validate data type: BasquePig # validate data type: BasquePig
@ -86,7 +88,7 @@ class Pig(BaseModel):
@classmethod @classmethod
def from_json(cls, json_str: str) -> Pig: def from_json(cls, json_str: str) -> Pig:
"""Returns the object represented by the json string""" """Returns the object represented by the json string"""
instance = Pig.construct() instance = Pig.model_construct()
error_messages = [] error_messages = []
match = 0 match = 0
@ -137,6 +139,6 @@ class Pig(BaseModel):
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the actual instance""" """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 type_: Optional[StrictStr] = None
__properties = ["_type", "type", "type_"] __properties = ["_type", "type", "type_"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -52,7 +53,7 @@ class PropertyNameCollision(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -65,9 +66,9 @@ class PropertyNameCollision(BaseModel):
return None return None
if not isinstance(obj, dict): 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"), "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 baz: Optional[StrictStr] = None
__properties = ["bar", "baz"] __properties = ["bar", "baz"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -50,7 +51,7 @@ class ReadOnlyFirst(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
"bar", "bar",
}, },
@ -64,9 +65,9 @@ class ReadOnlyFirst(BaseModel):
return None return None
if not isinstance(obj, dict): 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"), "bar": obj.get("bar"),
"baz": obj.get("baz") "baz": obj.get("baz")
}) })

View File

@ -29,14 +29,15 @@ class SecondRef(BaseModel):
circular_ref: Optional[CircularReferenceModel] = None circular_ref: Optional[CircularReferenceModel] = None
__properties = ["category", "circular_ref"] __properties = ["category", "circular_ref"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -50,7 +51,7 @@ class SecondRef(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -66,9 +67,9 @@ class SecondRef(BaseModel):
return None return None
if not isinstance(obj, dict): 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"), "category": obj.get("category"),
"circular_ref": CircularReferenceModel.from_dict(obj.get("circular_ref")) if obj.get("circular_ref") is not None else None "circular_ref": CircularReferenceModel.from_dict(obj.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 nested: Optional[DummyModel] = None
__properties = ["size", "nested"] __properties = ["size", "nested"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -50,7 +51,7 @@ class SelfReferenceModel(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -66,9 +67,9 @@ class SelfReferenceModel(BaseModel):
return None return None
if not isinstance(obj, dict): 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"), "size": obj.get("size"),
"nested": DummyModel.from_dict(obj.get("nested")) if obj.get("nested") is not None else None "nested": DummyModel.from_dict(obj.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]") special_property_name: Optional[StrictInt] = Field(default=None, alias="$special[property.name]")
__properties = ["$special[property.name]"] __properties = ["$special[property.name]"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -50,7 +51,7 @@ class SpecialModelName(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -63,9 +64,9 @@ class SpecialModelName(BaseModel):
return None return None
if not isinstance(obj, dict): 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]") "$special[property.name]": obj.get("$special[property.name]")
}) })
return _obj return _obj

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -32,14 +32,15 @@ class WithNestedOneOf(BaseModel):
nested_oneof_enum_string: Optional[OneOfEnumString] = None nested_oneof_enum_string: Optional[OneOfEnumString] = None
__properties = ["size", "nested_pig", "nested_oneof_enum_string"] __properties = ["size", "nested_pig", "nested_oneof_enum_string"]
class Config: model_config = {
"""Pydantic configuration""" "populate_by_name": True,
allow_population_by_field_name = True "validate_assignment": True
validate_assignment = True }
def to_str(self) -> str: def to_str(self) -> str:
"""Returns the string representation of the model using alias""" """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: def to_json(self) -> str:
"""Returns the JSON representation of the model using alias""" """Returns the JSON representation of the model using alias"""
@ -53,7 +54,7 @@ class WithNestedOneOf(BaseModel):
def to_dict(self): def to_dict(self):
"""Returns the dictionary representation of the model using alias""" """Returns the dictionary representation of the model using alias"""
_dict = self.dict(by_alias=True, _dict = self.model_dump(by_alias=True,
exclude={ exclude={
}, },
exclude_none=True) exclude_none=True)
@ -72,9 +73,9 @@ class WithNestedOneOf(BaseModel):
return None return None
if not isinstance(obj, dict): 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"), "size": obj.get("size"),
"nested_pig": Pig.from_dict(obj.get("nested_pig")) if obj.get("nested_pig") is not None else None, "nested_pig": Pig.from_dict(obj.get("nested_pig")) if obj.get("nested_pig") is not None else None,
"nested_oneof_enum_string": OneOfEnumString.from_dict(obj.get("nested_oneof_enum_string")) if obj.get("nested_oneof_enum_string") is not None else None "nested_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 io
import warnings import warnings
from pydantic import validate_arguments, ValidationError from pydantic import validate_call, ValidationError
from pydantic import Field from pydantic import Field
from typing_extensions import Annotated from typing_extensions import Annotated
@ -42,7 +42,7 @@ class AnotherFakeApi:
api_client = ApiClient.get_default() api_client = ApiClient.get_default()
self.api_client = api_client 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 def call_123_test_special_tags(self, client : Annotated[Client, Field(description="client model")], **kwargs) -> Client: # noqa: E501
"""To test special tags # noqa: E501 """To test special tags # noqa: E501
@ -72,7 +72,7 @@ class AnotherFakeApi:
raise ValueError(message) raise ValueError(message)
return self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501 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 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 """To test special tags # noqa: E501

View File

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

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