Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ chardet==4.0.0
click==7.1.2
dnspython==2.1.0
email-validator==1.1.2
fastapi==0.95.2
fastapi==0.103.0
graphene==2.1.8
graphql-core==2.3.2
graphql-relay==2.0.1
Expand All @@ -20,7 +20,7 @@ Jinja2==2.11.3
MarkupSafe==2.0.1
orjson==3.5.2
promise==2.3
pydantic==1.8.2
pydantic==2.3.0
python-dotenv==0.17.1
python-multipart==0.0.5
PyYAML==5.4.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import re # noqa: F401
import io
import warnings

from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from typing_extensions import Annotated{{#asyncio}}
from typing import overload, Optional, Union, Awaitable{{/asyncio}}

Expand Down Expand Up @@ -46,7 +46,7 @@ class {{classname}}(object):
...

{{/asyncio}}
@validate_arguments
@validate_call
def {{operationId}}(self, {{#allParams}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/allParams}}{{#asyncio}}async_req: Optional[bool]=None, {{/asyncio}}**kwargs) -> {{#asyncio}}Union[{{{returnType}}}{{^returnType}}None{{/returnType}}, Awaitable[{{{returnType}}}{{^returnType}}None{{/returnType}}]]{{/asyncio}}{{^asyncio}}{{{returnType}}}{{^returnType}}None{{/returnType}}{{/asyncio}}: # noqa: E501
"""{{#isDeprecated}}(Deprecated) {{/isDeprecated}}{{{summary}}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501

Expand Down Expand Up @@ -83,7 +83,7 @@ class {{classname}}(object):
{{/asyncio}}
return self.{{operationId}}_with_http_info({{#allParams}}{{paramName}}, {{/allParams}}**kwargs) # noqa: E501

@validate_arguments
@validate_call
def {{operationId}}_with_http_info(self, {{#allParams}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/allParams}}**kwargs) -> ApiResponse: # noqa: E501
"""{{#isDeprecated}}(Deprecated) {{/isDeprecated}}{{{summary}}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
actual_instance: Any
any_of_schemas: List[str] = Field({{#lambda.uppercase}}{{{classname}}}{{/lambda.uppercase}}_ANY_OF_SCHEMAS, const=True)

class Config:
validate_assignment = True
model_config = {
"validate_assignment": True,
}
{{#discriminator}}

discriminator_value_class_map = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
{{/isEnum}}
{{/vars}}

class Config:
"""Pydantic configuration"""
allow_population_by_field_name = True
validate_assignment = True
"""Pydantic configuration"""
model_config = {
"populate_by_name": True,
"validate_assignment": True,
}

{{#hasChildren}}
{{#discriminator}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import re # noqa: F401
from typing import Union, Any, List, TYPE_CHECKING
from pydantic import StrictStr, Field

{{#lambda.uppercase}}{{{classname}}}{{/lambda.uppercase}}_ONE_OF_SCHEMAS = [{{#oneOf}}"{{.}}"{{^-last}}, {{/-last}}{{/oneOf}}]

class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}):
"""
{{{description}}}{{^description}}{{{classname}}}{{/description}}
Expand All @@ -26,10 +24,11 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
actual_instance: Union[{{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}]
else:
actual_instance: Any
one_of_schemas: List[str] = Field({{#lambda.uppercase}}{{{classname}}}{{/lambda.uppercase}}_ONE_OF_SCHEMAS, const=True)
one_of_schemas: List[str] = Literal[{{#oneOf}}"{{.}}"{{^-last}}, {{/-last}}{{/oneOf}}]

class Config:
validate_assignment = True
model_config = {
"validate_assignment": True,
}
{{#discriminator}}

discriminator_value_class_map = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tornado = ">=4.2,<5"
pem = ">= 19.3.0"
pycryptodome = ">= 3.9.0"
{{/hasHttpSignatureMethods}}
pydantic = "^1.10.5, <2"
pydantic = ">=2"
aenum = ">=3.1.11"

[tool.poetry.dev-dependencies]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
python_dateutil >= 2.5.3
setuptools >= 21.0.0
urllib3 >= 1.25.3, < 2.1.0
pydantic >= 1.10.5, < 2
pydantic >= 2
aenum >= 3.1.11
{{#asyncio}}
aiohttp >= 3.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ REQUIRES = [
"pem>=19.3.0",
"pycryptodome>=3.9.0",
{{/hasHttpSignatureMethods}}
"pydantic >= 1.10.5, < 2",
"pydantic >= 2",
"aenum"
]

Expand Down
30 changes: 15 additions & 15 deletions samples/client/echo_api/python/openapi_client/api/body_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import io
import warnings

from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from typing_extensions import Annotated

from pydantic import Field, StrictBytes, StrictStr, conlist
Expand Down Expand Up @@ -47,7 +47,7 @@ def __init__(self, api_client=None):
api_client = ApiClient.get_default()
self.api_client = api_client

@validate_arguments
@validate_call
def test_binary_gif(self, **kwargs) -> bytearray: # noqa: E501
"""Test binary (gif) response body # noqa: E501

Expand All @@ -74,7 +74,7 @@ def test_binary_gif(self, **kwargs) -> bytearray: # noqa: E501
raise ValueError("Error! Please call the test_binary_gif_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
return self.test_binary_gif_with_http_info(**kwargs) # noqa: E501

@validate_arguments
@validate_call
def test_binary_gif_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501
"""Test binary (gif) response body # noqa: E501

Expand Down Expand Up @@ -178,7 +178,7 @@ def test_binary_gif_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))

@validate_arguments
@validate_call
def test_body_application_octetstream_binary(self, body : Optional[Union[StrictBytes, StrictStr]] = None, **kwargs) -> str: # noqa: E501
"""Test body parameter(s) # noqa: E501

Expand Down Expand Up @@ -207,7 +207,7 @@ def test_body_application_octetstream_binary(self, body : Optional[Union[StrictB
raise ValueError("Error! Please call the test_body_application_octetstream_binary_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
return self.test_body_application_octetstream_binary_with_http_info(body, **kwargs) # noqa: E501

@validate_arguments
@validate_call
def test_body_application_octetstream_binary_with_http_info(self, body : Optional[Union[StrictBytes, StrictStr]] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test body parameter(s) # noqa: E501

Expand Down Expand Up @@ -329,7 +329,7 @@ def test_body_application_octetstream_binary_with_http_info(self, body : Optiona
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))

@validate_arguments
@validate_call
def test_body_multipart_formdata_array_of_binary(self, files : conlist(Union[StrictBytes, StrictStr]), **kwargs) -> str: # noqa: E501
"""Test array of binary in multipart mime # noqa: E501

Expand Down Expand Up @@ -358,7 +358,7 @@ def test_body_multipart_formdata_array_of_binary(self, files : conlist(Union[Str
raise ValueError("Error! Please call the test_body_multipart_formdata_array_of_binary_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
return self.test_body_multipart_formdata_array_of_binary_with_http_info(files, **kwargs) # noqa: E501

@validate_arguments
@validate_call
def test_body_multipart_formdata_array_of_binary_with_http_info(self, files : conlist(Union[StrictBytes, StrictStr]), **kwargs) -> ApiResponse: # noqa: E501
"""Test array of binary in multipart mime # noqa: E501

Expand Down Expand Up @@ -476,7 +476,7 @@ def test_body_multipart_formdata_array_of_binary_with_http_info(self, files : co
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))

@validate_arguments
@validate_call
def test_echo_body_free_form_object_response_string(self, body : Annotated[Optional[Dict[str, Any]], Field(description="Free form object")] = None, **kwargs) -> str: # noqa: E501
"""Test free form object # noqa: E501

Expand Down Expand Up @@ -505,7 +505,7 @@ def test_echo_body_free_form_object_response_string(self, body : Annotated[Optio
raise ValueError("Error! Please call the test_echo_body_free_form_object_response_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
return self.test_echo_body_free_form_object_response_string_with_http_info(body, **kwargs) # noqa: E501

@validate_arguments
@validate_call
def test_echo_body_free_form_object_response_string_with_http_info(self, body : Annotated[Optional[Dict[str, Any]], Field(description="Free form object")] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test free form object # noqa: E501

Expand Down Expand Up @@ -622,7 +622,7 @@ def test_echo_body_free_form_object_response_string_with_http_info(self, body :
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))

@validate_arguments
@validate_call
def test_echo_body_pet(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> Pet: # noqa: E501
"""Test body parameter(s) # noqa: E501

Expand Down Expand Up @@ -651,7 +651,7 @@ def test_echo_body_pet(self, pet : Annotated[Optional[Pet], Field(description="P
raise ValueError("Error! Please call the test_echo_body_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
return self.test_echo_body_pet_with_http_info(pet, **kwargs) # noqa: E501

@validate_arguments
@validate_call
def test_echo_body_pet_with_http_info(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test body parameter(s) # noqa: E501

Expand Down Expand Up @@ -768,7 +768,7 @@ def test_echo_body_pet_with_http_info(self, pet : Annotated[Optional[Pet], Field
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))

@validate_arguments
@validate_call
def test_echo_body_pet_response_string(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> str: # noqa: E501
"""Test empty response body # noqa: E501

Expand Down Expand Up @@ -797,7 +797,7 @@ def test_echo_body_pet_response_string(self, pet : Annotated[Optional[Pet], Fiel
raise ValueError("Error! Please call the test_echo_body_pet_response_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
return self.test_echo_body_pet_response_string_with_http_info(pet, **kwargs) # noqa: E501

@validate_arguments
@validate_call
def test_echo_body_pet_response_string_with_http_info(self, pet : Annotated[Optional[Pet], Field(description="Pet object that needs to be added to the store")] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test empty response body # noqa: E501

Expand Down Expand Up @@ -914,7 +914,7 @@ def test_echo_body_pet_response_string_with_http_info(self, pet : Annotated[Opti
collection_formats=_collection_formats,
_request_auth=_params.get('_request_auth'))

@validate_arguments
@validate_call
def test_echo_body_tag_response_string(self, tag : Annotated[Optional[Tag], Field(description="Tag object")] = None, **kwargs) -> str: # noqa: E501
"""Test empty json (request body) # noqa: E501

Expand Down Expand Up @@ -943,7 +943,7 @@ def test_echo_body_tag_response_string(self, tag : Annotated[Optional[Tag], Fiel
raise ValueError("Error! Please call the test_echo_body_tag_response_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
return self.test_echo_body_tag_response_string_with_http_info(tag, **kwargs) # noqa: E501

@validate_arguments
@validate_call
def test_echo_body_tag_response_string_with_http_info(self, tag : Annotated[Optional[Tag], Field(description="Tag object")] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test empty json (request body) # noqa: E501

Expand Down
6 changes: 3 additions & 3 deletions samples/client/echo_api/python/openapi_client/api/form_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import io
import warnings

from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from typing_extensions import Annotated

from pydantic import StrictBool, StrictInt, StrictStr
Expand Down Expand Up @@ -45,7 +45,7 @@ def __init__(self, api_client=None):
api_client = ApiClient.get_default()
self.api_client = api_client

@validate_arguments
@validate_call
def test_form_integer_boolean_string(self, integer_form : Optional[StrictInt] = None, boolean_form : Optional[StrictBool] = None, string_form : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501
"""Test form parameter(s) # noqa: E501

Expand Down Expand Up @@ -78,7 +78,7 @@ def test_form_integer_boolean_string(self, integer_form : Optional[StrictInt] =
raise ValueError("Error! Please call the test_form_integer_boolean_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
return self.test_form_integer_boolean_string_with_http_info(integer_form, boolean_form, string_form, **kwargs) # noqa: E501

@validate_arguments
@validate_call
def test_form_integer_boolean_string_with_http_info(self, integer_form : Optional[StrictInt] = None, boolean_form : Optional[StrictBool] = None, string_form : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test form parameter(s) # noqa: E501

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import io
import warnings

from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from typing_extensions import Annotated

from pydantic import StrictBool, StrictInt, StrictStr
Expand Down Expand Up @@ -45,7 +45,7 @@ def __init__(self, api_client=None):
api_client = ApiClient.get_default()
self.api_client = api_client

@validate_arguments
@validate_call
def test_header_integer_boolean_string(self, integer_header : Optional[StrictInt] = None, boolean_header : Optional[StrictBool] = None, string_header : Optional[StrictStr] = None, **kwargs) -> str: # noqa: E501
"""Test header parameter(s) # noqa: E501

Expand Down Expand Up @@ -78,7 +78,7 @@ def test_header_integer_boolean_string(self, integer_header : Optional[StrictInt
raise ValueError("Error! Please call the test_header_integer_boolean_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
return self.test_header_integer_boolean_string_with_http_info(integer_header, boolean_header, string_header, **kwargs) # noqa: E501

@validate_arguments
@validate_call
def test_header_integer_boolean_string_with_http_info(self, integer_header : Optional[StrictInt] = None, boolean_header : Optional[StrictBool] = None, string_header : Optional[StrictStr] = None, **kwargs) -> ApiResponse: # noqa: E501
"""Test header parameter(s) # noqa: E501

Expand Down
6 changes: 3 additions & 3 deletions samples/client/echo_api/python/openapi_client/api/path_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import io
import warnings

from pydantic import validate_arguments, ValidationError
from pydantic import validate_call, ValidationError
from typing_extensions import Annotated

from pydantic import StrictInt, StrictStr
Expand All @@ -43,7 +43,7 @@ def __init__(self, api_client=None):
api_client = ApiClient.get_default()
self.api_client = api_client

@validate_arguments
@validate_call
def tests_path_string_path_string_integer_path_integer(self, path_string : StrictStr, path_integer : StrictInt, **kwargs) -> str: # noqa: E501
"""Test path parameter(s) # noqa: E501

Expand Down Expand Up @@ -74,7 +74,7 @@ def tests_path_string_path_string_integer_path_integer(self, path_string : Stric
raise ValueError("Error! Please call the tests_path_string_path_string_integer_path_integer_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
return self.tests_path_string_path_string_integer_path_integer_with_http_info(path_string, path_integer, **kwargs) # noqa: E501

@validate_arguments
@validate_call
def tests_path_string_path_string_integer_path_integer_with_http_info(self, path_string : StrictStr, path_integer : StrictInt, **kwargs) -> ApiResponse: # noqa: E501
"""Test path parameter(s) # noqa: E501

Expand Down
Loading