From b5d4fa9d2778fe2588a64c30bb076b1a65d2cb9a Mon Sep 17 00:00:00 2001 From: William Cheng Date: Sun, 26 Feb 2023 10:21:26 +0800 Subject: [PATCH] fix unique items in python nextgen client (#14816) --- .../languages/PythonNextgenClientCodegen.java | 66 ++++++++----------- ...ith-fake-endpoints-models-for-testing.yaml | 1 + .../openapi_client/models/default_value.py | 16 ++--- .../openapi_client/models/pet.py | 6 +- .../openapi_client/models/query.py | 4 +- ...rue_array_string_query_object_parameter.py | 4 +- .../petstore_api/api/fake_api.py | 8 +-- .../petstore_api/api/pet_api.py | 10 +-- .../petstore_api/api/user_api.py | 12 ++-- .../petstore_api/models/any_of_color.py | 2 +- .../models/array_of_array_of_number_only.py | 4 +- .../models/array_of_number_only.py | 4 +- .../petstore_api/models/array_test.py | 4 +- .../petstore_api/models/enum_arrays.py | 4 +- .../models/file_schema_test_class.py | 4 +- .../petstore_api/models/nullable_class.py | 8 +-- .../models/object_with_deprecated_fields.py | 4 +- .../petstore_api/models/pet.py | 6 +- .../petstore_api/api/fake_api.py | 8 +-- .../petstore_api/api/pet_api.py | 10 +-- .../petstore_api/api/user_api.py | 12 ++-- .../petstore_api/models/any_of_color.py | 2 +- .../models/array_of_array_of_number_only.py | 4 +- .../models/array_of_number_only.py | 4 +- .../petstore_api/models/array_test.py | 4 +- .../petstore_api/models/enum_arrays.py | 4 +- .../models/file_schema_test_class.py | 4 +- .../petstore_api/models/nullable_class.py | 8 +-- .../models/object_with_deprecated_fields.py | 4 +- .../python-nextgen/petstore_api/models/pet.py | 6 +- 30 files changed, 111 insertions(+), 126 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonNextgenClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonNextgenClientCodegen.java index 06d05a3a50a..6421b059150 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonNextgenClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonNextgenClientCodegen.java @@ -403,23 +403,20 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements } if (cp.isArray) { - if (cp.maxItems != null || cp.minItems != null) { - String maxOrMinItems = ""; - if (cp.maxItems != null) { - maxOrMinItems += String.format(Locale.ROOT, ", max_items=%d", cp.maxItems); - } - if (cp.minItems != null) { - maxOrMinItems += String.format(Locale.ROOT, ", min_items=%d", cp.minItems); - } - pydanticImports.add("conlist"); - return String.format(Locale.ROOT, "conlist(%s%s)", - getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports), - maxOrMinItems); - - } else { - typingImports.add("List"); - return String.format(Locale.ROOT, "List[%s]", getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports)); + String constraints = ""; + if (cp.maxItems != null) { + constraints += String.format(Locale.ROOT, ", max_items=%d", cp.maxItems); } + if (cp.minItems != null) { + constraints += String.format(Locale.ROOT, ", min_items=%d", cp.minItems); + } + if (cp.getUniqueItems()) { + constraints += ", unique_items=True"; + } + pydanticImports.add("conlist"); + return String.format(Locale.ROOT, "conlist(%s%s)", + getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports), + constraints); } else if (cp.isMap) { typingImports.add("Dict"); return String.format(Locale.ROOT, "Dict[str, %s]", getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports)); @@ -653,22 +650,21 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements return String.format(Locale.ROOT, "%sEnum", cp.nameInCamelCase); } else*/ if (cp.isArray) { - if (cp.maxItems != null || cp.minItems != null) { - String maxOrMinItems = ""; - if (cp.maxItems != null) { - maxOrMinItems += String.format(Locale.ROOT, ", max_items=%d", cp.maxItems); - } - if (cp.minItems != null) { - maxOrMinItems += String.format(Locale.ROOT, ", min_items=%d", cp.minItems); - } - pydanticImports.add("conlist"); - return String.format(Locale.ROOT, "conlist(%s%s)", - getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports), - maxOrMinItems); - } else { - typingImports.add("List"); - return String.format(Locale.ROOT, "List[%s]", getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports)); + String constraints = ""; + if (cp.maxItems != null) { + constraints += String.format(Locale.ROOT, ", max_items=%d", cp.maxItems); } + if (cp.minItems != null) { + constraints += String.format(Locale.ROOT, ", min_items=%d", cp.minItems); + } + if (cp.getUniqueItems()) { + constraints += ", unique_items=True"; + } + pydanticImports.add("conlist"); + typingImports.add("List"); // for return type + return String.format(Locale.ROOT, "conlist(%s%s)", + getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports), + constraints); } else if (cp.isMap) { typingImports.add("Dict"); return String.format(Locale.ROOT, "Dict[str, %s]", getPydanticType(cp.items, typingImports, pydanticImports, datetimeImports, modelImports)); @@ -884,10 +880,6 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements fields.add(String.format(Locale.ROOT, "description=\"%s\"", param.description)); } - if (param.isArray && param.getUniqueItems()) { // a set - fields.add("unique_items=True"); - } - /* TODO support example if (!StringUtils.isEmpty(cp.getExample())) { // has example fields.add(String.format(Locale.ROOT, "example=%s", cp.getExample())); @@ -1071,10 +1063,6 @@ public class PythonNextgenClientCodegen extends AbstractPythonCodegen implements fields.add(String.format(Locale.ROOT, "description=\"%s\"", cp.description)); } - if (cp.isArray && cp.getUniqueItems()) { // a set - fields.add("unique_items=True"); - } - /* TODO review as example may break the build if (!StringUtils.isEmpty(cp.getExample())) { // has example fields.add(String.format(Locale.ROOT, "example=%s", cp.getExample())); diff --git a/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml index 512030a976b..6e228f38056 100644 --- a/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/python/petstore-with-fake-endpoints-models-for-testing.yaml @@ -1417,6 +1417,7 @@ components: type: string example: doggie photoUrls: + minItems: 0 type: array xml: name: photoUrl diff --git a/samples/client/echo_api/python-nextgen/openapi_client/models/default_value.py b/samples/client/echo_api/python-nextgen/openapi_client/models/default_value.py index ffe04f36996..6ba3e69d2b9 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/models/default_value.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/models/default_value.py @@ -19,7 +19,7 @@ import json from typing import List, Optional -from pydantic import BaseModel, StrictInt, StrictStr, validator +from pydantic import BaseModel, StrictInt, StrictStr, conlist, validator from openapi_client.models.string_enum_ref import StringEnumRef class DefaultValue(BaseModel): @@ -28,13 +28,13 @@ class DefaultValue(BaseModel): Do not edit the class manually. """ - array_string_enum_ref_default: Optional[List[StringEnumRef]] = None - array_string_enum_default: Optional[List[StrictStr]] = None - array_string_default: Optional[List[StrictStr]] = None - array_integer_default: Optional[List[StrictInt]] = None - array_string: Optional[List[StrictStr]] = None - array_string_nullable: Optional[List[StrictStr]] = None - array_string_extension_nullable: Optional[List[StrictStr]] = None + array_string_enum_ref_default: Optional[conlist(StringEnumRef)] = None + array_string_enum_default: Optional[conlist(StrictStr)] = None + array_string_default: Optional[conlist(StrictStr)] = None + array_integer_default: Optional[conlist(StrictInt)] = None + array_string: Optional[conlist(StrictStr)] = None + array_string_nullable: Optional[conlist(StrictStr)] = None + array_string_extension_nullable: Optional[conlist(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"] diff --git a/samples/client/echo_api/python-nextgen/openapi_client/models/pet.py b/samples/client/echo_api/python-nextgen/openapi_client/models/pet.py index c74807ca1af..dffafa94de7 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/models/pet.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/models/pet.py @@ -19,7 +19,7 @@ import json from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, validator +from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator from openapi_client.models.category import Category from openapi_client.models.tag import Tag @@ -32,8 +32,8 @@ class Pet(BaseModel): id: Optional[StrictInt] = None name: StrictStr = ... category: Optional[Category] = None - photo_urls: List[StrictStr] = Field(..., alias="photoUrls") - tags: Optional[List[Tag]] = None + photo_urls: conlist(StrictStr) = Field(..., alias="photoUrls") + tags: Optional[conlist(Tag)] = None status: Optional[StrictStr] = Field(None, description="pet status in the store") __properties = ["id", "name", "category", "photoUrls", "tags", "status"] diff --git a/samples/client/echo_api/python-nextgen/openapi_client/models/query.py b/samples/client/echo_api/python-nextgen/openapi_client/models/query.py index e7ecfd7d02d..a62d59ce9a1 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/models/query.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/models/query.py @@ -19,7 +19,7 @@ import json from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, validator +from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator class Query(BaseModel): """NOTE: This class is auto generated by OpenAPI Generator. @@ -28,7 +28,7 @@ class Query(BaseModel): Do not edit the class manually. """ id: Optional[StrictInt] = Field(None, description="Query") - outcomes: Optional[List[StrictStr]] = None + outcomes: Optional[conlist(StrictStr)] = None __properties = ["id", "outcomes"] @validator('outcomes') diff --git a/samples/client/echo_api/python-nextgen/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py b/samples/client/echo_api/python-nextgen/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py index 1659363d203..955e3f61f95 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py @@ -19,7 +19,7 @@ import json from typing import List, Optional -from pydantic import BaseModel, StrictStr +from pydantic import BaseModel, StrictStr, conlist class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(BaseModel): """NOTE: This class is auto generated by OpenAPI Generator. @@ -27,7 +27,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(BaseModel): Do not edit the class manually. """ - values: Optional[List[StrictStr]] = None + values: Optional[conlist(StrictStr)] = None __properties = ["values"] class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/fake_api.py index 7892fd70681..07b83d83fd9 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/fake_api.py @@ -19,9 +19,9 @@ from typing_extensions import Annotated from datetime import date, datetime -from pydantic import Field, StrictBool, StrictInt, StrictStr, confloat, conint, constr, validator +from pydantic import Field, StrictBool, StrictInt, StrictStr, confloat, conint, conlist, constr, validator -from typing import Dict, List, Optional +from typing import Dict, Optional from petstore_api.models.client import Client from petstore_api.models.file_schema_test_class import FileSchemaTestClass @@ -2522,7 +2522,7 @@ class FakeApi(object): _request_auth=_params.get('_request_auth')) @validate_arguments - 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 + def test_query_parameter_collection_format(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> None: # noqa: E501 """test_query_parameter_collection_format # noqa: E501 To test the collection format in query parameters # noqa: E501 @@ -2565,7 +2565,7 @@ class FakeApi(object): return self.test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, url, context, allow_empty, language, **kwargs) # noqa: E501 @validate_arguments - 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): # noqa: E501 + def test_query_parameter_collection_format_with_http_info(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs): # noqa: E501 """test_query_parameter_collection_format # noqa: E501 To test the collection format in query parameters # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/pet_api.py index 72bbd378d6d..f908023d136 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/pet_api.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/pet_api.py @@ -17,7 +17,7 @@ import re # noqa: F401 from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated -from pydantic import Field, StrictInt, StrictStr, validator +from pydantic import Field, StrictInt, StrictStr, conlist, validator from typing import List, Optional @@ -332,7 +332,7 @@ class PetApi(object): _request_auth=_params.get('_request_auth')) @validate_arguments - 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 + def find_pets_by_status(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs) -> List[Pet]: # noqa: E501 """Finds Pets by status # noqa: E501 Multiple status values can be provided with comma separated strings # noqa: E501 @@ -363,7 +363,7 @@ class PetApi(object): return self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501 @validate_arguments - 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): # noqa: E501 + def find_pets_by_status_with_http_info(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs): # noqa: E501 """Finds Pets by status # noqa: E501 Multiple status values can be provided with comma separated strings # noqa: E501 @@ -477,7 +477,7 @@ class PetApi(object): _request_auth=_params.get('_request_auth')) @validate_arguments - def find_pets_by_tags(self, tags : Annotated[List[StrictStr], Field(..., description="Tags to filter by", unique_items=True)], **kwargs) -> List[Pet]: # noqa: E501 + def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs) -> List[Pet]: # noqa: E501 """Finds Pets by tags # noqa: E501 Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501 @@ -508,7 +508,7 @@ class PetApi(object): return self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501 @validate_arguments - def find_pets_by_tags_with_http_info(self, tags : Annotated[List[StrictStr], Field(..., description="Tags to filter by", unique_items=True)], **kwargs): # noqa: E501 + def find_pets_by_tags_with_http_info(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs): # noqa: E501 """Finds Pets by tags # noqa: E501 Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/user_api.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/user_api.py index 5eba7fa1eef..e83dfdeff83 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/user_api.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/user_api.py @@ -17,9 +17,7 @@ import re # noqa: F401 from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated -from pydantic import Field, StrictStr - -from typing import List +from pydantic import Field, StrictStr, conlist from petstore_api.models.user import User @@ -202,7 +200,7 @@ class UserApi(object): _request_auth=_params.get('_request_auth')) @validate_arguments - def create_users_with_array_input(self, user : Annotated[List[User], Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501 + def create_users_with_array_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501 """Creates list of users with given input array # noqa: E501 # noqa: E501 @@ -233,7 +231,7 @@ class UserApi(object): return self.create_users_with_array_input_with_http_info(user, **kwargs) # noqa: E501 @validate_arguments - def create_users_with_array_input_with_http_info(self, user : Annotated[List[User], Field(..., description="List of user object")], **kwargs): # noqa: E501 + def create_users_with_array_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs): # noqa: E501 """Creates list of users with given input array # noqa: E501 # noqa: E501 @@ -346,7 +344,7 @@ class UserApi(object): _request_auth=_params.get('_request_auth')) @validate_arguments - def create_users_with_list_input(self, user : Annotated[List[User], Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501 + def create_users_with_list_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501 """Creates list of users with given input array # noqa: E501 # noqa: E501 @@ -377,7 +375,7 @@ class UserApi(object): return self.create_users_with_list_input_with_http_info(user, **kwargs) # noqa: E501 @validate_arguments - def create_users_with_list_input_with_http_info(self, user : Annotated[List[User], Field(..., description="List of user object")], **kwargs): # noqa: E501 + def create_users_with_list_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs): # noqa: E501 """Creates list of users with given input array # noqa: E501 # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/any_of_color.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/any_of_color.py index 8c7f51a174e..2a44d37581b 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/any_of_color.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/any_of_color.py @@ -16,7 +16,7 @@ import json import pprint import re # noqa: F401 -from typing import Optional +from typing import List, Optional from pydantic import BaseModel, Field, StrictStr, ValidationError, conint, conlist, constr, validator from typing import Any, List from pydantic import StrictStr, Field diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_of_array_of_number_only.py index c284f35caaf..a023c9c0d0c 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_of_array_of_number_only.py @@ -18,7 +18,7 @@ import json from typing import List, Optional -from pydantic import BaseModel, Field +from pydantic import BaseModel, Field, conlist class ArrayOfArrayOfNumberOnly(BaseModel): """NOTE: This class is auto generated by OpenAPI Generator. @@ -26,7 +26,7 @@ class ArrayOfArrayOfNumberOnly(BaseModel): Do not edit the class manually. """ - array_array_number: Optional[List[List[float]]] = Field(None, alias="ArrayArrayNumber") + array_array_number: Optional[conlist(conlist(float))] = Field(None, alias="ArrayArrayNumber") __properties = ["ArrayArrayNumber"] class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_of_number_only.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_of_number_only.py index c349a9e2ff3..ff80adc5878 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_of_number_only.py @@ -18,7 +18,7 @@ import json from typing import List, Optional -from pydantic import BaseModel, Field +from pydantic import BaseModel, Field, conlist class ArrayOfNumberOnly(BaseModel): """NOTE: This class is auto generated by OpenAPI Generator. @@ -26,7 +26,7 @@ class ArrayOfNumberOnly(BaseModel): Do not edit the class manually. """ - array_number: Optional[List[float]] = Field(None, alias="ArrayNumber") + array_number: Optional[conlist(float)] = Field(None, alias="ArrayNumber") __properties = ["ArrayNumber"] class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_test.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_test.py index 71506cb522b..c526a25201a 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_test.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/array_test.py @@ -28,8 +28,8 @@ class ArrayTest(BaseModel): Do not edit the class manually. """ array_of_string: Optional[conlist(StrictStr, max_items=3, min_items=0)] = None - array_array_of_integer: Optional[List[List[StrictInt]]] = None - array_array_of_model: Optional[List[List[ReadOnlyFirst]]] = None + array_array_of_integer: Optional[conlist(conlist(StrictInt))] = None + array_array_of_model: Optional[conlist(conlist(ReadOnlyFirst))] = None __properties = ["array_of_string", "array_array_of_integer", "array_array_of_model"] class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_arrays.py index b172e327c9b..1421b202998 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_arrays.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_arrays.py @@ -18,7 +18,7 @@ import json from typing import List, Optional -from pydantic import BaseModel, StrictStr, validator +from pydantic import BaseModel, StrictStr, conlist, validator class EnumArrays(BaseModel): """NOTE: This class is auto generated by OpenAPI Generator. @@ -27,7 +27,7 @@ class EnumArrays(BaseModel): Do not edit the class manually. """ just_symbol: Optional[StrictStr] = None - array_enum: Optional[List[StrictStr]] = None + array_enum: Optional[conlist(StrictStr)] = None __properties = ["just_symbol", "array_enum"] @validator('just_symbol') diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/file_schema_test_class.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/file_schema_test_class.py index 0a10b607a55..0c9641aa66b 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/file_schema_test_class.py @@ -18,7 +18,7 @@ import json from typing import List, Optional -from pydantic import BaseModel +from pydantic import BaseModel, conlist from petstore_api.models.file import File class FileSchemaTestClass(BaseModel): @@ -28,7 +28,7 @@ class FileSchemaTestClass(BaseModel): Do not edit the class manually. """ file: Optional[File] = None - files: Optional[List[File]] = None + files: Optional[conlist(File)] = None __properties = ["file", "files"] class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/nullable_class.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/nullable_class.py index 4965f314b0f..edf0ad22723 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/nullable_class.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/nullable_class.py @@ -18,7 +18,7 @@ import json from datetime import date, datetime from typing import Any, Dict, List, Optional -from pydantic import BaseModel, StrictBool, StrictInt, StrictStr +from pydantic import BaseModel, StrictBool, StrictInt, StrictStr, conlist class NullableClass(BaseModel): """NOTE: This class is auto generated by OpenAPI Generator. @@ -33,9 +33,9 @@ class NullableClass(BaseModel): string_prop: Optional[StrictStr] = None date_prop: Optional[date] = None datetime_prop: Optional[datetime] = None - array_nullable_prop: Optional[List[Dict[str, Any]]] = None - array_and_items_nullable_prop: Optional[List[Dict[str, Any]]] = None - array_items_nullable: Optional[List[Dict[str, Any]]] = None + array_nullable_prop: Optional[conlist(Dict[str, Any])] = None + array_and_items_nullable_prop: Optional[conlist(Dict[str, Any])] = None + array_items_nullable: Optional[conlist(Dict[str, Any])] = None object_nullable_prop: Optional[Dict[str, Dict[str, Any]]] = None object_and_items_nullable_prop: Optional[Dict[str, Dict[str, Any]]] = None object_items_nullable: Optional[Dict[str, Dict[str, Any]]] = None diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/object_with_deprecated_fields.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/object_with_deprecated_fields.py index a9f26f44256..fd38ee7af4a 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/object_with_deprecated_fields.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/object_with_deprecated_fields.py @@ -18,7 +18,7 @@ import json from typing import List, Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, Field, StrictStr, conlist from petstore_api.models.deprecated_object import DeprecatedObject class ObjectWithDeprecatedFields(BaseModel): @@ -30,7 +30,7 @@ class ObjectWithDeprecatedFields(BaseModel): uuid: Optional[StrictStr] = None id: Optional[float] = None deprecated_ref: Optional[DeprecatedObject] = Field(None, alias="deprecatedRef") - bars: Optional[List[StrictStr]] = None + bars: Optional[conlist(StrictStr)] = None __properties = ["uuid", "id", "deprecatedRef", "bars"] class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/pet.py index 1a45ae2a81c..bdff5742127 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/pet.py @@ -18,7 +18,7 @@ import json from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, validator +from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator from petstore_api.models.category import Category from petstore_api.models.tag import Tag @@ -31,8 +31,8 @@ class Pet(BaseModel): id: Optional[StrictInt] = None category: Optional[Category] = None name: StrictStr = ... - photo_urls: List[StrictStr] = Field(..., alias="photoUrls", unique_items=True) - tags: Optional[List[Tag]] = None + photo_urls: conlist(StrictStr, min_items=0, unique_items=True) = Field(..., alias="photoUrls") + tags: Optional[conlist(Tag)] = None status: Optional[StrictStr] = Field(None, description="pet status in the store") __properties = ["id", "category", "name", "photoUrls", "tags", "status"] diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/fake_api.py index 31ccfaeb3db..b3d5e667716 100755 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/fake_api.py @@ -19,9 +19,9 @@ from typing_extensions import Annotated from datetime import date, datetime -from pydantic import Field, StrictBool, StrictFloat, StrictInt, StrictStr, confloat, conint, constr, validator +from pydantic import Field, StrictBool, StrictFloat, StrictInt, StrictStr, confloat, conint, conlist, constr, validator -from typing import Dict, List, Optional +from typing import Dict, Optional from petstore_api.models.client import Client from petstore_api.models.file_schema_test_class import FileSchemaTestClass @@ -2522,7 +2522,7 @@ class FakeApi(object): _request_auth=_params.get('_request_auth')) @validate_arguments - 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 + def test_query_parameter_collection_format(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs) -> None: # noqa: E501 """test_query_parameter_collection_format # noqa: E501 To test the collection format in query parameters # noqa: E501 @@ -2565,7 +2565,7 @@ class FakeApi(object): return self.test_query_parameter_collection_format_with_http_info(pipe, ioutil, http, url, context, allow_empty, language, **kwargs) # noqa: E501 @validate_arguments - 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): # noqa: E501 + def test_query_parameter_collection_format_with_http_info(self, pipe : conlist(StrictStr), ioutil : conlist(StrictStr), http : conlist(StrictStr), url : conlist(StrictStr), context : conlist(StrictStr), allow_empty : StrictStr, language : Optional[Dict[str, StrictStr]] = None, **kwargs): # noqa: E501 """test_query_parameter_collection_format # noqa: E501 To test the collection format in query parameters # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/pet_api.py index 72bbd378d6d..f908023d136 100755 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/pet_api.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/pet_api.py @@ -17,7 +17,7 @@ import re # noqa: F401 from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated -from pydantic import Field, StrictInt, StrictStr, validator +from pydantic import Field, StrictInt, StrictStr, conlist, validator from typing import List, Optional @@ -332,7 +332,7 @@ class PetApi(object): _request_auth=_params.get('_request_auth')) @validate_arguments - 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 + def find_pets_by_status(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs) -> List[Pet]: # noqa: E501 """Finds Pets by status # noqa: E501 Multiple status values can be provided with comma separated strings # noqa: E501 @@ -363,7 +363,7 @@ class PetApi(object): return self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501 @validate_arguments - 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): # noqa: E501 + def find_pets_by_status_with_http_info(self, status : Annotated[conlist(StrictStr), Field(..., description="Status values that need to be considered for filter")], **kwargs): # noqa: E501 """Finds Pets by status # noqa: E501 Multiple status values can be provided with comma separated strings # noqa: E501 @@ -477,7 +477,7 @@ class PetApi(object): _request_auth=_params.get('_request_auth')) @validate_arguments - def find_pets_by_tags(self, tags : Annotated[List[StrictStr], Field(..., description="Tags to filter by", unique_items=True)], **kwargs) -> List[Pet]: # noqa: E501 + def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs) -> List[Pet]: # noqa: E501 """Finds Pets by tags # noqa: E501 Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501 @@ -508,7 +508,7 @@ class PetApi(object): return self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501 @validate_arguments - def find_pets_by_tags_with_http_info(self, tags : Annotated[List[StrictStr], Field(..., description="Tags to filter by", unique_items=True)], **kwargs): # noqa: E501 + def find_pets_by_tags_with_http_info(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs): # noqa: E501 """Finds Pets by tags # noqa: E501 Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/user_api.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/user_api.py index 5eba7fa1eef..e83dfdeff83 100755 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/user_api.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/user_api.py @@ -17,9 +17,7 @@ import re # noqa: F401 from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated -from pydantic import Field, StrictStr - -from typing import List +from pydantic import Field, StrictStr, conlist from petstore_api.models.user import User @@ -202,7 +200,7 @@ class UserApi(object): _request_auth=_params.get('_request_auth')) @validate_arguments - def create_users_with_array_input(self, user : Annotated[List[User], Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501 + def create_users_with_array_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501 """Creates list of users with given input array # noqa: E501 # noqa: E501 @@ -233,7 +231,7 @@ class UserApi(object): return self.create_users_with_array_input_with_http_info(user, **kwargs) # noqa: E501 @validate_arguments - def create_users_with_array_input_with_http_info(self, user : Annotated[List[User], Field(..., description="List of user object")], **kwargs): # noqa: E501 + def create_users_with_array_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs): # noqa: E501 """Creates list of users with given input array # noqa: E501 # noqa: E501 @@ -346,7 +344,7 @@ class UserApi(object): _request_auth=_params.get('_request_auth')) @validate_arguments - def create_users_with_list_input(self, user : Annotated[List[User], Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501 + def create_users_with_list_input(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs) -> None: # noqa: E501 """Creates list of users with given input array # noqa: E501 # noqa: E501 @@ -377,7 +375,7 @@ class UserApi(object): return self.create_users_with_list_input_with_http_info(user, **kwargs) # noqa: E501 @validate_arguments - def create_users_with_list_input_with_http_info(self, user : Annotated[List[User], Field(..., description="List of user object")], **kwargs): # noqa: E501 + def create_users_with_list_input_with_http_info(self, user : Annotated[conlist(User), Field(..., description="List of user object")], **kwargs): # noqa: E501 """Creates list of users with given input array # noqa: E501 # noqa: E501 diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/any_of_color.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/any_of_color.py index 8c7f51a174e..2a44d37581b 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/any_of_color.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/any_of_color.py @@ -16,7 +16,7 @@ import json import pprint import re # noqa: F401 -from typing import Optional +from typing import List, Optional from pydantic import BaseModel, Field, StrictStr, ValidationError, conint, conlist, constr, validator from typing import Any, List from pydantic import StrictStr, Field diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_of_array_of_number_only.py index 3ed982a658c..6ad248d5613 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_of_array_of_number_only.py @@ -18,7 +18,7 @@ import json from typing import List, Optional -from pydantic import BaseModel, Field, StrictFloat +from pydantic import BaseModel, Field, StrictFloat, conlist class ArrayOfArrayOfNumberOnly(BaseModel): """NOTE: This class is auto generated by OpenAPI Generator. @@ -26,7 +26,7 @@ class ArrayOfArrayOfNumberOnly(BaseModel): Do not edit the class manually. """ - array_array_number: Optional[List[List[StrictFloat]]] = Field(None, alias="ArrayArrayNumber") + array_array_number: Optional[conlist(conlist(StrictFloat))] = Field(None, alias="ArrayArrayNumber") additional_properties: Dict[str, Any] = {} __properties = ["ArrayArrayNumber"] diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_of_number_only.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_of_number_only.py index 7d48697bba8..b0bade0c265 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_of_number_only.py @@ -18,7 +18,7 @@ import json from typing import List, Optional -from pydantic import BaseModel, Field, StrictFloat +from pydantic import BaseModel, Field, StrictFloat, conlist class ArrayOfNumberOnly(BaseModel): """NOTE: This class is auto generated by OpenAPI Generator. @@ -26,7 +26,7 @@ class ArrayOfNumberOnly(BaseModel): Do not edit the class manually. """ - array_number: Optional[List[StrictFloat]] = Field(None, alias="ArrayNumber") + array_number: Optional[conlist(StrictFloat)] = Field(None, alias="ArrayNumber") additional_properties: Dict[str, Any] = {} __properties = ["ArrayNumber"] diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_test.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_test.py index 0158ab990d2..23024b0959c 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_test.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/array_test.py @@ -28,8 +28,8 @@ class ArrayTest(BaseModel): Do not edit the class manually. """ array_of_string: Optional[conlist(StrictStr, max_items=3, min_items=0)] = None - array_array_of_integer: Optional[List[List[StrictInt]]] = None - array_array_of_model: Optional[List[List[ReadOnlyFirst]]] = None + array_array_of_integer: Optional[conlist(conlist(StrictInt))] = None + array_array_of_model: Optional[conlist(conlist(ReadOnlyFirst))] = None additional_properties: Dict[str, Any] = {} __properties = ["array_of_string", "array_array_of_integer", "array_array_of_model"] diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_arrays.py index 75ec36fba52..b1754281dee 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_arrays.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_arrays.py @@ -18,7 +18,7 @@ import json from typing import List, Optional -from pydantic import BaseModel, StrictStr, validator +from pydantic import BaseModel, StrictStr, conlist, validator class EnumArrays(BaseModel): """NOTE: This class is auto generated by OpenAPI Generator. @@ -27,7 +27,7 @@ class EnumArrays(BaseModel): Do not edit the class manually. """ just_symbol: Optional[StrictStr] = None - array_enum: Optional[List[StrictStr]] = None + array_enum: Optional[conlist(StrictStr)] = None additional_properties: Dict[str, Any] = {} __properties = ["just_symbol", "array_enum"] diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/file_schema_test_class.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/file_schema_test_class.py index fd23428cfa9..7e8f5b1cc34 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/file_schema_test_class.py @@ -18,7 +18,7 @@ import json from typing import List, Optional -from pydantic import BaseModel +from pydantic import BaseModel, conlist from petstore_api.models.file import File class FileSchemaTestClass(BaseModel): @@ -28,7 +28,7 @@ class FileSchemaTestClass(BaseModel): Do not edit the class manually. """ file: Optional[File] = None - files: Optional[List[File]] = None + files: Optional[conlist(File)] = None additional_properties: Dict[str, Any] = {} __properties = ["file", "files"] diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/nullable_class.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/nullable_class.py index 449bb066f72..d3e41b7fa00 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/nullable_class.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/nullable_class.py @@ -18,7 +18,7 @@ import json from datetime import date, datetime from typing import Any, Dict, List, Optional -from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt, StrictStr +from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt, StrictStr, conlist class NullableClass(BaseModel): """NOTE: This class is auto generated by OpenAPI Generator. @@ -33,9 +33,9 @@ class NullableClass(BaseModel): string_prop: Optional[StrictStr] = None date_prop: Optional[date] = None datetime_prop: Optional[datetime] = None - array_nullable_prop: Optional[List[Dict[str, Any]]] = None - array_and_items_nullable_prop: Optional[List[Dict[str, Any]]] = None - array_items_nullable: Optional[List[Dict[str, Any]]] = None + array_nullable_prop: Optional[conlist(Dict[str, Any])] = None + array_and_items_nullable_prop: Optional[conlist(Dict[str, Any])] = None + array_items_nullable: Optional[conlist(Dict[str, Any])] = None object_nullable_prop: Optional[Dict[str, Dict[str, Any]]] = None object_and_items_nullable_prop: Optional[Dict[str, Dict[str, Any]]] = None object_items_nullable: Optional[Dict[str, Dict[str, Any]]] = None diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/object_with_deprecated_fields.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/object_with_deprecated_fields.py index aab3c82f09d..7f4fef2a658 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/object_with_deprecated_fields.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/object_with_deprecated_fields.py @@ -18,7 +18,7 @@ import json from typing import List, Optional -from pydantic import BaseModel, Field, StrictFloat, StrictStr +from pydantic import BaseModel, Field, StrictFloat, StrictStr, conlist from petstore_api.models.deprecated_object import DeprecatedObject class ObjectWithDeprecatedFields(BaseModel): @@ -30,7 +30,7 @@ class ObjectWithDeprecatedFields(BaseModel): uuid: Optional[StrictStr] = None id: Optional[StrictFloat] = None deprecated_ref: Optional[DeprecatedObject] = Field(None, alias="deprecatedRef") - bars: Optional[List[StrictStr]] = None + bars: Optional[conlist(StrictStr)] = None additional_properties: Dict[str, Any] = {} __properties = ["uuid", "id", "deprecatedRef", "bars"] diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/pet.py index 962894972b1..de8df07a07f 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/pet.py @@ -18,7 +18,7 @@ import json from typing import List, Optional -from pydantic import BaseModel, Field, StrictInt, StrictStr, validator +from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist, validator from petstore_api.models.category import Category from petstore_api.models.tag import Tag @@ -31,8 +31,8 @@ class Pet(BaseModel): id: Optional[StrictInt] = None category: Optional[Category] = None name: StrictStr = ... - photo_urls: List[StrictStr] = Field(..., alias="photoUrls", unique_items=True) - tags: Optional[List[Tag]] = None + photo_urls: conlist(StrictStr, min_items=0, unique_items=True) = Field(..., alias="photoUrls") + tags: Optional[conlist(Tag)] = None status: Optional[StrictStr] = Field(None, description="pet status in the store") additional_properties: Dict[str, Any] = {} __properties = ["id", "category", "name", "photoUrls", "tags", "status"]