From c6e9a4e1ae87793dda3b251e38b7fe6d636863b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=B5=E3=81=81?= <34892635+fa0311@users.noreply.github.com> Date: Sun, 1 Oct 2023 17:52:23 +0900 Subject: [PATCH] [python] change Private attr to Class vars (#16687) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [python] fix TypeError Signed-off-by: ふぁ * [python] update Private model attributes to Class vars Signed-off-by: ふぁ * [python] rename the List of test cases to ListClass Signed-off-by: ふぁ * [python] update samples Signed-off-by: ふぁ * [python] rename the List of v1 test cases to ListClass Signed-off-by: ふぁ * [python] rename the List of v1-aiohttp test cases to ListClass Signed-off-by: ふぁ * update samples --------- Signed-off-by: ふぁ Co-authored-by: William Cheng --- .../languages/AbstractPythonCodegen.java | 2 + .../resources/python/model_generic.mustache | 26 +++--- ...ith-fake-endpoints-models-for-testing.yaml | 2 +- .../python/openapi_client/models/bird.py | 2 +- .../python/openapi_client/models/category.py | 2 +- .../openapi_client/models/data_query.py | 2 +- .../openapi_client/models/default_value.py | 2 +- .../models/number_properties_only.py | 2 +- .../python/openapi_client/models/pet.py | 2 +- .../python/openapi_client/models/query.py | 2 +- .../python/openapi_client/models/tag.py | 2 +- ...ue_object_all_of_query_object_parameter.py | 2 +- ...rue_array_string_query_object_parameter.py | 2 +- .../python-aiohttp/.openapi-generator/FILES | 4 +- .../client/petstore/python-aiohttp/README.md | 2 +- .../petstore/python-aiohttp/docs/ListClass.md | 28 ++++++ .../python-aiohttp/petstore_api/__init__.py | 2 +- .../petstore_api/models/__init__.py | 2 +- .../models/additional_properties_any_type.py | 4 +- .../models/additional_properties_class.py | 2 +- .../models/additional_properties_object.py | 4 +- ...tional_properties_with_description_only.py | 4 +- .../models/all_of_with_single_ref.py | 2 +- .../petstore_api/models/animal.py | 17 ++-- .../petstore_api/models/api_response.py | 2 +- .../models/array_of_array_of_model.py | 2 +- .../models/array_of_array_of_number_only.py | 2 +- .../models/array_of_number_only.py | 2 +- .../petstore_api/models/array_test.py | 2 +- .../petstore_api/models/basque_pig.py | 2 +- .../petstore_api/models/capitalization.py | 2 +- .../python-aiohttp/petstore_api/models/cat.py | 2 +- .../petstore_api/models/category.py | 2 +- .../models/circular_reference_model.py | 2 +- .../petstore_api/models/class_model.py | 2 +- .../petstore_api/models/client.py | 2 +- .../petstore_api/models/creature.py | 2 +- .../petstore_api/models/creature_info.py | 2 +- .../petstore_api/models/danish_pig.py | 2 +- .../petstore_api/models/deprecated_object.py | 2 +- .../python-aiohttp/petstore_api/models/dog.py | 2 +- .../petstore_api/models/dummy_model.py | 2 +- .../petstore_api/models/enum_arrays.py | 2 +- .../petstore_api/models/enum_test.py | 2 +- .../petstore_api/models/file.py | 2 +- .../models/file_schema_test_class.py | 2 +- .../petstore_api/models/first_ref.py | 2 +- .../python-aiohttp/petstore_api/models/foo.py | 2 +- .../models/foo_get_default_response.py | 2 +- .../petstore_api/models/format_test.py | 2 +- .../petstore_api/models/has_only_read_only.py | 2 +- .../models/health_check_result.py | 2 +- .../models/inner_dict_with_property.py | 2 +- .../petstore_api/models/list_class.py | 74 ++++++++++++++++ .../models/map_of_array_of_model.py | 2 +- .../petstore_api/models/map_test.py | 2 +- ...perties_and_additional_properties_class.py | 2 +- .../petstore_api/models/model200_response.py | 2 +- .../petstore_api/models/model_return.py | 2 +- .../petstore_api/models/name.py | 2 +- .../petstore_api/models/nullable_class.py | 4 +- .../petstore_api/models/nullable_property.py | 2 +- .../petstore_api/models/number_only.py | 2 +- .../object_to_test_additional_properties.py | 2 +- .../models/object_with_deprecated_fields.py | 2 +- .../petstore_api/models/order.py | 2 +- .../petstore_api/models/outer_composite.py | 2 +- .../models/outer_object_with_enum_property.py | 2 +- .../petstore_api/models/parent.py | 2 +- .../models/parent_with_optional_dict.py | 2 +- .../python-aiohttp/petstore_api/models/pet.py | 2 +- .../models/property_name_collision.py | 2 +- .../petstore_api/models/read_only_first.py | 2 +- .../petstore_api/models/second_ref.py | 2 +- .../models/self_reference_model.py | 2 +- .../petstore_api/models/special_model_name.py | 2 +- .../petstore_api/models/special_name.py | 2 +- .../python-aiohttp/petstore_api/models/tag.py | 2 +- ..._freeform_additional_properties_request.py | 4 +- .../petstore_api/models/tiger.py | 2 +- .../petstore_api/models/user.py | 2 +- .../petstore_api/models/with_nested_one_of.py | 2 +- .../python-aiohttp/test/test_list_class.py | 52 +++++++++++ .../.openapi-generator/FILES | 4 +- .../python-pydantic-v1-aiohttp/README.md | 2 +- .../docs/ListClass.md | 28 ++++++ .../petstore_api/__init__.py | 2 +- .../petstore_api/models/__init__.py | 2 +- .../petstore_api/models/list_class.py | 71 +++++++++++++++ .../test/test_list_class.py | 52 +++++++++++ .../tests/test_model.py | 8 +- .../.openapi-generator/FILES | 4 +- .../petstore/python-pydantic-v1/README.md | 2 +- .../python-pydantic-v1/docs/ListClass.md | 28 ++++++ .../petstore_api/__init__.py | 2 +- .../petstore_api/models/__init__.py | 2 +- .../petstore_api/models/list_class.py | 83 ++++++++++++++++++ .../test/test_list_class.py | 52 +++++++++++ .../python-pydantic-v1/tests/test_model.py | 8 +- .../petstore/python/.openapi-generator/FILES | 4 +- .../openapi3/client/petstore/python/README.md | 2 +- .../client/petstore/python/docs/ListClass.md | 28 ++++++ .../petstore/python/petstore_api/__init__.py | 2 +- .../python/petstore_api/models/__init__.py | 2 +- .../models/additional_properties_any_type.py | 6 +- .../models/additional_properties_class.py | 6 +- .../models/additional_properties_object.py | 6 +- ...tional_properties_with_description_only.py | 6 +- .../models/all_of_with_single_ref.py | 6 +- .../python/petstore_api/models/animal.py | 19 ++-- .../petstore_api/models/api_response.py | 6 +- .../models/array_of_array_of_model.py | 6 +- .../models/array_of_array_of_number_only.py | 6 +- .../models/array_of_number_only.py | 6 +- .../python/petstore_api/models/array_test.py | 6 +- .../python/petstore_api/models/basque_pig.py | 6 +- .../petstore_api/models/capitalization.py | 6 +- .../python/petstore_api/models/cat.py | 6 +- .../python/petstore_api/models/category.py | 6 +- .../models/circular_reference_model.py | 6 +- .../python/petstore_api/models/class_model.py | 6 +- .../python/petstore_api/models/client.py | 6 +- .../python/petstore_api/models/creature.py | 6 +- .../petstore_api/models/creature_info.py | 6 +- .../python/petstore_api/models/danish_pig.py | 6 +- .../petstore_api/models/deprecated_object.py | 6 +- .../python/petstore_api/models/dog.py | 6 +- .../python/petstore_api/models/dummy_model.py | 6 +- .../python/petstore_api/models/enum_arrays.py | 6 +- .../python/petstore_api/models/enum_test.py | 6 +- .../python/petstore_api/models/file.py | 6 +- .../models/file_schema_test_class.py | 6 +- .../python/petstore_api/models/first_ref.py | 6 +- .../python/petstore_api/models/foo.py | 6 +- .../models/foo_get_default_response.py | 6 +- .../python/petstore_api/models/format_test.py | 6 +- .../petstore_api/models/has_only_read_only.py | 6 +- .../models/health_check_result.py | 6 +- .../models/inner_dict_with_property.py | 6 +- .../python/petstore_api/models/list_class.py | 86 +++++++++++++++++++ .../models/map_of_array_of_model.py | 6 +- .../python/petstore_api/models/map_test.py | 6 +- ...perties_and_additional_properties_class.py | 6 +- .../petstore_api/models/model200_response.py | 6 +- .../petstore_api/models/model_return.py | 6 +- .../python/petstore_api/models/name.py | 6 +- .../petstore_api/models/nullable_class.py | 6 +- .../petstore_api/models/nullable_property.py | 6 +- .../python/petstore_api/models/number_only.py | 6 +- .../object_to_test_additional_properties.py | 6 +- .../models/object_with_deprecated_fields.py | 6 +- .../python/petstore_api/models/order.py | 6 +- .../petstore_api/models/outer_composite.py | 6 +- .../models/outer_object_with_enum_property.py | 6 +- .../python/petstore_api/models/parent.py | 6 +- .../models/parent_with_optional_dict.py | 6 +- .../python/petstore_api/models/pet.py | 6 +- .../models/property_name_collision.py | 6 +- .../petstore_api/models/read_only_first.py | 6 +- .../python/petstore_api/models/second_ref.py | 6 +- .../models/self_reference_model.py | 6 +- .../petstore_api/models/special_model_name.py | 6 +- .../petstore_api/models/special_name.py | 6 +- .../python/petstore_api/models/tag.py | 6 +- ..._freeform_additional_properties_request.py | 6 +- .../python/petstore_api/models/tiger.py | 6 +- .../python/petstore_api/models/user.py | 6 +- .../petstore_api/models/with_nested_one_of.py | 6 +- .../client/petstore/python/test/test_list.py | 6 +- .../petstore/python/test/test_list_class.py | 52 +++++++++++ .../petstore/python/tests/test_model.py | 8 +- 171 files changed, 962 insertions(+), 334 deletions(-) create mode 100644 samples/openapi3/client/petstore/python-aiohttp/docs/ListClass.md create mode 100644 samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/list_class.py create mode 100644 samples/openapi3/client/petstore/python-aiohttp/test/test_list_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ListClass.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/list_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_list_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/ListClass.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/list_class.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_list_class.py create mode 100644 samples/openapi3/client/petstore/python/docs/ListClass.md create mode 100644 samples/openapi3/client/petstore/python/petstore_api/models/list_class.py create mode 100644 samples/openapi3/client/petstore/python/test/test_list_class.py diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java index 2b7c6b1ef1f..c47c26afec0 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java @@ -948,7 +948,9 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co && !model.isEnum && !this.disallowAdditionalPropertiesIfNotPresent) { typingImports.add("Dict"); + typingImports.add("List"); typingImports.add("Any"); + typingImports.add("ClassVar"); } //loop through properties/schemas to set up typing, pydantic diff --git a/modules/openapi-generator/src/main/resources/python/model_generic.mustache b/modules/openapi-generator/src/main/resources/python/model_generic.mustache index c8a27a42c24..290127045b7 100644 --- a/modules/openapi-generator/src/main/resources/python/model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_generic.mustache @@ -23,7 +23,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} {{#isAdditionalPropertiesTrue}} additional_properties: Dict[str, Any] = {} {{/isAdditionalPropertiesTrue}} - __properties = [{{#allVars}}"{{baseName}}"{{^-last}}, {{/-last}}{{/allVars}}] + __properties: ClassVar[List[str]] = [{{#allVars}}"{{baseName}}"{{^-last}}, {{/-last}}{{/allVars}}] {{#vars}} {{#vendorExtensions.x-regex}} @@ -85,27 +85,21 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} {{#hasChildren}} {{#discriminator}} # JSON field name that stores the object type - __discriminator_property_name = '{{discriminator.propertyBaseName}}' + __discriminator_property_name: ClassVar[List[str]] = '{{discriminator.propertyBaseName}}' - {{#mappedModels}} - {{#-first}} # discriminator mappings - __discriminator_value_class_map = { - {{/-first}} - '{{{mappingName}}}': '{{{modelName}}}'{{^-last}},{{/-last}} - {{#-last}} + __discriminator_value_class_map: ClassVar[Dict[str, str]] = { + {{#mappedModels}}'{{{mappingName}}}': '{{{modelName}}}'{{^-last}},{{/-last}}{{/mappedModels}} } @classmethod def get_discriminator_value(cls, obj: dict) -> str: """Returns the discriminator value (object type) of the data""" - discriminator_value = obj[cls.__discriminator_property_name.default] + discriminator_value = obj[cls.__discriminator_property_name] if discriminator_value: - return cls.__discriminator_value_class_map.default.get(discriminator_value) + return cls.__discriminator_value_class_map.get(discriminator_value) else: return None - {{/-last}} - {{/mappedModels}} {{/discriminator}} {{/hasChildren}} @@ -232,8 +226,8 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} return klass.from_dict(obj) else: raise ValueError("{{{classname}}} failed to lookup discriminator value from " + - json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name.default + - ", mapping: " + json.dumps(cls.__discriminator_value_class_map.default)) + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) {{/discriminator}} {{/hasChildren}} {{^hasChildren}} @@ -248,7 +242,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} # raise errors for additional fields in the input for _key in obj.keys(): if _key not in cls.__properties: - raise ValueError("Error due to additional fields (not defined in {{classname}}) in the input: " + obj) + raise ValueError("Error due to additional fields (not defined in {{classname}}) in the input: " + _key) {{/isAdditionalPropertiesTrue}} {{/disallowAdditionalPropertiesIfNotPresent}} @@ -351,7 +345,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} {{#isAdditionalPropertiesTrue}} # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) {{/isAdditionalPropertiesTrue}} 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 aa179785dfb..a38d3c60834 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 @@ -1776,7 +1776,7 @@ components: type: object additionalProperties: $ref: '#/components/schemas/Animal' - List: + ListClass: type: object properties: 123-list: diff --git a/samples/client/echo_api/python/openapi_client/models/bird.py b/samples/client/echo_api/python/openapi_client/models/bird.py index 13b67878e2e..4faec5101c6 100644 --- a/samples/client/echo_api/python/openapi_client/models/bird.py +++ b/samples/client/echo_api/python/openapi_client/models/bird.py @@ -28,7 +28,7 @@ class Bird(BaseModel): """ size: Optional[StrictStr] = None color: Optional[StrictStr] = None - __properties = ["size", "color"] + __properties: ClassVar[List[str]] = ["size", "color"] model_config = { "populate_by_name": True, diff --git a/samples/client/echo_api/python/openapi_client/models/category.py b/samples/client/echo_api/python/openapi_client/models/category.py index 0d4cfdd54dc..29a4d21d402 100644 --- a/samples/client/echo_api/python/openapi_client/models/category.py +++ b/samples/client/echo_api/python/openapi_client/models/category.py @@ -28,7 +28,7 @@ class Category(BaseModel): """ id: Optional[StrictInt] = None name: Optional[StrictStr] = None - __properties = ["id", "name"] + __properties: ClassVar[List[str]] = ["id", "name"] model_config = { "populate_by_name": True, diff --git a/samples/client/echo_api/python/openapi_client/models/data_query.py b/samples/client/echo_api/python/openapi_client/models/data_query.py index 14f2288d1c0..a6d7de7745a 100644 --- a/samples/client/echo_api/python/openapi_client/models/data_query.py +++ b/samples/client/echo_api/python/openapi_client/models/data_query.py @@ -31,7 +31,7 @@ class DataQuery(Query): suffix: Optional[StrictStr] = Field(default=None, description="test suffix") text: Optional[StrictStr] = Field(default=None, description="Some text containing white spaces") var_date: Optional[datetime] = Field(default=None, description="A date", alias="date") - __properties = ["id", "outcomes", "suffix", "text", "date"] + __properties: ClassVar[List[str]] = ["id", "outcomes", "suffix", "text", "date"] model_config = { "populate_by_name": True, diff --git a/samples/client/echo_api/python/openapi_client/models/default_value.py b/samples/client/echo_api/python/openapi_client/models/default_value.py index e807e94e34c..7e64618e73d 100644 --- a/samples/client/echo_api/python/openapi_client/models/default_value.py +++ b/samples/client/echo_api/python/openapi_client/models/default_value.py @@ -35,7 +35,7 @@ class DefaultValue(BaseModel): array_string_nullable: Optional[List[StrictStr]] = None array_string_extension_nullable: Optional[List[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: ClassVar[List[str]] = ["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"] @field_validator('array_string_enum_default') def array_string_enum_default_validate_enum(cls, value): diff --git a/samples/client/echo_api/python/openapi_client/models/number_properties_only.py b/samples/client/echo_api/python/openapi_client/models/number_properties_only.py index 23a179ae2a8..5284b857019 100644 --- a/samples/client/echo_api/python/openapi_client/models/number_properties_only.py +++ b/samples/client/echo_api/python/openapi_client/models/number_properties_only.py @@ -30,7 +30,7 @@ class NumberPropertiesOnly(BaseModel): """ number: Optional[Union[StrictFloat, StrictInt]] = 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: ClassVar[List[str]] = ["number", "double"] model_config = { "populate_by_name": True, diff --git a/samples/client/echo_api/python/openapi_client/models/pet.py b/samples/client/echo_api/python/openapi_client/models/pet.py index 51b1d20275a..b5d2120454d 100644 --- a/samples/client/echo_api/python/openapi_client/models/pet.py +++ b/samples/client/echo_api/python/openapi_client/models/pet.py @@ -35,7 +35,7 @@ class Pet(BaseModel): photo_urls: List[StrictStr] = Field(alias="photoUrls") tags: Optional[List[Tag]] = None status: Optional[StrictStr] = Field(default=None, description="pet status in the store") - __properties = ["id", "name", "category", "photoUrls", "tags", "status"] + __properties: ClassVar[List[str]] = ["id", "name", "category", "photoUrls", "tags", "status"] @field_validator('status') def status_validate_enum(cls, value): diff --git a/samples/client/echo_api/python/openapi_client/models/query.py b/samples/client/echo_api/python/openapi_client/models/query.py index c96f723c99b..0821271f829 100644 --- a/samples/client/echo_api/python/openapi_client/models/query.py +++ b/samples/client/echo_api/python/openapi_client/models/query.py @@ -29,7 +29,7 @@ class Query(BaseModel): """ id: Optional[StrictInt] = Field(default=None, description="Query") outcomes: Optional[List[StrictStr]] = None - __properties = ["id", "outcomes"] + __properties: ClassVar[List[str]] = ["id", "outcomes"] @field_validator('outcomes') def outcomes_validate_enum(cls, value): diff --git a/samples/client/echo_api/python/openapi_client/models/tag.py b/samples/client/echo_api/python/openapi_client/models/tag.py index 5e456e33d22..adc2b1e2e96 100644 --- a/samples/client/echo_api/python/openapi_client/models/tag.py +++ b/samples/client/echo_api/python/openapi_client/models/tag.py @@ -28,7 +28,7 @@ class Tag(BaseModel): """ id: Optional[StrictInt] = None name: Optional[StrictStr] = None - __properties = ["id", "name"] + __properties: ClassVar[List[str]] = ["id", "name"] model_config = { "populate_by_name": True, diff --git a/samples/client/echo_api/python/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py b/samples/client/echo_api/python/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py index c809f92c494..2938541cf15 100644 --- a/samples/client/echo_api/python/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py +++ b/samples/client/echo_api/python/openapi_client/models/test_query_style_deep_object_explode_true_object_all_of_query_object_parameter.py @@ -30,7 +30,7 @@ class TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter(BaseMod color: Optional[StrictStr] = None id: Optional[StrictInt] = None name: Optional[StrictStr] = None - __properties = ["size", "color", "id", "name"] + __properties: ClassVar[List[str]] = ["size", "color", "id", "name"] model_config = { "populate_by_name": True, diff --git a/samples/client/echo_api/python/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py b/samples/client/echo_api/python/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py index 1fef3569599..c750437aa52 100644 --- a/samples/client/echo_api/python/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py +++ b/samples/client/echo_api/python/openapi_client/models/test_query_style_form_explode_true_array_string_query_object_parameter.py @@ -27,7 +27,7 @@ class TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter(BaseModel): TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter """ values: Optional[List[StrictStr]] = None - __properties = ["values"] + __properties: ClassVar[List[str]] = ["values"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES b/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES index e943667b1f6..b4bc51e0452 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES @@ -49,7 +49,7 @@ docs/HasOnlyReadOnly.md docs/HealthCheckResult.md docs/InnerDictWithProperty.md docs/IntOrString.md -docs/List.md +docs/ListClass.md docs/MapOfArrayOfModel.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -146,7 +146,7 @@ petstore_api/models/has_only_read_only.py petstore_api/models/health_check_result.py petstore_api/models/inner_dict_with_property.py petstore_api/models/int_or_string.py -petstore_api/models/list.py +petstore_api/models/list_class.py petstore_api/models/map_of_array_of_model.py petstore_api/models/map_test.py petstore_api/models/mixed_properties_and_additional_properties_class.py diff --git a/samples/openapi3/client/petstore/python-aiohttp/README.md b/samples/openapi3/client/petstore/python-aiohttp/README.md index 9d3ea6eb22c..55eafdf48fc 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/README.md +++ b/samples/openapi3/client/petstore/python-aiohttp/README.md @@ -177,7 +177,7 @@ Class | Method | HTTP request | Description - [HealthCheckResult](docs/HealthCheckResult.md) - [InnerDictWithProperty](docs/InnerDictWithProperty.md) - [IntOrString](docs/IntOrString.md) - - [List](docs/List.md) + - [ListClass](docs/ListClass.md) - [MapOfArrayOfModel](docs/MapOfArrayOfModel.md) - [MapTest](docs/MapTest.md) - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/openapi3/client/petstore/python-aiohttp/docs/ListClass.md b/samples/openapi3/client/petstore/python-aiohttp/docs/ListClass.md new file mode 100644 index 00000000000..ceb1f50705b --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/ListClass.md @@ -0,0 +1,28 @@ +# ListClass + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_123_list** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.list_class import ListClass + +# TODO update the JSON string below +json = "{}" +# create an instance of ListClass from a JSON string +list_class_instance = ListClass.from_json(json) +# print the JSON string representation of the object +print ListClass.to_json() + +# convert the object into a dict +list_class_dict = list_class_instance.to_dict() +# create an instance of ListClass from a dict +list_class_form_dict = list_class.from_dict(list_class_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py index 2023e72fb35..69c88cf7525 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py @@ -80,7 +80,7 @@ from petstore_api.models.has_only_read_only import HasOnlyReadOnly from petstore_api.models.health_check_result import HealthCheckResult from petstore_api.models.inner_dict_with_property import InnerDictWithProperty from petstore_api.models.int_or_string import IntOrString -from petstore_api.models.list import List +from petstore_api.models.list_class import ListClass from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/__init__.py index e3ce5fa5538..a00e5da5310 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/__init__.py @@ -56,7 +56,7 @@ from petstore_api.models.has_only_read_only import HasOnlyReadOnly from petstore_api.models.health_check_result import HealthCheckResult from petstore_api.models.inner_dict_with_property import InnerDictWithProperty from petstore_api.models.int_or_string import IntOrString -from petstore_api.models.list import List +from petstore_api.models.list_class import ListClass from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_any_type.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_any_type.py index 434439f1769..fdb014a1185 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_any_type.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_any_type.py @@ -27,7 +27,7 @@ class AdditionalPropertiesAnyType(BaseModel): """ name: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties = ["name"] + __properties: ClassVar[List[str]] = ["name"] model_config = { "populate_by_name": True, @@ -77,7 +77,7 @@ class AdditionalPropertiesAnyType(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_class.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_class.py index 86f52278aa1..1dd4ecafa71 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_class.py @@ -27,7 +27,7 @@ class AdditionalPropertiesClass(BaseModel): """ map_property: Optional[Dict[str, StrictStr]] = None map_of_map_property: Optional[Dict[str, Dict[str, StrictStr]]] = None - __properties = ["map_property", "map_of_map_property"] + __properties: ClassVar[List[str]] = ["map_property", "map_of_map_property"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_object.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_object.py index e05cd9a4752..44094e7ba1b 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_object.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_object.py @@ -27,7 +27,7 @@ class AdditionalPropertiesObject(BaseModel): """ name: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties = ["name"] + __properties: ClassVar[List[str]] = ["name"] model_config = { "populate_by_name": True, @@ -77,7 +77,7 @@ class AdditionalPropertiesObject(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_with_description_only.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_with_description_only.py index 10e6602941b..5fc0bd189e2 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_with_description_only.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/additional_properties_with_description_only.py @@ -27,7 +27,7 @@ class AdditionalPropertiesWithDescriptionOnly(BaseModel): """ name: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties = ["name"] + __properties: ClassVar[List[str]] = ["name"] model_config = { "populate_by_name": True, @@ -77,7 +77,7 @@ class AdditionalPropertiesWithDescriptionOnly(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/all_of_with_single_ref.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/all_of_with_single_ref.py index 302f89173e4..d8205750a13 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/all_of_with_single_ref.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/all_of_with_single_ref.py @@ -29,7 +29,7 @@ class AllOfWithSingleRef(BaseModel): """ username: Optional[StrictStr] = None single_ref_type: Optional[SingleRefType] = Field(default=None, alias="SingleRefType") - __properties = ["username", "SingleRefType"] + __properties: ClassVar[List[str]] = ["username", "SingleRefType"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/animal.py index 33501c52ed0..b5fc122a115 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/animal.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/animal.py @@ -28,7 +28,7 @@ class Animal(BaseModel): """ class_name: StrictStr = Field(alias="className") color: Optional[StrictStr] = 'red' - __properties = ["className", "color"] + __properties: ClassVar[List[str]] = ["className", "color"] model_config = { "populate_by_name": True, @@ -37,20 +37,19 @@ class Animal(BaseModel): # JSON field name that stores the object type - __discriminator_property_name = 'className' + __discriminator_property_name: ClassVar[List[str]] = 'className' # discriminator mappings - __discriminator_value_class_map = { - 'Cat': 'Cat', - 'Dog': 'Dog' + __discriminator_value_class_map: ClassVar[Dict[str, str]] = { + 'Cat': 'Cat','Dog': 'Dog' } @classmethod def get_discriminator_value(cls, obj: dict) -> str: """Returns the discriminator value (object type) of the data""" - discriminator_value = obj[cls.__discriminator_property_name.default] + discriminator_value = obj[cls.__discriminator_property_name] if discriminator_value: - return cls.__discriminator_value_class_map.default.get(discriminator_value) + return cls.__discriminator_value_class_map.get(discriminator_value) else: return None @@ -86,8 +85,8 @@ class Animal(BaseModel): return klass.from_dict(obj) else: raise ValueError("Animal failed to lookup discriminator value from " + - json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name.default + - ", mapping: " + json.dumps(cls.__discriminator_value_class_map.default)) + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) from petstore_api.models.cat import Cat from petstore_api.models.dog import Dog diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/api_response.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/api_response.py index 875a41e2aed..ff52eb71194 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/api_response.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/api_response.py @@ -28,7 +28,7 @@ class ApiResponse(BaseModel): code: Optional[StrictInt] = None type: Optional[StrictStr] = None message: Optional[StrictStr] = None - __properties = ["code", "type", "message"] + __properties: ClassVar[List[str]] = ["code", "type", "message"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_array_of_model.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_array_of_model.py index d798ac121c2..c6ef3f968c7 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_array_of_model.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_array_of_model.py @@ -27,7 +27,7 @@ class ArrayOfArrayOfModel(BaseModel): ArrayOfArrayOfModel """ another_property: Optional[List[List[Tag]]] = None - __properties = ["another_property"] + __properties: ClassVar[List[str]] = ["another_property"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_array_of_number_only.py index 7b25d1d101a..b9f51b6588d 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_array_of_number_only.py @@ -27,7 +27,7 @@ class ArrayOfArrayOfNumberOnly(BaseModel): ArrayOfArrayOfNumberOnly """ array_array_number: Optional[List[List[float]]] = Field(default=None, alias="ArrayArrayNumber") - __properties = ["ArrayArrayNumber"] + __properties: ClassVar[List[str]] = ["ArrayArrayNumber"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_number_only.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_number_only.py index d4ba3bd6da1..909e276ba41 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_number_only.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_of_number_only.py @@ -27,7 +27,7 @@ class ArrayOfNumberOnly(BaseModel): ArrayOfNumberOnly """ array_number: Optional[List[float]] = Field(default=None, alias="ArrayNumber") - __properties = ["ArrayNumber"] + __properties: ClassVar[List[str]] = ["ArrayNumber"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_test.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_test.py index c195a37415f..347e6c326cf 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_test.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/array_test.py @@ -31,7 +31,7 @@ class ArrayTest(BaseModel): array_of_string: Optional[Annotated[List[StrictStr], Field(min_length=0, max_length=3)]] = None array_array_of_integer: Optional[List[List[StrictInt]]] = None array_array_of_model: Optional[List[List[ReadOnlyFirst]]] = None - __properties = ["array_of_string", "array_array_of_integer", "array_array_of_model"] + __properties: ClassVar[List[str]] = ["array_of_string", "array_array_of_integer", "array_array_of_model"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/basque_pig.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/basque_pig.py index 698016f3faa..b1466ef6ba6 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/basque_pig.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/basque_pig.py @@ -28,7 +28,7 @@ class BasquePig(BaseModel): """ class_name: StrictStr = Field(alias="className") color: StrictStr - __properties = ["className", "color"] + __properties: ClassVar[List[str]] = ["className", "color"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/capitalization.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/capitalization.py index dcd0d77e7e1..3df7fd7a355 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/capitalization.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/capitalization.py @@ -32,7 +32,7 @@ class Capitalization(BaseModel): capital_snake: Optional[StrictStr] = Field(default=None, alias="Capital_Snake") sca_eth_flow_points: Optional[StrictStr] = Field(default=None, alias="SCA_ETH_Flow_Points") 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: ClassVar[List[str]] = ["smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/cat.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/cat.py index c716c253a47..4eb15fe6639 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/cat.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/cat.py @@ -27,7 +27,7 @@ class Cat(Animal): Cat """ declawed: Optional[StrictBool] = None - __properties = ["className", "color", "declawed"] + __properties: ClassVar[List[str]] = ["className", "color", "declawed"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/category.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/category.py index 861e6e9ee07..85980ccbfcb 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/category.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/category.py @@ -27,7 +27,7 @@ class Category(BaseModel): """ id: Optional[StrictInt] = None name: StrictStr - __properties = ["id", "name"] + __properties: ClassVar[List[str]] = ["id", "name"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/circular_reference_model.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/circular_reference_model.py index 920a3e8135e..8f990f6af2d 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/circular_reference_model.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/circular_reference_model.py @@ -27,7 +27,7 @@ class CircularReferenceModel(BaseModel): """ size: Optional[StrictInt] = None nested: Optional[FirstRef] = None - __properties = ["size", "nested"] + __properties: ClassVar[List[str]] = ["size", "nested"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/class_model.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/class_model.py index c340fd7de00..081c56687fd 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/class_model.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/class_model.py @@ -27,7 +27,7 @@ class ClassModel(BaseModel): Model for testing model with \"_class\" property # noqa: E501 """ var_class: Optional[StrictStr] = Field(default=None, alias="_class") - __properties = ["_class"] + __properties: ClassVar[List[str]] = ["_class"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/client.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/client.py index 1f03d4ffb57..22bdd59b4c6 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/client.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/client.py @@ -26,7 +26,7 @@ class Client(BaseModel): Client """ client: Optional[StrictStr] = None - __properties = ["client"] + __properties: ClassVar[List[str]] = ["client"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/creature.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/creature.py index 269294aa24e..cf89e2dd47c 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/creature.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/creature.py @@ -28,7 +28,7 @@ class Creature(BaseModel): """ info: CreatureInfo type: StrictStr - __properties = ["info", "type"] + __properties: ClassVar[List[str]] = ["info", "type"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/creature_info.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/creature_info.py index fabe153f31b..95a21ace904 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/creature_info.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/creature_info.py @@ -26,7 +26,7 @@ class CreatureInfo(BaseModel): CreatureInfo """ name: StrictStr - __properties = ["name"] + __properties: ClassVar[List[str]] = ["name"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/danish_pig.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/danish_pig.py index f1bb9dc5218..3a51136fb92 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/danish_pig.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/danish_pig.py @@ -28,7 +28,7 @@ class DanishPig(BaseModel): """ class_name: StrictStr = Field(alias="className") size: StrictInt - __properties = ["className", "size"] + __properties: ClassVar[List[str]] = ["className", "size"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/deprecated_object.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/deprecated_object.py index d7689114dc0..a3cef015f53 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/deprecated_object.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/deprecated_object.py @@ -26,7 +26,7 @@ class DeprecatedObject(BaseModel): DeprecatedObject """ name: Optional[StrictStr] = None - __properties = ["name"] + __properties: ClassVar[List[str]] = ["name"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dog.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dog.py index ca35796fb14..42407d8c8da 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dog.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dog.py @@ -27,7 +27,7 @@ class Dog(Animal): Dog """ breed: Optional[StrictStr] = None - __properties = ["className", "color", "breed"] + __properties: ClassVar[List[str]] = ["className", "color", "breed"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dummy_model.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dummy_model.py index 65765b6922d..d4115fac566 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dummy_model.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/dummy_model.py @@ -27,7 +27,7 @@ class DummyModel(BaseModel): """ category: Optional[StrictStr] = None self_ref: Optional[SelfReferenceModel] = None - __properties = ["category", "self_ref"] + __properties: ClassVar[List[str]] = ["category", "self_ref"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_arrays.py index 161fe46cc11..d16aeba5c4e 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_arrays.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_arrays.py @@ -27,7 +27,7 @@ class EnumArrays(BaseModel): """ just_symbol: Optional[StrictStr] = None array_enum: Optional[List[StrictStr]] = None - __properties = ["just_symbol", "array_enum"] + __properties: ClassVar[List[str]] = ["just_symbol", "array_enum"] @field_validator('just_symbol') def just_symbol_validate_enum(cls, value): diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_test.py index 347a39e802a..c10be465fc6 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_test.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_test.py @@ -39,7 +39,7 @@ class EnumTest(BaseModel): outer_enum_integer: Optional[OuterEnumInteger] = Field(default=None, alias="outerEnumInteger") outer_enum_default_value: Optional[OuterEnumDefaultValue] = Field(default=None, alias="outerEnumDefaultValue") 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: ClassVar[List[str]] = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue"] @field_validator('enum_string') def enum_string_validate_enum(cls, value): diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file.py index 4db5067c90b..259c9b287dd 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file.py @@ -27,7 +27,7 @@ class File(BaseModel): Must be named `File` for test. # noqa: E501 """ source_uri: Optional[StrictStr] = Field(default=None, description="Test capitalization", alias="sourceURI") - __properties = ["sourceURI"] + __properties: ClassVar[List[str]] = ["sourceURI"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file_schema_test_class.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file_schema_test_class.py index cacb59dc918..1fdd13db0e9 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file_schema_test_class.py @@ -28,7 +28,7 @@ class FileSchemaTestClass(BaseModel): """ file: Optional[File] = None files: Optional[List[File]] = None - __properties = ["file", "files"] + __properties: ClassVar[List[str]] = ["file", "files"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/first_ref.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/first_ref.py index 78dcfa435b3..821e0345fb0 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/first_ref.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/first_ref.py @@ -27,7 +27,7 @@ class FirstRef(BaseModel): """ category: Optional[StrictStr] = None self_ref: Optional[SecondRef] = None - __properties = ["category", "self_ref"] + __properties: ClassVar[List[str]] = ["category", "self_ref"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/foo.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/foo.py index b26e388a28a..ac500169015 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/foo.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/foo.py @@ -26,7 +26,7 @@ class Foo(BaseModel): Foo """ bar: Optional[StrictStr] = 'bar' - __properties = ["bar"] + __properties: ClassVar[List[str]] = ["bar"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/foo_get_default_response.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/foo_get_default_response.py index 8aa1c763e88..69025e9dca8 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/foo_get_default_response.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/foo_get_default_response.py @@ -27,7 +27,7 @@ class FooGetDefaultResponse(BaseModel): FooGetDefaultResponse """ string: Optional[Foo] = None - __properties = ["string"] + __properties: ClassVar[List[str]] = ["string"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/format_test.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/format_test.py index 69980df9fab..ee4069a8dd8 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/format_test.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/format_test.py @@ -44,7 +44,7 @@ class FormatTest(BaseModel): password: Annotated[str, Field(min_length=10, strict=True, max_length=64)] pattern_with_digits: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A string that is a 10 digit number. Can have leading zeros.") 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: ClassVar[List[str]] = ["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"] @field_validator('string') def string_validate_regular_expression(cls, value): diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/has_only_read_only.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/has_only_read_only.py index bdb291e1f6a..232f4561d39 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/has_only_read_only.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/has_only_read_only.py @@ -27,7 +27,7 @@ class HasOnlyReadOnly(BaseModel): """ bar: Optional[StrictStr] = None foo: Optional[StrictStr] = None - __properties = ["bar", "foo"] + __properties: ClassVar[List[str]] = ["bar", "foo"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/health_check_result.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/health_check_result.py index 7328147fd7a..162bcbbe33e 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/health_check_result.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/health_check_result.py @@ -27,7 +27,7 @@ class HealthCheckResult(BaseModel): Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. # noqa: E501 """ nullable_message: Optional[StrictStr] = Field(default=None, alias="NullableMessage") - __properties = ["NullableMessage"] + __properties: ClassVar[List[str]] = ["NullableMessage"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/inner_dict_with_property.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/inner_dict_with_property.py index fabd6b43f09..eb660f83653 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/inner_dict_with_property.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/inner_dict_with_property.py @@ -27,7 +27,7 @@ class InnerDictWithProperty(BaseModel): InnerDictWithProperty """ a_property: Optional[Union[str, Any]] = Field(default=None, alias="aProperty") - __properties = ["aProperty"] + __properties: ClassVar[List[str]] = ["aProperty"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/list_class.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/list_class.py new file mode 100644 index 00000000000..8bbdc3ea394 --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/list_class.py @@ -0,0 +1,74 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr +from pydantic import Field + +class ListClass(BaseModel): + """ + ListClass + """ + var_123_list: Optional[StrictStr] = Field(default=None, alias="123-list") + __properties: ClassVar[List[str]] = ["123-list"] + + model_config = { + "populate_by_name": True, + "validate_assignment": True + } + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> ListClass: + """Create an instance of ListClass from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.model_dump(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> ListClass: + """Create an instance of ListClass from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ListClass.model_validate(obj) + + _obj = ListClass.model_validate({ + "123-list": obj.get("123-list") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_of_array_of_model.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_of_array_of_model.py index df4f9d9c4d7..c6f51733b31 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_of_array_of_model.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_of_array_of_model.py @@ -28,7 +28,7 @@ class MapOfArrayOfModel(BaseModel): MapOfArrayOfModel """ shop_id_to_org_online_lip_map: Optional[Dict[str, List[Tag]]] = Field(default=None, alias="shopIdToOrgOnlineLipMap") - __properties = ["shopIdToOrgOnlineLipMap"] + __properties: ClassVar[List[str]] = ["shopIdToOrgOnlineLipMap"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_test.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_test.py index 4745dbbfe80..0f48db387b8 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_test.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_test.py @@ -29,7 +29,7 @@ class MapTest(BaseModel): map_of_enum_string: Optional[Dict[str, StrictStr]] = None direct_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: ClassVar[List[str]] = ["map_map_of_string", "map_of_enum_string", "direct_map", "indirect_map"] @field_validator('map_of_enum_string') def map_of_enum_string_validate_enum(cls, value): diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py index 0a637426955..e87f188c76d 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -30,7 +30,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(BaseModel): uuid: Optional[StrictStr] = None date_time: Optional[datetime] = Field(default=None, alias="dateTime") map: Optional[Dict[str, Animal]] = None - __properties = ["uuid", "dateTime", "map"] + __properties: ClassVar[List[str]] = ["uuid", "dateTime", "map"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model200_response.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model200_response.py index fc1d271ca45..ca9ccecf54b 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model200_response.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model200_response.py @@ -28,7 +28,7 @@ class Model200Response(BaseModel): """ name: Optional[StrictInt] = None var_class: Optional[StrictStr] = Field(default=None, alias="class") - __properties = ["name", "class"] + __properties: ClassVar[List[str]] = ["name", "class"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model_return.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model_return.py index 33c2edf0d81..c6c9aba0e5f 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model_return.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model_return.py @@ -27,7 +27,7 @@ class ModelReturn(BaseModel): Model for testing reserved words # noqa: E501 """ var_return: Optional[StrictInt] = Field(default=None, alias="return") - __properties = ["return"] + __properties: ClassVar[List[str]] = ["return"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/name.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/name.py index 31caeb08202..f10a28e4564 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/name.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/name.py @@ -30,7 +30,7 @@ class Name(BaseModel): snake_case: Optional[StrictInt] = None var_property: Optional[StrictStr] = Field(default=None, alias="property") var_123_number: Optional[StrictInt] = Field(default=None, alias="123Number") - __properties = ["name", "snake_case", "property", "123Number"] + __properties: ClassVar[List[str]] = ["name", "snake_case", "property", "123Number"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/nullable_class.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/nullable_class.py index df5f2998f01..3846d628b7d 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/nullable_class.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/nullable_class.py @@ -39,7 +39,7 @@ class NullableClass(BaseModel): object_and_items_nullable_prop: Optional[Dict[str, Union[str, Any]]] = None object_items_nullable: Optional[Dict[str, Union[str, Any]]] = None 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: ClassVar[List[str]] = ["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"] model_config = { "populate_by_name": True, @@ -156,7 +156,7 @@ class NullableClass(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/nullable_property.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/nullable_property.py index 08b1946c58f..21d8affe097 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/nullable_property.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/nullable_property.py @@ -29,7 +29,7 @@ class NullableProperty(BaseModel): """ id: StrictInt name: Optional[Annotated[str, Field(strict=True)]] - __properties = ["id", "name"] + __properties: ClassVar[List[str]] = ["id", "name"] @field_validator('name') def name_validate_regular_expression(cls, value): diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/number_only.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/number_only.py index 384ba5f7aa5..a276048ee17 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/number_only.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/number_only.py @@ -27,7 +27,7 @@ class NumberOnly(BaseModel): NumberOnly """ just_number: Optional[float] = Field(default=None, alias="JustNumber") - __properties = ["JustNumber"] + __properties: ClassVar[List[str]] = ["JustNumber"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_to_test_additional_properties.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_to_test_additional_properties.py index be3a1b2ce56..1d4ee37cac6 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_to_test_additional_properties.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_to_test_additional_properties.py @@ -27,7 +27,7 @@ class ObjectToTestAdditionalProperties(BaseModel): Minimal object # noqa: E501 """ var_property: Optional[StrictBool] = Field(default=False, description="Property", alias="property") - __properties = ["property"] + __properties: ClassVar[List[str]] = ["property"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_with_deprecated_fields.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_with_deprecated_fields.py index 805d4ce5396..378af096758 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_with_deprecated_fields.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_with_deprecated_fields.py @@ -31,7 +31,7 @@ class ObjectWithDeprecatedFields(BaseModel): id: Optional[float] = None deprecated_ref: Optional[DeprecatedObject] = Field(default=None, alias="deprecatedRef") bars: Optional[List[StrictStr]] = None - __properties = ["uuid", "id", "deprecatedRef", "bars"] + __properties: ClassVar[List[str]] = ["uuid", "id", "deprecatedRef", "bars"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/order.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/order.py index d44585a9dde..b2fc224da78 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/order.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/order.py @@ -32,7 +32,7 @@ class Order(BaseModel): ship_date: Optional[datetime] = Field(default=None, alias="shipDate") status: Optional[StrictStr] = Field(default=None, description="Order Status") complete: Optional[StrictBool] = False - __properties = ["id", "petId", "quantity", "shipDate", "status", "complete"] + __properties: ClassVar[List[str]] = ["id", "petId", "quantity", "shipDate", "status", "complete"] @field_validator('status') def status_validate_enum(cls, value): diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_composite.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_composite.py index 1f6f60549ea..031513b9f78 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_composite.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_composite.py @@ -28,7 +28,7 @@ class OuterComposite(BaseModel): my_number: Optional[float] = None my_string: Optional[StrictStr] = None my_boolean: Optional[StrictBool] = None - __properties = ["my_number", "my_string", "my_boolean"] + __properties: ClassVar[List[str]] = ["my_number", "my_string", "my_boolean"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_object_with_enum_property.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_object_with_enum_property.py index 6ac81887102..99e6d598613 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_object_with_enum_property.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_object_with_enum_property.py @@ -29,7 +29,7 @@ class OuterObjectWithEnumProperty(BaseModel): """ str_value: Optional[OuterEnum] = None value: OuterEnumInteger - __properties = ["str_value", "value"] + __properties: ClassVar[List[str]] = ["str_value", "value"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/parent.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/parent.py index d31cc7b86f3..ddff6aed576 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/parent.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/parent.py @@ -28,7 +28,7 @@ class Parent(BaseModel): Parent """ optional_dict: Optional[Dict[str, InnerDictWithProperty]] = Field(default=None, alias="optionalDict") - __properties = ["optionalDict"] + __properties: ClassVar[List[str]] = ["optionalDict"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/parent_with_optional_dict.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/parent_with_optional_dict.py index c834b3d5f74..0f0e1a4a82c 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/parent_with_optional_dict.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/parent_with_optional_dict.py @@ -28,7 +28,7 @@ class ParentWithOptionalDict(BaseModel): ParentWithOptionalDict """ optional_dict: Optional[Dict[str, InnerDictWithProperty]] = Field(default=None, alias="optionalDict") - __properties = ["optionalDict"] + __properties: ClassVar[List[str]] = ["optionalDict"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pet.py index c76cc47797c..a159e8537ce 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pet.py @@ -35,7 +35,7 @@ class Pet(BaseModel): photo_urls: Annotated[List[StrictStr], Field(min_length=0)] = Field(alias="photoUrls") tags: Optional[List[Tag]] = None status: Optional[StrictStr] = Field(default=None, description="pet status in the store") - __properties = ["id", "category", "name", "photoUrls", "tags", "status"] + __properties: ClassVar[List[str]] = ["id", "category", "name", "photoUrls", "tags", "status"] @field_validator('status') def status_validate_enum(cls, value): diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/property_name_collision.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/property_name_collision.py index af6d6cc1906..8bf9238e938 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/property_name_collision.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/property_name_collision.py @@ -29,7 +29,7 @@ class PropertyNameCollision(BaseModel): type: Optional[StrictStr] = Field(default=None, alias="_type") type: Optional[StrictStr] = None type_: Optional[StrictStr] = None - __properties = ["_type", "type", "type_"] + __properties: ClassVar[List[str]] = ["_type", "type", "type_"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/read_only_first.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/read_only_first.py index 8a34b0acc32..ac17302ac52 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/read_only_first.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/read_only_first.py @@ -27,7 +27,7 @@ class ReadOnlyFirst(BaseModel): """ bar: Optional[StrictStr] = None baz: Optional[StrictStr] = None - __properties = ["bar", "baz"] + __properties: ClassVar[List[str]] = ["bar", "baz"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/second_ref.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/second_ref.py index 5202c14fed9..bf0846fe95a 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/second_ref.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/second_ref.py @@ -27,7 +27,7 @@ class SecondRef(BaseModel): """ category: Optional[StrictStr] = None circular_ref: Optional[CircularReferenceModel] = None - __properties = ["category", "circular_ref"] + __properties: ClassVar[List[str]] = ["category", "circular_ref"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/self_reference_model.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/self_reference_model.py index b6b521e4096..b05dcf09f6d 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/self_reference_model.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/self_reference_model.py @@ -27,7 +27,7 @@ class SelfReferenceModel(BaseModel): """ size: Optional[StrictInt] = None nested: Optional[DummyModel] = None - __properties = ["size", "nested"] + __properties: ClassVar[List[str]] = ["size", "nested"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_model_name.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_model_name.py index e9c82e37092..da9365d2ffd 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_model_name.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_model_name.py @@ -27,7 +27,7 @@ class SpecialModelName(BaseModel): SpecialModelName """ special_property_name: Optional[StrictInt] = Field(default=None, alias="$special[property.name]") - __properties = ["$special[property.name]"] + __properties: ClassVar[List[str]] = ["$special[property.name]"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_name.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_name.py index 8cbf678f3c3..3cd5fa9d1a9 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_name.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_name.py @@ -30,7 +30,7 @@ class SpecialName(BaseModel): var_property: Optional[StrictInt] = Field(default=None, alias="property") var_async: Optional[Category] = Field(default=None, alias="async") var_schema: Optional[StrictStr] = Field(default=None, description="pet status in the store", alias="schema") - __properties = ["property", "async", "schema"] + __properties: ClassVar[List[str]] = ["property", "async", "schema"] @field_validator('var_schema') def var_schema_validate_enum(cls, value): diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/tag.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/tag.py index 8a7251eefbe..e8ea593fc13 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/tag.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/tag.py @@ -27,7 +27,7 @@ class Tag(BaseModel): """ id: Optional[StrictInt] = None name: Optional[StrictStr] = None - __properties = ["id", "name"] + __properties: ClassVar[List[str]] = ["id", "name"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_inline_freeform_additional_properties_request.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_inline_freeform_additional_properties_request.py index ffda6891843..3b90bf2d077 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_inline_freeform_additional_properties_request.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_inline_freeform_additional_properties_request.py @@ -28,7 +28,7 @@ class TestInlineFreeformAdditionalPropertiesRequest(BaseModel): """ some_property: Optional[StrictStr] = Field(default=None, alias="someProperty") additional_properties: Dict[str, Any] = {} - __properties = ["someProperty"] + __properties: ClassVar[List[str]] = ["someProperty"] model_config = { "populate_by_name": True, @@ -78,7 +78,7 @@ class TestInlineFreeformAdditionalPropertiesRequest(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/tiger.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/tiger.py index d0678ac15d1..366ac1aa055 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/tiger.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/tiger.py @@ -26,7 +26,7 @@ class Tiger(BaseModel): Tiger """ skill: Optional[StrictStr] = None - __properties = ["skill"] + __properties: ClassVar[List[str]] = ["skill"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/user.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/user.py index b2c1e3c7e3f..ed573fa7703 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/user.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/user.py @@ -34,7 +34,7 @@ class User(BaseModel): password: Optional[StrictStr] = None phone: Optional[StrictStr] = None user_status: Optional[StrictInt] = Field(default=None, description="User Status", alias="userStatus") - __properties = ["id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus"] + __properties: ClassVar[List[str]] = ["id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/with_nested_one_of.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/with_nested_one_of.py index 0d8f7616827..d06b1bd633d 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/with_nested_one_of.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/with_nested_one_of.py @@ -30,7 +30,7 @@ class WithNestedOneOf(BaseModel): size: Optional[StrictInt] = None nested_pig: Optional[Pig] = None nested_oneof_enum_string: Optional[OneOfEnumString] = None - __properties = ["size", "nested_pig", "nested_oneof_enum_string"] + __properties: ClassVar[List[str]] = ["size", "nested_pig", "nested_oneof_enum_string"] model_config = { "populate_by_name": True, diff --git a/samples/openapi3/client/petstore/python-aiohttp/test/test_list_class.py b/samples/openapi3/client/petstore/python-aiohttp/test/test_list_class.py new file mode 100644 index 00000000000..ac14bf3b398 --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/test/test_list_class.py @@ -0,0 +1,52 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from petstore_api.models.list_class import ListClass # noqa: E501 + +class TestListClass(unittest.TestCase): + """ListClass unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ListClass: + """Test ListClass + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `ListClass` + """ + model = ListClass() # noqa: E501 + if include_optional: + return ListClass( + var_123_list = '' + ) + else: + return ListClass( + ) + """ + + def testListClass(self): + """Test ListClass""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES index e943667b1f6..b4bc51e0452 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/.openapi-generator/FILES @@ -49,7 +49,7 @@ docs/HasOnlyReadOnly.md docs/HealthCheckResult.md docs/InnerDictWithProperty.md docs/IntOrString.md -docs/List.md +docs/ListClass.md docs/MapOfArrayOfModel.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -146,7 +146,7 @@ petstore_api/models/has_only_read_only.py petstore_api/models/health_check_result.py petstore_api/models/inner_dict_with_property.py petstore_api/models/int_or_string.py -petstore_api/models/list.py +petstore_api/models/list_class.py petstore_api/models/map_of_array_of_model.py petstore_api/models/map_test.py petstore_api/models/mixed_properties_and_additional_properties_class.py diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md index 21860a21fab..72e5fdc62d8 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md @@ -177,7 +177,7 @@ Class | Method | HTTP request | Description - [HealthCheckResult](docs/HealthCheckResult.md) - [InnerDictWithProperty](docs/InnerDictWithProperty.md) - [IntOrString](docs/IntOrString.md) - - [List](docs/List.md) + - [ListClass](docs/ListClass.md) - [MapOfArrayOfModel](docs/MapOfArrayOfModel.md) - [MapTest](docs/MapTest.md) - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ListClass.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ListClass.md new file mode 100644 index 00000000000..ceb1f50705b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/ListClass.md @@ -0,0 +1,28 @@ +# ListClass + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_123_list** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.list_class import ListClass + +# TODO update the JSON string below +json = "{}" +# create an instance of ListClass from a JSON string +list_class_instance = ListClass.from_json(json) +# print the JSON string representation of the object +print ListClass.to_json() + +# convert the object into a dict +list_class_dict = list_class_instance.to_dict() +# create an instance of ListClass from a dict +list_class_form_dict = list_class.from_dict(list_class_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py index 2023e72fb35..69c88cf7525 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/__init__.py @@ -80,7 +80,7 @@ from petstore_api.models.has_only_read_only import HasOnlyReadOnly from petstore_api.models.health_check_result import HealthCheckResult from petstore_api.models.inner_dict_with_property import InnerDictWithProperty from petstore_api.models.int_or_string import IntOrString -from petstore_api.models.list import List +from petstore_api.models.list_class import ListClass from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py index e3ce5fa5538..a00e5da5310 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/__init__.py @@ -56,7 +56,7 @@ from petstore_api.models.has_only_read_only import HasOnlyReadOnly from petstore_api.models.health_check_result import HealthCheckResult from petstore_api.models.inner_dict_with_property import InnerDictWithProperty from petstore_api.models.int_or_string import IntOrString -from petstore_api.models.list import List +from petstore_api.models.list_class import ListClass from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/list_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/list_class.py new file mode 100644 index 00000000000..ea187d934d4 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/list_class.py @@ -0,0 +1,71 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictStr + +class ListClass(BaseModel): + """ + ListClass + """ + var_123_list: Optional[StrictStr] = Field(None, alias="123-list") + __properties = ["123-list"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> ListClass: + """Create an instance of ListClass from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> ListClass: + """Create an instance of ListClass from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ListClass.parse_obj(obj) + + _obj = ListClass.parse_obj({ + "var_123_list": obj.get("123-list") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_list_class.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_list_class.py new file mode 100644 index 00000000000..ac14bf3b398 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_list_class.py @@ -0,0 +1,52 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from petstore_api.models.list_class import ListClass # noqa: E501 + +class TestListClass(unittest.TestCase): + """ListClass unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ListClass: + """Test ListClass + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `ListClass` + """ + model = ListClass() # noqa: E501 + if include_optional: + return ListClass( + var_123_list = '' + ) + else: + return ListClass( + ) + """ + + def testListClass(self): + """Test ListClass""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tests/test_model.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tests/test_model.py index 5740e38b7f3..ed4ef6c2279 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tests/test_model.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/tests/test_model.py @@ -173,7 +173,7 @@ class ModelTests(unittest.TestCase): def test_list(self): # should throw exception as var_123_list should be string try: - l3 = petstore_api.List(var_123_list=123) + l3 = petstore_api.ListClass(var_123_list=123) self.assertTrue(False) # this line shouldn't execute except ValueError as e: #error_message = ( @@ -182,13 +182,13 @@ class ModelTests(unittest.TestCase): # " str type expected (type=type_error.str)\n") self.assertTrue("str type expected" in str(e)) - l = petstore_api.List(var_123_list="bulldog") + l = petstore_api.ListClass(var_123_list="bulldog") self.assertEqual(l.to_json(), '{"123-list": "bulldog"}') self.assertEqual(l.to_dict(), {'123-list': 'bulldog'}) - l2 = petstore_api.List.from_json(l.to_json()) + l2 = petstore_api.ListClass.from_json(l.to_json()) self.assertEqual(l2.var_123_list, 'bulldog') - self.assertTrue(isinstance(l2, petstore_api.List)) + self.assertTrue(isinstance(l2, petstore_api.ListClass)) def test_enum_ref_property(self): # test enum ref property diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/FILES b/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/FILES index e943667b1f6..b4bc51e0452 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/FILES @@ -49,7 +49,7 @@ docs/HasOnlyReadOnly.md docs/HealthCheckResult.md docs/InnerDictWithProperty.md docs/IntOrString.md -docs/List.md +docs/ListClass.md docs/MapOfArrayOfModel.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -146,7 +146,7 @@ petstore_api/models/has_only_read_only.py petstore_api/models/health_check_result.py petstore_api/models/inner_dict_with_property.py petstore_api/models/int_or_string.py -petstore_api/models/list.py +petstore_api/models/list_class.py petstore_api/models/map_of_array_of_model.py petstore_api/models/map_test.py petstore_api/models/mixed_properties_and_additional_properties_class.py diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/README.md b/samples/openapi3/client/petstore/python-pydantic-v1/README.md index 66eeea58be7..b2c701e6894 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/README.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1/README.md @@ -177,7 +177,7 @@ Class | Method | HTTP request | Description - [HealthCheckResult](docs/HealthCheckResult.md) - [InnerDictWithProperty](docs/InnerDictWithProperty.md) - [IntOrString](docs/IntOrString.md) - - [List](docs/List.md) + - [ListClass](docs/ListClass.md) - [MapOfArrayOfModel](docs/MapOfArrayOfModel.md) - [MapTest](docs/MapTest.md) - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/ListClass.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ListClass.md new file mode 100644 index 00000000000..ceb1f50705b --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/ListClass.md @@ -0,0 +1,28 @@ +# ListClass + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_123_list** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.list_class import ListClass + +# TODO update the JSON string below +json = "{}" +# create an instance of ListClass from a JSON string +list_class_instance = ListClass.from_json(json) +# print the JSON string representation of the object +print ListClass.to_json() + +# convert the object into a dict +list_class_dict = list_class_instance.to_dict() +# create an instance of ListClass from a dict +list_class_form_dict = list_class.from_dict(list_class_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/__init__.py index 2023e72fb35..69c88cf7525 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/__init__.py @@ -80,7 +80,7 @@ from petstore_api.models.has_only_read_only import HasOnlyReadOnly from petstore_api.models.health_check_result import HealthCheckResult from petstore_api.models.inner_dict_with_property import InnerDictWithProperty from petstore_api.models.int_or_string import IntOrString -from petstore_api.models.list import List +from petstore_api.models.list_class import ListClass from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/__init__.py index e3ce5fa5538..a00e5da5310 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/__init__.py @@ -56,7 +56,7 @@ from petstore_api.models.has_only_read_only import HasOnlyReadOnly from petstore_api.models.health_check_result import HealthCheckResult from petstore_api.models.inner_dict_with_property import InnerDictWithProperty from petstore_api.models.int_or_string import IntOrString -from petstore_api.models.list import List +from petstore_api.models.list_class import ListClass from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/list_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/list_class.py new file mode 100644 index 00000000000..5dd77934371 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/list_class.py @@ -0,0 +1,83 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Any, Dict, Optional +from pydantic import BaseModel, Field, StrictStr + +class ListClass(BaseModel): + """ + ListClass + """ + var_123_list: Optional[StrictStr] = Field(None, alias="123-list") + additional_properties: Dict[str, Any] = {} + __properties = ["123-list"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> ListClass: + """Create an instance of ListClass from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + "additional_properties" + }, + exclude_none=True) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> ListClass: + """Create an instance of ListClass from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ListClass.parse_obj(obj) + + _obj = ListClass.parse_obj({ + "var_123_list": obj.get("123-list") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_list_class.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_list_class.py new file mode 100644 index 00000000000..ac14bf3b398 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_list_class.py @@ -0,0 +1,52 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from petstore_api.models.list_class import ListClass # noqa: E501 + +class TestListClass(unittest.TestCase): + """ListClass unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ListClass: + """Test ListClass + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `ListClass` + """ + model = ListClass() # noqa: E501 + if include_optional: + return ListClass( + var_123_list = '' + ) + else: + return ListClass( + ) + """ + + def testListClass(self): + """Test ListClass""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_model.py b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_model.py index 01d5d001fab..7d4a0200744 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_model.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/tests/test_model.py @@ -316,7 +316,7 @@ class ModelTests(unittest.TestCase): def test_list(self): # should throw exception as var_123_list should be string try: - l3 = petstore_api.List(var_123_list=123) + l3 = petstore_api.ListClass(var_123_list=123) self.assertTrue(False) # this line shouldn't execute except ValueError as e: #error_message = ( @@ -325,13 +325,13 @@ class ModelTests(unittest.TestCase): # " str type expected (type=type_error.str)\n") self.assertTrue("str type expected" in str(e)) - l = petstore_api.List(var_123_list="bulldog") + l = petstore_api.ListClass(var_123_list="bulldog") self.assertEqual(l.to_json(), '{"123-list": "bulldog"}') self.assertEqual(l.to_dict(), {'123-list': 'bulldog'}) - l2 = petstore_api.List.from_json(l.to_json()) + l2 = petstore_api.ListClass.from_json(l.to_json()) self.assertEqual(l2.var_123_list, 'bulldog') - self.assertTrue(isinstance(l2, petstore_api.List)) + self.assertTrue(isinstance(l2, petstore_api.ListClass)) def test_enum_ref_property(self): # test enum ref property diff --git a/samples/openapi3/client/petstore/python/.openapi-generator/FILES b/samples/openapi3/client/petstore/python/.openapi-generator/FILES index a39872b86ce..a126507222a 100755 --- a/samples/openapi3/client/petstore/python/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python/.openapi-generator/FILES @@ -49,7 +49,7 @@ docs/HasOnlyReadOnly.md docs/HealthCheckResult.md docs/InnerDictWithProperty.md docs/IntOrString.md -docs/List.md +docs/ListClass.md docs/MapOfArrayOfModel.md docs/MapTest.md docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -146,7 +146,7 @@ petstore_api/models/has_only_read_only.py petstore_api/models/health_check_result.py petstore_api/models/inner_dict_with_property.py petstore_api/models/int_or_string.py -petstore_api/models/list.py +petstore_api/models/list_class.py petstore_api/models/map_of_array_of_model.py petstore_api/models/map_test.py petstore_api/models/mixed_properties_and_additional_properties_class.py diff --git a/samples/openapi3/client/petstore/python/README.md b/samples/openapi3/client/petstore/python/README.md index e4cc8831876..9cf2313fc92 100755 --- a/samples/openapi3/client/petstore/python/README.md +++ b/samples/openapi3/client/petstore/python/README.md @@ -177,7 +177,7 @@ Class | Method | HTTP request | Description - [HealthCheckResult](docs/HealthCheckResult.md) - [InnerDictWithProperty](docs/InnerDictWithProperty.md) - [IntOrString](docs/IntOrString.md) - - [List](docs/List.md) + - [ListClass](docs/ListClass.md) - [MapOfArrayOfModel](docs/MapOfArrayOfModel.md) - [MapTest](docs/MapTest.md) - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) diff --git a/samples/openapi3/client/petstore/python/docs/ListClass.md b/samples/openapi3/client/petstore/python/docs/ListClass.md new file mode 100644 index 00000000000..ceb1f50705b --- /dev/null +++ b/samples/openapi3/client/petstore/python/docs/ListClass.md @@ -0,0 +1,28 @@ +# ListClass + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**var_123_list** | **str** | | [optional] + +## Example + +```python +from petstore_api.models.list_class import ListClass + +# TODO update the JSON string below +json = "{}" +# create an instance of ListClass from a JSON string +list_class_instance = ListClass.from_json(json) +# print the JSON string representation of the object +print ListClass.to_json() + +# convert the object into a dict +list_class_dict = list_class_instance.to_dict() +# create an instance of ListClass from a dict +list_class_form_dict = list_class.from_dict(list_class_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/__init__.py index 2023e72fb35..69c88cf7525 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python/petstore_api/__init__.py @@ -80,7 +80,7 @@ from petstore_api.models.has_only_read_only import HasOnlyReadOnly from petstore_api.models.health_check_result import HealthCheckResult from petstore_api.models.inner_dict_with_property import InnerDictWithProperty from petstore_api.models.int_or_string import IntOrString -from petstore_api.models.list import List +from petstore_api.models.list_class import ListClass from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py b/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py index e3ce5fa5538..a00e5da5310 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py @@ -56,7 +56,7 @@ from petstore_api.models.has_only_read_only import HasOnlyReadOnly from petstore_api.models.health_check_result import HealthCheckResult from petstore_api.models.inner_dict_with_property import InnerDictWithProperty from petstore_api.models.int_or_string import IntOrString -from petstore_api.models.list import List +from petstore_api.models.list_class import ListClass from petstore_api.models.map_of_array_of_model import MapOfArrayOfModel from petstore_api.models.map_test import MapTest from petstore_api.models.mixed_properties_and_additional_properties_class import MixedPropertiesAndAdditionalPropertiesClass diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_any_type.py b/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_any_type.py index 1be3065d20f..195ef38a9ba 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_any_type.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_any_type.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr class AdditionalPropertiesAnyType(BaseModel): @@ -27,7 +27,7 @@ class AdditionalPropertiesAnyType(BaseModel): """ name: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties = ["name"] + __properties: ClassVar[List[str]] = ["name"] model_config = { "populate_by_name": True, @@ -77,7 +77,7 @@ class AdditionalPropertiesAnyType(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_class.py b/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_class.py index 70e633cdd21..448082d2092 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_class.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_class.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr class AdditionalPropertiesClass(BaseModel): @@ -28,7 +28,7 @@ class AdditionalPropertiesClass(BaseModel): map_property: Optional[Dict[str, StrictStr]] = None map_of_map_property: Optional[Dict[str, Dict[str, StrictStr]]] = None additional_properties: Dict[str, Any] = {} - __properties = ["map_property", "map_of_map_property"] + __properties: ClassVar[List[str]] = ["map_property", "map_of_map_property"] model_config = { "populate_by_name": True, @@ -79,7 +79,7 @@ class AdditionalPropertiesClass(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_object.py b/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_object.py index c401cd724c5..f6028c9bf57 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_object.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_object.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr class AdditionalPropertiesObject(BaseModel): @@ -27,7 +27,7 @@ class AdditionalPropertiesObject(BaseModel): """ name: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties = ["name"] + __properties: ClassVar[List[str]] = ["name"] model_config = { "populate_by_name": True, @@ -77,7 +77,7 @@ class AdditionalPropertiesObject(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_with_description_only.py b/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_with_description_only.py index 546c5774950..4d72bd36315 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_with_description_only.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/additional_properties_with_description_only.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr class AdditionalPropertiesWithDescriptionOnly(BaseModel): @@ -27,7 +27,7 @@ class AdditionalPropertiesWithDescriptionOnly(BaseModel): """ name: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties = ["name"] + __properties: ClassVar[List[str]] = ["name"] model_config = { "populate_by_name": True, @@ -77,7 +77,7 @@ class AdditionalPropertiesWithDescriptionOnly(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/all_of_with_single_ref.py b/samples/openapi3/client/petstore/python/petstore_api/models/all_of_with_single_ref.py index d88e6480c91..f0d179f8752 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/all_of_with_single_ref.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/all_of_with_single_ref.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field from petstore_api.models.single_ref_type import SingleRefType @@ -30,7 +30,7 @@ class AllOfWithSingleRef(BaseModel): username: Optional[StrictStr] = None single_ref_type: Optional[SingleRefType] = Field(default=None, alias="SingleRefType") additional_properties: Dict[str, Any] = {} - __properties = ["username", "SingleRefType"] + __properties: ClassVar[List[str]] = ["username", "SingleRefType"] model_config = { "populate_by_name": True, @@ -81,7 +81,7 @@ class AllOfWithSingleRef(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/animal.py b/samples/openapi3/client/petstore/python/petstore_api/models/animal.py index e5c95fef232..55f9889c8eb 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/animal.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/animal.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional, Union +from typing import Any, ClassVar, Dict, List, Optional, Union from pydantic import BaseModel, StrictStr from pydantic import Field @@ -29,7 +29,7 @@ class Animal(BaseModel): class_name: StrictStr = Field(alias="className") color: Optional[StrictStr] = 'red' additional_properties: Dict[str, Any] = {} - __properties = ["className", "color"] + __properties: ClassVar[List[str]] = ["className", "color"] model_config = { "populate_by_name": True, @@ -38,20 +38,19 @@ class Animal(BaseModel): # JSON field name that stores the object type - __discriminator_property_name = 'className' + __discriminator_property_name: ClassVar[List[str]] = 'className' # discriminator mappings - __discriminator_value_class_map = { - 'Cat': 'Cat', - 'Dog': 'Dog' + __discriminator_value_class_map: ClassVar[Dict[str, str]] = { + 'Cat': 'Cat','Dog': 'Dog' } @classmethod def get_discriminator_value(cls, obj: dict) -> str: """Returns the discriminator value (object type) of the data""" - discriminator_value = obj[cls.__discriminator_property_name.default] + discriminator_value = obj[cls.__discriminator_property_name] if discriminator_value: - return cls.__discriminator_value_class_map.default.get(discriminator_value) + return cls.__discriminator_value_class_map.get(discriminator_value) else: return None @@ -93,8 +92,8 @@ class Animal(BaseModel): return klass.from_dict(obj) else: raise ValueError("Animal failed to lookup discriminator value from " + - json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name.default + - ", mapping: " + json.dumps(cls.__discriminator_value_class_map.default)) + json.dumps(obj) + ". Discriminator property name: " + cls.__discriminator_property_name + + ", mapping: " + json.dumps(cls.__discriminator_value_class_map)) from petstore_api.models.cat import Cat from petstore_api.models.dog import Dog diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/api_response.py b/samples/openapi3/client/petstore/python/petstore_api/models/api_response.py index a08e764c93b..562069d7db9 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/api_response.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/api_response.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr class ApiResponse(BaseModel): @@ -29,7 +29,7 @@ class ApiResponse(BaseModel): type: Optional[StrictStr] = None message: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties = ["code", "type", "message"] + __properties: ClassVar[List[str]] = ["code", "type", "message"] model_config = { "populate_by_name": True, @@ -81,7 +81,7 @@ class ApiResponse(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/array_of_array_of_model.py b/samples/openapi3/client/petstore/python/petstore_api/models/array_of_array_of_model.py index c242a481e59..21eacad79a3 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/array_of_array_of_model.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/array_of_array_of_model.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, List, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from petstore_api.models.tag import Tag @@ -28,7 +28,7 @@ class ArrayOfArrayOfModel(BaseModel): """ another_property: Optional[List[List[Tag]]] = None additional_properties: Dict[str, Any] = {} - __properties = ["another_property"] + __properties: ClassVar[List[str]] = ["another_property"] model_config = { "populate_by_name": True, @@ -90,7 +90,7 @@ class ArrayOfArrayOfModel(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/array_of_array_of_number_only.py b/samples/openapi3/client/petstore/python/petstore_api/models/array_of_array_of_number_only.py index d2f8b48a1b4..d934fac1f56 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/array_of_array_of_number_only.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/array_of_array_of_number_only.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, List, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictFloat from pydantic import Field @@ -28,7 +28,7 @@ class ArrayOfArrayOfNumberOnly(BaseModel): """ array_array_number: Optional[List[List[StrictFloat]]] = Field(default=None, alias="ArrayArrayNumber") additional_properties: Dict[str, Any] = {} - __properties = ["ArrayArrayNumber"] + __properties: ClassVar[List[str]] = ["ArrayArrayNumber"] model_config = { "populate_by_name": True, @@ -78,7 +78,7 @@ class ArrayOfArrayOfNumberOnly(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/array_of_number_only.py b/samples/openapi3/client/petstore/python/petstore_api/models/array_of_number_only.py index 7b013a257cd..e3d3e6c6bb8 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/array_of_number_only.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/array_of_number_only.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, List, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictFloat from pydantic import Field @@ -28,7 +28,7 @@ class ArrayOfNumberOnly(BaseModel): """ array_number: Optional[List[StrictFloat]] = Field(default=None, alias="ArrayNumber") additional_properties: Dict[str, Any] = {} - __properties = ["ArrayNumber"] + __properties: ClassVar[List[str]] = ["ArrayNumber"] model_config = { "populate_by_name": True, @@ -78,7 +78,7 @@ class ArrayOfNumberOnly(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/array_test.py b/samples/openapi3/client/petstore/python/petstore_api/models/array_test.py index 028329d774a..b49970b7f85 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/array_test.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/array_test.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, List, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr from pydantic import Field from typing_extensions import Annotated @@ -32,7 +32,7 @@ class ArrayTest(BaseModel): array_array_of_integer: Optional[List[List[StrictInt]]] = None array_array_of_model: Optional[List[List[ReadOnlyFirst]]] = None additional_properties: Dict[str, Any] = {} - __properties = ["array_of_string", "array_array_of_integer", "array_array_of_model"] + __properties: ClassVar[List[str]] = ["array_of_string", "array_array_of_integer", "array_array_of_model"] model_config = { "populate_by_name": True, @@ -96,7 +96,7 @@ class ArrayTest(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/basque_pig.py b/samples/openapi3/client/petstore/python/petstore_api/models/basque_pig.py index c107ca3b05c..55c35407bf7 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/basque_pig.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/basque_pig.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict +from typing import Any, ClassVar, Dict, List from pydantic import BaseModel, StrictStr from pydantic import Field @@ -29,7 +29,7 @@ class BasquePig(BaseModel): class_name: StrictStr = Field(alias="className") color: StrictStr additional_properties: Dict[str, Any] = {} - __properties = ["className", "color"] + __properties: ClassVar[List[str]] = ["className", "color"] model_config = { "populate_by_name": True, @@ -80,7 +80,7 @@ class BasquePig(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/capitalization.py b/samples/openapi3/client/petstore/python/petstore_api/models/capitalization.py index 96466c37806..d05dfaea736 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/capitalization.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/capitalization.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field @@ -33,7 +33,7 @@ class Capitalization(BaseModel): sca_eth_flow_points: Optional[StrictStr] = Field(default=None, alias="SCA_ETH_Flow_Points") att_name: Optional[StrictStr] = Field(default=None, description="Name of the pet ", alias="ATT_NAME") additional_properties: Dict[str, Any] = {} - __properties = ["smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME"] + __properties: ClassVar[List[str]] = ["smallCamel", "CapitalCamel", "small_Snake", "Capital_Snake", "SCA_ETH_Flow_Points", "ATT_NAME"] model_config = { "populate_by_name": True, @@ -88,7 +88,7 @@ class Capitalization(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/cat.py b/samples/openapi3/client/petstore/python/petstore_api/models/cat.py index e3f7c2a6ea5..224d78427df 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/cat.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/cat.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import StrictBool from petstore_api.models.animal import Animal @@ -28,7 +28,7 @@ class Cat(Animal): """ declawed: Optional[StrictBool] = None additional_properties: Dict[str, Any] = {} - __properties = ["className", "color", "declawed"] + __properties: ClassVar[List[str]] = ["className", "color", "declawed"] model_config = { "populate_by_name": True, @@ -80,7 +80,7 @@ class Cat(Animal): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/category.py b/samples/openapi3/client/petstore/python/petstore_api/models/category.py index 6dcba4df529..eadddb42b72 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/category.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/category.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr class Category(BaseModel): @@ -28,7 +28,7 @@ class Category(BaseModel): id: Optional[StrictInt] = None name: StrictStr additional_properties: Dict[str, Any] = {} - __properties = ["id", "name"] + __properties: ClassVar[List[str]] = ["id", "name"] model_config = { "populate_by_name": True, @@ -79,7 +79,7 @@ class Category(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/circular_reference_model.py b/samples/openapi3/client/petstore/python/petstore_api/models/circular_reference_model.py index a1e6b907549..ebea0cac3a2 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/circular_reference_model.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/circular_reference_model.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt class CircularReferenceModel(BaseModel): @@ -28,7 +28,7 @@ class CircularReferenceModel(BaseModel): size: Optional[StrictInt] = None nested: Optional[FirstRef] = None additional_properties: Dict[str, Any] = {} - __properties = ["size", "nested"] + __properties: ClassVar[List[str]] = ["size", "nested"] model_config = { "populate_by_name": True, @@ -82,7 +82,7 @@ class CircularReferenceModel(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/class_model.py b/samples/openapi3/client/petstore/python/petstore_api/models/class_model.py index d8e9f2252ef..7ce61a06aad 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/class_model.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/class_model.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field @@ -28,7 +28,7 @@ class ClassModel(BaseModel): """ var_class: Optional[StrictStr] = Field(default=None, alias="_class") additional_properties: Dict[str, Any] = {} - __properties = ["_class"] + __properties: ClassVar[List[str]] = ["_class"] model_config = { "populate_by_name": True, @@ -78,7 +78,7 @@ class ClassModel(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/client.py b/samples/openapi3/client/petstore/python/petstore_api/models/client.py index 278f76d80bc..c66b3af98f7 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/client.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr class Client(BaseModel): @@ -27,7 +27,7 @@ class Client(BaseModel): """ client: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties = ["client"] + __properties: ClassVar[List[str]] = ["client"] model_config = { "populate_by_name": True, @@ -77,7 +77,7 @@ class Client(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/creature.py b/samples/openapi3/client/petstore/python/petstore_api/models/creature.py index 1ed187ed459..63391047e32 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/creature.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/creature.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict +from typing import Any, ClassVar, Dict, List from pydantic import BaseModel, StrictStr from petstore_api.models.creature_info import CreatureInfo @@ -29,7 +29,7 @@ class Creature(BaseModel): info: CreatureInfo type: StrictStr additional_properties: Dict[str, Any] = {} - __properties = ["info", "type"] + __properties: ClassVar[List[str]] = ["info", "type"] model_config = { "populate_by_name": True, @@ -83,7 +83,7 @@ class Creature(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/creature_info.py b/samples/openapi3/client/petstore/python/petstore_api/models/creature_info.py index 7c8c9657254..e5a55e5329f 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/creature_info.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/creature_info.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict +from typing import Any, ClassVar, Dict, List from pydantic import BaseModel, StrictStr class CreatureInfo(BaseModel): @@ -27,7 +27,7 @@ class CreatureInfo(BaseModel): """ name: StrictStr additional_properties: Dict[str, Any] = {} - __properties = ["name"] + __properties: ClassVar[List[str]] = ["name"] model_config = { "populate_by_name": True, @@ -77,7 +77,7 @@ class CreatureInfo(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/danish_pig.py b/samples/openapi3/client/petstore/python/petstore_api/models/danish_pig.py index 6ba8851e8dd..185a5085962 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/danish_pig.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/danish_pig.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict +from typing import Any, ClassVar, Dict, List from pydantic import BaseModel, StrictInt, StrictStr from pydantic import Field @@ -29,7 +29,7 @@ class DanishPig(BaseModel): class_name: StrictStr = Field(alias="className") size: StrictInt additional_properties: Dict[str, Any] = {} - __properties = ["className", "size"] + __properties: ClassVar[List[str]] = ["className", "size"] model_config = { "populate_by_name": True, @@ -80,7 +80,7 @@ class DanishPig(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/deprecated_object.py b/samples/openapi3/client/petstore/python/petstore_api/models/deprecated_object.py index 3a283d11bce..61e966b24a0 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/deprecated_object.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/deprecated_object.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr class DeprecatedObject(BaseModel): @@ -27,7 +27,7 @@ class DeprecatedObject(BaseModel): """ name: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties = ["name"] + __properties: ClassVar[List[str]] = ["name"] model_config = { "populate_by_name": True, @@ -77,7 +77,7 @@ class DeprecatedObject(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/dog.py b/samples/openapi3/client/petstore/python/petstore_api/models/dog.py index a6f8a6d23cc..924859c2ae7 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/dog.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/dog.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import StrictStr from petstore_api.models.animal import Animal @@ -28,7 +28,7 @@ class Dog(Animal): """ breed: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties = ["className", "color", "breed"] + __properties: ClassVar[List[str]] = ["className", "color", "breed"] model_config = { "populate_by_name": True, @@ -80,7 +80,7 @@ class Dog(Animal): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/dummy_model.py b/samples/openapi3/client/petstore/python/petstore_api/models/dummy_model.py index 42bed2afa37..74afee15032 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/dummy_model.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/dummy_model.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr class DummyModel(BaseModel): @@ -28,7 +28,7 @@ class DummyModel(BaseModel): category: Optional[StrictStr] = None self_ref: Optional[SelfReferenceModel] = None additional_properties: Dict[str, Any] = {} - __properties = ["category", "self_ref"] + __properties: ClassVar[List[str]] = ["category", "self_ref"] model_config = { "populate_by_name": True, @@ -82,7 +82,7 @@ class DummyModel(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python/petstore_api/models/enum_arrays.py index 1af1ef9c00d..c04e41b7b4a 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/enum_arrays.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/enum_arrays.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, List, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr, field_validator class EnumArrays(BaseModel): @@ -28,7 +28,7 @@ class EnumArrays(BaseModel): just_symbol: Optional[StrictStr] = None array_enum: Optional[List[StrictStr]] = None additional_properties: Dict[str, Any] = {} - __properties = ["just_symbol", "array_enum"] + __properties: ClassVar[List[str]] = ["just_symbol", "array_enum"] @field_validator('just_symbol') def just_symbol_validate_enum(cls, value): @@ -100,7 +100,7 @@ class EnumArrays(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python/petstore_api/models/enum_test.py index 937a10fcc5e..1138ee69bba 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/enum_test.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/enum_test.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr, field_validator from pydantic import Field from petstore_api.models.outer_enum import OuterEnum @@ -40,7 +40,7 @@ class EnumTest(BaseModel): outer_enum_default_value: Optional[OuterEnumDefaultValue] = Field(default=None, alias="outerEnumDefaultValue") outer_enum_integer_default_value: Optional[OuterEnumIntegerDefaultValue] = Field(default=None, alias="outerEnumIntegerDefaultValue") additional_properties: Dict[str, Any] = {} - __properties = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue"] + __properties: ClassVar[List[str]] = ["enum_string", "enum_string_required", "enum_integer_default", "enum_integer", "enum_number", "outerEnum", "outerEnumInteger", "outerEnumDefaultValue", "outerEnumIntegerDefaultValue"] @field_validator('enum_string') def enum_string_validate_enum(cls, value): @@ -150,7 +150,7 @@ class EnumTest(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/file.py b/samples/openapi3/client/petstore/python/petstore_api/models/file.py index 80b1564e58f..35827d95ec3 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/file.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/file.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field @@ -28,7 +28,7 @@ class File(BaseModel): """ source_uri: Optional[StrictStr] = Field(default=None, description="Test capitalization", alias="sourceURI") additional_properties: Dict[str, Any] = {} - __properties = ["sourceURI"] + __properties: ClassVar[List[str]] = ["sourceURI"] model_config = { "populate_by_name": True, @@ -78,7 +78,7 @@ class File(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/file_schema_test_class.py b/samples/openapi3/client/petstore/python/petstore_api/models/file_schema_test_class.py index 030d9f29edb..b11444edfc8 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/file_schema_test_class.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/file_schema_test_class.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, List, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from petstore_api.models.file import File @@ -29,7 +29,7 @@ class FileSchemaTestClass(BaseModel): file: Optional[File] = None files: Optional[List[File]] = None additional_properties: Dict[str, Any] = {} - __properties = ["file", "files"] + __properties: ClassVar[List[str]] = ["file", "files"] model_config = { "populate_by_name": True, @@ -90,7 +90,7 @@ class FileSchemaTestClass(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/first_ref.py b/samples/openapi3/client/petstore/python/petstore_api/models/first_ref.py index 900034234a4..007265a6042 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/first_ref.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/first_ref.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr class FirstRef(BaseModel): @@ -28,7 +28,7 @@ class FirstRef(BaseModel): category: Optional[StrictStr] = None self_ref: Optional[SecondRef] = None additional_properties: Dict[str, Any] = {} - __properties = ["category", "self_ref"] + __properties: ClassVar[List[str]] = ["category", "self_ref"] model_config = { "populate_by_name": True, @@ -82,7 +82,7 @@ class FirstRef(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/foo.py b/samples/openapi3/client/petstore/python/petstore_api/models/foo.py index cacb692da0c..97d1400aeef 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/foo.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/foo.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr class Foo(BaseModel): @@ -27,7 +27,7 @@ class Foo(BaseModel): """ bar: Optional[StrictStr] = 'bar' additional_properties: Dict[str, Any] = {} - __properties = ["bar"] + __properties: ClassVar[List[str]] = ["bar"] model_config = { "populate_by_name": True, @@ -77,7 +77,7 @@ class Foo(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/foo_get_default_response.py b/samples/openapi3/client/petstore/python/petstore_api/models/foo_get_default_response.py index ac6ef75e60b..493a56736af 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/foo_get_default_response.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/foo_get_default_response.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from petstore_api.models.foo import Foo @@ -28,7 +28,7 @@ class FooGetDefaultResponse(BaseModel): """ string: Optional[Foo] = None additional_properties: Dict[str, Any] = {} - __properties = ["string"] + __properties: ClassVar[List[str]] = ["string"] model_config = { "populate_by_name": True, @@ -81,7 +81,7 @@ class FooGetDefaultResponse(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/format_test.py b/samples/openapi3/client/petstore/python/petstore_api/models/format_test.py index e383796a98f..3879c053f66 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/format_test.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/format_test.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json from datetime import date, datetime -from typing import Any, Dict, Optional, Union +from typing import Any, ClassVar, Dict, List, Optional, Union from pydantic import BaseModel, StrictBytes, StrictInt, StrictStr, field_validator from decimal import Decimal from pydantic import Field @@ -45,7 +45,7 @@ class FormatTest(BaseModel): pattern_with_digits: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="A string that is a 10 digit number. Can have leading zeros.") 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.") additional_properties: Dict[str, Any] = {} - __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: ClassVar[List[str]] = ["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"] @field_validator('string') def string_validate_regular_expression(cls, value): @@ -150,7 +150,7 @@ class FormatTest(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/has_only_read_only.py b/samples/openapi3/client/petstore/python/petstore_api/models/has_only_read_only.py index 50af5287e1a..d24948864e0 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/has_only_read_only.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/has_only_read_only.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr class HasOnlyReadOnly(BaseModel): @@ -28,7 +28,7 @@ class HasOnlyReadOnly(BaseModel): bar: Optional[StrictStr] = None foo: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties = ["bar", "foo"] + __properties: ClassVar[List[str]] = ["bar", "foo"] model_config = { "populate_by_name": True, @@ -81,7 +81,7 @@ class HasOnlyReadOnly(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/health_check_result.py b/samples/openapi3/client/petstore/python/petstore_api/models/health_check_result.py index bcb06ace99c..a1ebf76f9de 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/health_check_result.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/health_check_result.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field @@ -28,7 +28,7 @@ class HealthCheckResult(BaseModel): """ nullable_message: Optional[StrictStr] = Field(default=None, alias="NullableMessage") additional_properties: Dict[str, Any] = {} - __properties = ["NullableMessage"] + __properties: ClassVar[List[str]] = ["NullableMessage"] model_config = { "populate_by_name": True, @@ -83,7 +83,7 @@ class HealthCheckResult(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/inner_dict_with_property.py b/samples/openapi3/client/petstore/python/petstore_api/models/inner_dict_with_property.py index e53b2401dd7..1105ca6df35 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/inner_dict_with_property.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/inner_dict_with_property.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional, Union +from typing import Any, ClassVar, Dict, List, Optional, Union from pydantic import BaseModel from pydantic import Field @@ -28,7 +28,7 @@ class InnerDictWithProperty(BaseModel): """ a_property: Optional[Union[str, Any]] = Field(default=None, alias="aProperty") additional_properties: Dict[str, Any] = {} - __properties = ["aProperty"] + __properties: ClassVar[List[str]] = ["aProperty"] model_config = { "populate_by_name": True, @@ -78,7 +78,7 @@ class InnerDictWithProperty(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/list_class.py b/samples/openapi3/client/petstore/python/petstore_api/models/list_class.py new file mode 100644 index 00000000000..1ffb492b72a --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/models/list_class.py @@ -0,0 +1,86 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, StrictStr +from pydantic import Field + +class ListClass(BaseModel): + """ + ListClass + """ + var_123_list: Optional[StrictStr] = Field(default=None, alias="123-list") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["123-list"] + + model_config = { + "populate_by_name": True, + "validate_assignment": True + } + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> ListClass: + """Create an instance of ListClass from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.model_dump(by_alias=True, + exclude={ + "additional_properties" + }, + exclude_none=True) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> ListClass: + """Create an instance of ListClass from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ListClass.model_validate(obj) + + _obj = ListClass.model_validate({ + "123-list": obj.get("123-list") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/map_of_array_of_model.py b/samples/openapi3/client/petstore/python/petstore_api/models/map_of_array_of_model.py index f33be2c87f4..8db9f4e7535 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/map_of_array_of_model.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/map_of_array_of_model.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, List, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from pydantic import Field from petstore_api.models.tag import Tag @@ -29,7 +29,7 @@ class MapOfArrayOfModel(BaseModel): """ shop_id_to_org_online_lip_map: Optional[Dict[str, List[Tag]]] = Field(default=None, alias="shopIdToOrgOnlineLipMap") additional_properties: Dict[str, Any] = {} - __properties = ["shopIdToOrgOnlineLipMap"] + __properties: ClassVar[List[str]] = ["shopIdToOrgOnlineLipMap"] model_config = { "populate_by_name": True, @@ -95,7 +95,7 @@ class MapOfArrayOfModel(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/map_test.py b/samples/openapi3/client/petstore/python/petstore_api/models/map_test.py index e08eb788b98..e6472e6d41e 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/map_test.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/map_test.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool, StrictStr, field_validator class MapTest(BaseModel): @@ -30,7 +30,7 @@ class MapTest(BaseModel): direct_map: Optional[Dict[str, StrictBool]] = None indirect_map: Optional[Dict[str, StrictBool]] = None additional_properties: Dict[str, Any] = {} - __properties = ["map_map_of_string", "map_of_enum_string", "direct_map", "indirect_map"] + __properties: ClassVar[List[str]] = ["map_map_of_string", "map_of_enum_string", "direct_map", "indirect_map"] @field_validator('map_of_enum_string') def map_of_enum_string_validate_enum(cls, value): @@ -93,7 +93,7 @@ class MapTest(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/openapi3/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py index fba7f02172a..866bd727b94 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json from datetime import datetime -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field from petstore_api.models.animal import Animal @@ -31,7 +31,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(BaseModel): date_time: Optional[datetime] = Field(default=None, alias="dateTime") map: Optional[Dict[str, Animal]] = None additional_properties: Dict[str, Any] = {} - __properties = ["uuid", "dateTime", "map"] + __properties: ClassVar[List[str]] = ["uuid", "dateTime", "map"] model_config = { "populate_by_name": True, @@ -95,7 +95,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/model200_response.py b/samples/openapi3/client/petstore/python/petstore_api/models/model200_response.py index f5818228991..ad735d59e1d 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/model200_response.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/model200_response.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr from pydantic import Field @@ -29,7 +29,7 @@ class Model200Response(BaseModel): name: Optional[StrictInt] = None var_class: Optional[StrictStr] = Field(default=None, alias="class") additional_properties: Dict[str, Any] = {} - __properties = ["name", "class"] + __properties: ClassVar[List[str]] = ["name", "class"] model_config = { "populate_by_name": True, @@ -80,7 +80,7 @@ class Model200Response(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/model_return.py b/samples/openapi3/client/petstore/python/petstore_api/models/model_return.py index d39ad5cb6bd..fe885761c7a 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/model_return.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/model_return.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt from pydantic import Field @@ -28,7 +28,7 @@ class ModelReturn(BaseModel): """ var_return: Optional[StrictInt] = Field(default=None, alias="return") additional_properties: Dict[str, Any] = {} - __properties = ["return"] + __properties: ClassVar[List[str]] = ["return"] model_config = { "populate_by_name": True, @@ -78,7 +78,7 @@ class ModelReturn(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/name.py b/samples/openapi3/client/petstore/python/petstore_api/models/name.py index 5b473903729..f0f1a15dba8 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/name.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/name.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr from pydantic import Field @@ -31,7 +31,7 @@ class Name(BaseModel): var_property: Optional[StrictStr] = Field(default=None, alias="property") var_123_number: Optional[StrictInt] = Field(default=None, alias="123Number") additional_properties: Dict[str, Any] = {} - __properties = ["name", "snake_case", "property", "123Number"] + __properties: ClassVar[List[str]] = ["name", "snake_case", "property", "123Number"] model_config = { "populate_by_name": True, @@ -86,7 +86,7 @@ class Name(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/nullable_class.py b/samples/openapi3/client/petstore/python/petstore_api/models/nullable_class.py index 4c46cc2ae23..133edab35fa 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/nullable_class.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/nullable_class.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json from datetime import date, datetime -from typing import Any, Dict, List, Optional, Union +from typing import Any, ClassVar, Dict, List, Optional, Union from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt, StrictStr class NullableClass(BaseModel): @@ -39,7 +39,7 @@ class NullableClass(BaseModel): object_and_items_nullable_prop: Optional[Dict[str, Union[str, Any]]] = None object_items_nullable: Optional[Dict[str, Union[str, Any]]] = None 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: ClassVar[List[str]] = ["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"] model_config = { "populate_by_name": True, @@ -156,7 +156,7 @@ class NullableClass(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/nullable_property.py b/samples/openapi3/client/petstore/python/petstore_api/models/nullable_property.py index 9feb0a3f0a0..7c011e64af7 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/nullable_property.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/nullable_property.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, field_validator from pydantic import Field from typing_extensions import Annotated @@ -30,7 +30,7 @@ class NullableProperty(BaseModel): id: StrictInt name: Optional[Annotated[str, Field(strict=True)]] additional_properties: Dict[str, Any] = {} - __properties = ["id", "name"] + __properties: ClassVar[List[str]] = ["id", "name"] @field_validator('name') def name_validate_regular_expression(cls, value): @@ -96,7 +96,7 @@ class NullableProperty(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/number_only.py b/samples/openapi3/client/petstore/python/petstore_api/models/number_only.py index 845ec245db6..1d3bec3e4f1 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/number_only.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/number_only.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictFloat from pydantic import Field @@ -28,7 +28,7 @@ class NumberOnly(BaseModel): """ just_number: Optional[StrictFloat] = Field(default=None, alias="JustNumber") additional_properties: Dict[str, Any] = {} - __properties = ["JustNumber"] + __properties: ClassVar[List[str]] = ["JustNumber"] model_config = { "populate_by_name": True, @@ -78,7 +78,7 @@ class NumberOnly(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/object_to_test_additional_properties.py b/samples/openapi3/client/petstore/python/petstore_api/models/object_to_test_additional_properties.py index 30d264be3ac..67f3a95c084 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/object_to_test_additional_properties.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/object_to_test_additional_properties.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool from pydantic import Field @@ -28,7 +28,7 @@ class ObjectToTestAdditionalProperties(BaseModel): """ var_property: Optional[StrictBool] = Field(default=False, description="Property", alias="property") additional_properties: Dict[str, Any] = {} - __properties = ["property"] + __properties: ClassVar[List[str]] = ["property"] model_config = { "populate_by_name": True, @@ -78,7 +78,7 @@ class ObjectToTestAdditionalProperties(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/object_with_deprecated_fields.py b/samples/openapi3/client/petstore/python/petstore_api/models/object_with_deprecated_fields.py index a37a6415a92..21cabc3ecad 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/object_with_deprecated_fields.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/object_with_deprecated_fields.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, List, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictFloat, StrictStr from pydantic import Field from petstore_api.models.deprecated_object import DeprecatedObject @@ -32,7 +32,7 @@ class ObjectWithDeprecatedFields(BaseModel): deprecated_ref: Optional[DeprecatedObject] = Field(default=None, alias="deprecatedRef") bars: Optional[List[StrictStr]] = None additional_properties: Dict[str, Any] = {} - __properties = ["uuid", "id", "deprecatedRef", "bars"] + __properties: ClassVar[List[str]] = ["uuid", "id", "deprecatedRef", "bars"] model_config = { "populate_by_name": True, @@ -88,7 +88,7 @@ class ObjectWithDeprecatedFields(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/order.py b/samples/openapi3/client/petstore/python/petstore_api/models/order.py index 9a082803f8c..887295c377b 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/order.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/order.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json from datetime import datetime -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool, StrictInt, StrictStr, field_validator from pydantic import Field @@ -33,7 +33,7 @@ class Order(BaseModel): status: Optional[StrictStr] = Field(default=None, description="Order Status") complete: Optional[StrictBool] = False additional_properties: Dict[str, Any] = {} - __properties = ["id", "petId", "quantity", "shipDate", "status", "complete"] + __properties: ClassVar[List[str]] = ["id", "petId", "quantity", "shipDate", "status", "complete"] @field_validator('status') def status_validate_enum(cls, value): @@ -98,7 +98,7 @@ class Order(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/outer_composite.py b/samples/openapi3/client/petstore/python/petstore_api/models/outer_composite.py index 5b85be74ab9..bfa27a9f71e 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/outer_composite.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/outer_composite.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictBool, StrictFloat, StrictStr class OuterComposite(BaseModel): @@ -29,7 +29,7 @@ class OuterComposite(BaseModel): my_string: Optional[StrictStr] = None my_boolean: Optional[StrictBool] = None additional_properties: Dict[str, Any] = {} - __properties = ["my_number", "my_string", "my_boolean"] + __properties: ClassVar[List[str]] = ["my_number", "my_string", "my_boolean"] model_config = { "populate_by_name": True, @@ -81,7 +81,7 @@ class OuterComposite(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/outer_object_with_enum_property.py b/samples/openapi3/client/petstore/python/petstore_api/models/outer_object_with_enum_property.py index fe073e3cc8c..888e279f569 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/outer_object_with_enum_property.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/outer_object_with_enum_property.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from petstore_api.models.outer_enum import OuterEnum from petstore_api.models.outer_enum_integer import OuterEnumInteger @@ -30,7 +30,7 @@ class OuterObjectWithEnumProperty(BaseModel): str_value: Optional[OuterEnum] = None value: OuterEnumInteger additional_properties: Dict[str, Any] = {} - __properties = ["str_value", "value"] + __properties: ClassVar[List[str]] = ["str_value", "value"] model_config = { "populate_by_name": True, @@ -86,7 +86,7 @@ class OuterObjectWithEnumProperty(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/parent.py b/samples/openapi3/client/petstore/python/petstore_api/models/parent.py index 3f92a9bdc3d..9b577c13458 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/parent.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/parent.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from pydantic import Field from petstore_api.models.inner_dict_with_property import InnerDictWithProperty @@ -29,7 +29,7 @@ class Parent(BaseModel): """ optional_dict: Optional[Dict[str, InnerDictWithProperty]] = Field(default=None, alias="optionalDict") additional_properties: Dict[str, Any] = {} - __properties = ["optionalDict"] + __properties: ClassVar[List[str]] = ["optionalDict"] model_config = { "populate_by_name": True, @@ -91,7 +91,7 @@ class Parent(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/parent_with_optional_dict.py b/samples/openapi3/client/petstore/python/petstore_api/models/parent_with_optional_dict.py index 54f687f1ea2..cefb6c6a022 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/parent_with_optional_dict.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/parent_with_optional_dict.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel from pydantic import Field from petstore_api.models.inner_dict_with_property import InnerDictWithProperty @@ -29,7 +29,7 @@ class ParentWithOptionalDict(BaseModel): """ optional_dict: Optional[Dict[str, InnerDictWithProperty]] = Field(default=None, alias="optionalDict") additional_properties: Dict[str, Any] = {} - __properties = ["optionalDict"] + __properties: ClassVar[List[str]] = ["optionalDict"] model_config = { "populate_by_name": True, @@ -91,7 +91,7 @@ class ParentWithOptionalDict(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python/petstore_api/models/pet.py index d79d9c94df5..16e34199fc0 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/pet.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, List, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr, field_validator from pydantic import Field from typing_extensions import Annotated @@ -36,7 +36,7 @@ class Pet(BaseModel): tags: Optional[List[Tag]] = None status: Optional[StrictStr] = Field(default=None, description="pet status in the store") additional_properties: Dict[str, Any] = {} - __properties = ["id", "category", "name", "photoUrls", "tags", "status"] + __properties: ClassVar[List[str]] = ["id", "category", "name", "photoUrls", "tags", "status"] @field_validator('status') def status_validate_enum(cls, value): @@ -111,7 +111,7 @@ class Pet(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/property_name_collision.py b/samples/openapi3/client/petstore/python/petstore_api/models/property_name_collision.py index 78d9f97a026..ddb6723d051 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/property_name_collision.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/property_name_collision.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field @@ -30,7 +30,7 @@ class PropertyNameCollision(BaseModel): type: Optional[StrictStr] = None type_with_underscore: Optional[StrictStr] = Field(default=None, alias="type_") additional_properties: Dict[str, Any] = {} - __properties = ["_type", "type", "type_"] + __properties: ClassVar[List[str]] = ["_type", "type", "type_"] model_config = { "populate_by_name": True, @@ -82,7 +82,7 @@ class PropertyNameCollision(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/read_only_first.py b/samples/openapi3/client/petstore/python/petstore_api/models/read_only_first.py index 581ecdf7b54..9ce549b364b 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/read_only_first.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/read_only_first.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr class ReadOnlyFirst(BaseModel): @@ -28,7 +28,7 @@ class ReadOnlyFirst(BaseModel): bar: Optional[StrictStr] = None baz: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties = ["bar", "baz"] + __properties: ClassVar[List[str]] = ["bar", "baz"] model_config = { "populate_by_name": True, @@ -80,7 +80,7 @@ class ReadOnlyFirst(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/second_ref.py b/samples/openapi3/client/petstore/python/petstore_api/models/second_ref.py index 286f39e4ae4..8869cb60a1b 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/second_ref.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/second_ref.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr class SecondRef(BaseModel): @@ -28,7 +28,7 @@ class SecondRef(BaseModel): category: Optional[StrictStr] = None circular_ref: Optional[CircularReferenceModel] = None additional_properties: Dict[str, Any] = {} - __properties = ["category", "circular_ref"] + __properties: ClassVar[List[str]] = ["category", "circular_ref"] model_config = { "populate_by_name": True, @@ -82,7 +82,7 @@ class SecondRef(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/self_reference_model.py b/samples/openapi3/client/petstore/python/petstore_api/models/self_reference_model.py index e1c51a1f23e..adadd56af92 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/self_reference_model.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/self_reference_model.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt class SelfReferenceModel(BaseModel): @@ -28,7 +28,7 @@ class SelfReferenceModel(BaseModel): size: Optional[StrictInt] = None nested: Optional[DummyModel] = None additional_properties: Dict[str, Any] = {} - __properties = ["size", "nested"] + __properties: ClassVar[List[str]] = ["size", "nested"] model_config = { "populate_by_name": True, @@ -82,7 +82,7 @@ class SelfReferenceModel(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/special_model_name.py b/samples/openapi3/client/petstore/python/petstore_api/models/special_model_name.py index 0cc61ec6bc3..56163b1d16b 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/special_model_name.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/special_model_name.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt from pydantic import Field @@ -28,7 +28,7 @@ class SpecialModelName(BaseModel): """ special_property_name: Optional[StrictInt] = Field(default=None, alias="$special[property.name]") additional_properties: Dict[str, Any] = {} - __properties = ["$special[property.name]"] + __properties: ClassVar[List[str]] = ["$special[property.name]"] model_config = { "populate_by_name": True, @@ -78,7 +78,7 @@ class SpecialModelName(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/special_name.py b/samples/openapi3/client/petstore/python/petstore_api/models/special_name.py index d44d2f4fb80..0d1792c6853 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/special_name.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/special_name.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr, field_validator from pydantic import Field from petstore_api.models.category import Category @@ -31,7 +31,7 @@ class SpecialName(BaseModel): var_async: Optional[Category] = Field(default=None, alias="async") var_schema: Optional[StrictStr] = Field(default=None, description="pet status in the store", alias="schema") additional_properties: Dict[str, Any] = {} - __properties = ["property", "async", "schema"] + __properties: ClassVar[List[str]] = ["property", "async", "schema"] @field_validator('var_schema') def var_schema_validate_enum(cls, value): @@ -96,7 +96,7 @@ class SpecialName(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/tag.py b/samples/openapi3/client/petstore/python/petstore_api/models/tag.py index 37837197808..79513622168 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/tag.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/tag.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr class Tag(BaseModel): @@ -28,7 +28,7 @@ class Tag(BaseModel): id: Optional[StrictInt] = None name: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties = ["id", "name"] + __properties: ClassVar[List[str]] = ["id", "name"] model_config = { "populate_by_name": True, @@ -79,7 +79,7 @@ class Tag(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/test_inline_freeform_additional_properties_request.py b/samples/openapi3/client/petstore/python/petstore_api/models/test_inline_freeform_additional_properties_request.py index 1ced9efa5f8..79aec64aa15 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/test_inline_freeform_additional_properties_request.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/test_inline_freeform_additional_properties_request.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr from pydantic import Field @@ -28,7 +28,7 @@ class TestInlineFreeformAdditionalPropertiesRequest(BaseModel): """ some_property: Optional[StrictStr] = Field(default=None, alias="someProperty") additional_properties: Dict[str, Any] = {} - __properties = ["someProperty"] + __properties: ClassVar[List[str]] = ["someProperty"] model_config = { "populate_by_name": True, @@ -78,7 +78,7 @@ class TestInlineFreeformAdditionalPropertiesRequest(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/tiger.py b/samples/openapi3/client/petstore/python/petstore_api/models/tiger.py index 647ac852dd4..7b86ebb4099 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/tiger.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/tiger.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictStr class Tiger(BaseModel): @@ -27,7 +27,7 @@ class Tiger(BaseModel): """ skill: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties = ["skill"] + __properties: ClassVar[List[str]] = ["skill"] model_config = { "populate_by_name": True, @@ -77,7 +77,7 @@ class Tiger(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/user.py b/samples/openapi3/client/petstore/python/petstore_api/models/user.py index 08330324388..279dd287516 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/user.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/user.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt, StrictStr from pydantic import Field @@ -35,7 +35,7 @@ class User(BaseModel): phone: Optional[StrictStr] = None user_status: Optional[StrictInt] = Field(default=None, description="User Status", alias="userStatus") additional_properties: Dict[str, Any] = {} - __properties = ["id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus"] + __properties: ClassVar[List[str]] = ["id", "username", "firstName", "lastName", "email", "password", "phone", "userStatus"] model_config = { "populate_by_name": True, @@ -92,7 +92,7 @@ class User(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/with_nested_one_of.py b/samples/openapi3/client/petstore/python/petstore_api/models/with_nested_one_of.py index 3597922adb1..64c6ef08d9c 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/with_nested_one_of.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/with_nested_one_of.py @@ -18,7 +18,7 @@ import re # noqa: F401 import json -from typing import Any, Dict, Optional +from typing import Any, ClassVar, Dict, List, Optional from pydantic import BaseModel, StrictInt from petstore_api.models.one_of_enum_string import OneOfEnumString from petstore_api.models.pig import Pig @@ -31,7 +31,7 @@ class WithNestedOneOf(BaseModel): nested_pig: Optional[Pig] = None nested_oneof_enum_string: Optional[OneOfEnumString] = None additional_properties: Dict[str, Any] = {} - __properties = ["size", "nested_pig", "nested_oneof_enum_string"] + __properties: ClassVar[List[str]] = ["size", "nested_pig", "nested_oneof_enum_string"] model_config = { "populate_by_name": True, @@ -89,7 +89,7 @@ class WithNestedOneOf(BaseModel): }) # store additional fields in additional_properties for _key in obj.keys(): - if _key not in cls.__properties.default: + if _key not in cls.__properties: _obj.additional_properties[_key] = obj.get(_key) return _obj diff --git a/samples/openapi3/client/petstore/python/test/test_list.py b/samples/openapi3/client/petstore/python/test/test_list.py index 4c603a5e9b1..94806473a93 100644 --- a/samples/openapi3/client/petstore/python/test/test_list.py +++ b/samples/openapi3/client/petstore/python/test/test_list.py @@ -16,7 +16,7 @@ import unittest import datetime import petstore_api -from petstore_api.models.list import List # noqa: E501 +from petstore_api.models.list_class import ListClass # noqa: E501 from petstore_api.rest import ApiException class TestList(unittest.TestCase): @@ -35,11 +35,11 @@ class TestList(unittest.TestCase): optional params are included """ # model = petstore_api.models.list.List() # noqa: E501 if include_optional : - return List( + return ListClass( _123_list = '' ) else : - return List( + return ListClass( ) def testList(self): diff --git a/samples/openapi3/client/petstore/python/test/test_list_class.py b/samples/openapi3/client/petstore/python/test/test_list_class.py new file mode 100644 index 00000000000..ac14bf3b398 --- /dev/null +++ b/samples/openapi3/client/petstore/python/test/test_list_class.py @@ -0,0 +1,52 @@ +# coding: utf-8 + +""" + OpenAPI Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest +import datetime + +from petstore_api.models.list_class import ListClass # noqa: E501 + +class TestListClass(unittest.TestCase): + """ListClass unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> ListClass: + """Test ListClass + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `ListClass` + """ + model = ListClass() # noqa: E501 + if include_optional: + return ListClass( + var_123_list = '' + ) + else: + return ListClass( + ) + """ + + def testListClass(self): + """Test ListClass""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python/tests/test_model.py b/samples/openapi3/client/petstore/python/tests/test_model.py index 4ec36ff8d9f..49ac980c1be 100644 --- a/samples/openapi3/client/petstore/python/tests/test_model.py +++ b/samples/openapi3/client/petstore/python/tests/test_model.py @@ -334,7 +334,7 @@ class ModelTests(unittest.TestCase): # should throw exception as var_123_list should be string kw = {"123-list": 123} try: - l3 = petstore_api.List(**kw) + l3 = petstore_api.ListClass(**kw) self.assertTrue(False) # this line shouldn't execute breakpoint() except ValueError as e: @@ -344,13 +344,13 @@ class ModelTests(unittest.TestCase): self.assertTrue("Input should be a valid string" in str(e)) kw = {"123-list": "bulldog"} - l = petstore_api.List(**kw) + l = petstore_api.ListClass(**kw) self.assertEqual(l.to_json(), '{"123-list": "bulldog"}') self.assertEqual(l.to_dict(), {'123-list': 'bulldog'}) - l2 = petstore_api.List.from_json(l.to_json()) + l2 = petstore_api.ListClass.from_json(l.to_json()) self.assertEqual(l2.var_123_list, 'bulldog') - self.assertTrue(isinstance(l2, petstore_api.List)) + self.assertTrue(isinstance(l2, petstore_api.ListClass)) def test_enum_ref_property(self): # test enum ref property