From cca92ecf407e79a2db13f05e986984924d163465 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 4 Jun 2025 15:26:41 +0800 Subject: [PATCH 1/4] add tests for enum names with dot --- ...ith-fake-endpoints-models-for-testing.yaml | 14 ++- .../python-aiohttp/.openapi-generator/FILES | 4 + .../client/petstore/python-aiohttp/README.md | 2 + .../petstore/python-aiohttp/docs/PonySizes.md | 29 +++++ .../docs/TestModelWithEnumDefault.md | 2 +- .../petstore/python-aiohttp/docs/Type.md | 16 +++ .../python-aiohttp/petstore_api/__init__.py | 4 + .../petstore_api/models/__init__.py | 2 + .../petstore_api/models/pony_sizes.py | 88 +++++++++++++++ .../models/test_model_with_enum_default.py | 4 +- .../petstore_api/models/type.py | 39 +++++++ .../python-aiohttp/test/test_pony_sizes.py | 51 +++++++++ .../petstore/python-aiohttp/test/test_type.py | 33 ++++++ .../.openapi-generator/FILES | 4 + .../python-pydantic-v1-aiohttp/README.md | 2 + .../docs/PonySizes.md | 28 +++++ .../docs/TestModelWithEnumDefault.md | 2 +- .../python-pydantic-v1-aiohttp/docs/Type.md | 16 +++ .../petstore_api/__init__.py | 4 + .../petstore_api/models/__init__.py | 2 + .../petstore_api/models/pony_sizes.py | 72 +++++++++++++ .../models/test_model_with_enum_default.py | 4 +- .../petstore_api/models/type.py | 42 ++++++++ .../test/test_pony_sizes.py | 52 +++++++++ .../test/test_type.py | 34 ++++++ .../.openapi-generator/FILES | 4 + .../petstore/python-pydantic-v1/README.md | 2 + .../python-pydantic-v1/docs/PonySizes.md | 28 +++++ .../docs/TestModelWithEnumDefault.md | 2 +- .../petstore/python-pydantic-v1/docs/Type.md | 16 +++ .../petstore_api/__init__.py | 4 + .../petstore_api/models/__init__.py | 2 + .../petstore_api/models/pony_sizes.py | 84 +++++++++++++++ .../models/test_model_with_enum_default.py | 4 +- .../petstore_api/models/type.py | 42 ++++++++ .../test/test_pony_sizes.py | 52 +++++++++ .../python-pydantic-v1/test/test_type.py | 34 ++++++ .../petstore/python/.openapi-generator/FILES | 4 + .../openapi3/client/petstore/python/README.md | 2 + .../client/petstore/python/docs/PonySizes.md | 29 +++++ .../python/docs/TestModelWithEnumDefault.md | 2 +- .../client/petstore/python/docs/Type.md | 16 +++ .../petstore/python/petstore_api/__init__.py | 4 + .../python/petstore_api/models/__init__.py | 2 + .../python/petstore_api/models/pony_sizes.py | 101 ++++++++++++++++++ .../models/test_model_with_enum_default.py | 4 +- .../python/petstore_api/models/type.py | 39 +++++++ .../petstore/python/test/test_pony_sizes.py | 51 +++++++++ .../client/petstore/python/test/test_type.py | 33 ++++++ 49 files changed, 1098 insertions(+), 13 deletions(-) create mode 100644 samples/openapi3/client/petstore/python-aiohttp/docs/PonySizes.md create mode 100644 samples/openapi3/client/petstore/python-aiohttp/docs/Type.md create mode 100644 samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pony_sizes.py create mode 100644 samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/type.py create mode 100644 samples/openapi3/client/petstore/python-aiohttp/test/test_pony_sizes.py create mode 100644 samples/openapi3/client/petstore/python-aiohttp/test/test_type.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PonySizes.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Type.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pony_sizes.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/type.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pony_sizes.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_type.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/PonySizes.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/docs/Type.md create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/pony_sizes.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/type.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_pony_sizes.py create mode 100644 samples/openapi3/client/petstore/python-pydantic-v1/test/test_type.py create mode 100644 samples/openapi3/client/petstore/python/docs/PonySizes.md create mode 100644 samples/openapi3/client/petstore/python/docs/Type.md create mode 100644 samples/openapi3/client/petstore/python/petstore_api/models/pony_sizes.py create mode 100644 samples/openapi3/client/petstore/python/petstore_api/models/type.py create mode 100644 samples/openapi3/client/petstore/python/test/test_pony_sizes.py create mode 100644 samples/openapi3/client/petstore/python/test/test_type.py 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 91d4133352e3..48712fc412ed 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 @@ -2897,4 +2897,16 @@ components: - A - B - C - default: B + default: Bs + PonySizes: + type: object + properties: + type: + $ref: '#/components/schemas/Type' + Type: + type: float + enum: + - 2.0 + - 1.0 + - 0.5 + - 0.25 diff --git a/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES b/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES index e9cb10689de7..97c491419a4c 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python-aiohttp/.openapi-generator/FILES @@ -89,6 +89,7 @@ docs/ParentWithOptionalDict.md docs/Pet.md docs/PetApi.md docs/Pig.md +docs/PonySizes.md docs/PoopCleaning.md docs/PrimitiveString.md docs/PropertyMap.md @@ -113,6 +114,7 @@ docs/TestInlineFreeformAdditionalPropertiesRequest.md docs/TestModelWithEnumDefault.md docs/TestObjectForMultipartRequestsRequestMarker.md docs/Tiger.md +docs/Type.md docs/UnnamedDictWithAdditionalModelListProperties.md docs/UnnamedDictWithAdditionalStringListProperties.md docs/UploadFileWithAdditionalPropertiesRequestObject.md @@ -215,6 +217,7 @@ petstore_api/models/parent.py petstore_api/models/parent_with_optional_dict.py petstore_api/models/pet.py petstore_api/models/pig.py +petstore_api/models/pony_sizes.py petstore_api/models/poop_cleaning.py petstore_api/models/primitive_string.py petstore_api/models/property_map.py @@ -238,6 +241,7 @@ petstore_api/models/test_inline_freeform_additional_properties_request.py petstore_api/models/test_model_with_enum_default.py petstore_api/models/test_object_for_multipart_requests_request_marker.py petstore_api/models/tiger.py +petstore_api/models/type.py petstore_api/models/unnamed_dict_with_additional_model_list_properties.py petstore_api/models/unnamed_dict_with_additional_string_list_properties.py petstore_api/models/upload_file_with_additional_properties_request_object.py diff --git a/samples/openapi3/client/petstore/python-aiohttp/README.md b/samples/openapi3/client/petstore/python-aiohttp/README.md index 604b64886599..6a34463df569 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/README.md +++ b/samples/openapi3/client/petstore/python-aiohttp/README.md @@ -231,6 +231,7 @@ Class | Method | HTTP request | Description - [ParentWithOptionalDict](docs/ParentWithOptionalDict.md) - [Pet](docs/Pet.md) - [Pig](docs/Pig.md) + - [PonySizes](docs/PonySizes.md) - [PoopCleaning](docs/PoopCleaning.md) - [PrimitiveString](docs/PrimitiveString.md) - [PropertyMap](docs/PropertyMap.md) @@ -254,6 +255,7 @@ Class | Method | HTTP request | Description - [TestModelWithEnumDefault](docs/TestModelWithEnumDefault.md) - [TestObjectForMultipartRequestsRequestMarker](docs/TestObjectForMultipartRequestsRequestMarker.md) - [Tiger](docs/Tiger.md) + - [Type](docs/Type.md) - [UnnamedDictWithAdditionalModelListProperties](docs/UnnamedDictWithAdditionalModelListProperties.md) - [UnnamedDictWithAdditionalStringListProperties](docs/UnnamedDictWithAdditionalStringListProperties.md) - [UploadFileWithAdditionalPropertiesRequestObject](docs/UploadFileWithAdditionalPropertiesRequestObject.md) diff --git a/samples/openapi3/client/petstore/python-aiohttp/docs/PonySizes.md b/samples/openapi3/client/petstore/python-aiohttp/docs/PonySizes.md new file mode 100644 index 000000000000..ced44c872060 --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/PonySizes.md @@ -0,0 +1,29 @@ +# PonySizes + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**Type**](Type.md) | | [optional] + +## Example + +```python +from petstore_api.models.pony_sizes import PonySizes + +# TODO update the JSON string below +json = "{}" +# create an instance of PonySizes from a JSON string +pony_sizes_instance = PonySizes.from_json(json) +# print the JSON string representation of the object +print(PonySizes.to_json()) + +# convert the object into a dict +pony_sizes_dict = pony_sizes_instance.to_dict() +# create an instance of PonySizes from a dict +pony_sizes_from_dict = PonySizes.from_dict(pony_sizes_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/docs/TestModelWithEnumDefault.md b/samples/openapi3/client/petstore/python-aiohttp/docs/TestModelWithEnumDefault.md index 7d46e86deba4..986779f8c7b2 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/TestModelWithEnumDefault.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/TestModelWithEnumDefault.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **test_string** | **str** | | [optional] **test_enum_with_default** | [**TestEnumWithDefault**](TestEnumWithDefault.md) | | [optional] [default to TestEnumWithDefault.ZWEI] **test_string_with_default** | **str** | | [optional] [default to 'ahoy matey'] -**test_inline_defined_enum_with_default** | **str** | | [optional] [default to 'B'] +**test_inline_defined_enum_with_default** | **str** | | [optional] [default to Bs] ## Example diff --git a/samples/openapi3/client/petstore/python-aiohttp/docs/Type.md b/samples/openapi3/client/petstore/python-aiohttp/docs/Type.md new file mode 100644 index 000000000000..f7ff2903a728 --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/Type.md @@ -0,0 +1,16 @@ +# Type + + +## Enum + +* `NUMBER_2_DOT_0` (value: `2.0`) + +* `NUMBER_1_DOT_0` (value: `1.0`) + +* `NUMBER_0_DOT_5` (value: `0.5`) + +* `NUMBER_0_DOT_25` (value: `0.25`) + +[[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 50788f3e21c0..21f88b7adb35 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/__init__.py @@ -116,6 +116,7 @@ "ParentWithOptionalDict", "Pet", "Pig", + "PonySizes", "PoopCleaning", "PrimitiveString", "PropertyMap", @@ -139,6 +140,7 @@ "TestModelWithEnumDefault", "TestObjectForMultipartRequestsRequestMarker", "Tiger", + "Type", "UnnamedDictWithAdditionalModelListProperties", "UnnamedDictWithAdditionalStringListProperties", "UploadFileWithAdditionalPropertiesRequestObject", @@ -249,6 +251,7 @@ from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict as ParentWithOptionalDict from petstore_api.models.pet import Pet as Pet from petstore_api.models.pig import Pig as Pig +from petstore_api.models.pony_sizes import PonySizes as PonySizes from petstore_api.models.poop_cleaning import PoopCleaning as PoopCleaning from petstore_api.models.primitive_string import PrimitiveString as PrimitiveString from petstore_api.models.property_map import PropertyMap as PropertyMap @@ -272,6 +275,7 @@ from petstore_api.models.test_model_with_enum_default import TestModelWithEnumDefault as TestModelWithEnumDefault from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker as TestObjectForMultipartRequestsRequestMarker from petstore_api.models.tiger import Tiger as Tiger +from petstore_api.models.type import Type as Type from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties as UnnamedDictWithAdditionalModelListProperties from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties as UnnamedDictWithAdditionalStringListProperties from petstore_api.models.upload_file_with_additional_properties_request_object import UploadFileWithAdditionalPropertiesRequestObject as UploadFileWithAdditionalPropertiesRequestObject 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 fc1f4acbdaf6..c9dd877ed2a7 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 @@ -94,6 +94,7 @@ from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict from petstore_api.models.pet import Pet from petstore_api.models.pig import Pig +from petstore_api.models.pony_sizes import PonySizes from petstore_api.models.poop_cleaning import PoopCleaning from petstore_api.models.primitive_string import PrimitiveString from petstore_api.models.property_map import PropertyMap @@ -117,6 +118,7 @@ from petstore_api.models.test_model_with_enum_default import TestModelWithEnumDefault from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker from petstore_api.models.tiger import Tiger +from petstore_api.models.type import Type from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties from petstore_api.models.upload_file_with_additional_properties_request_object import UploadFileWithAdditionalPropertiesRequestObject diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pony_sizes.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pony_sizes.py new file mode 100644 index 000000000000..00bd38659577 --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pony_sizes.py @@ -0,0 +1,88 @@ +# 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 pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from petstore_api.models.type import Type +from typing import Optional, Set +from typing_extensions import Self + +class PonySizes(BaseModel): + """ + PonySizes + """ # noqa: E501 + type: Optional[Type] = None + __properties: ClassVar[List[str]] = ["type"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + 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) -> Optional[Self]: + """Create an instance of PonySizes from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PonySizes from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_model_with_enum_default.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_model_with_enum_default.py index 218fa8f16d22..b41747151ff3 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_model_with_enum_default.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_model_with_enum_default.py @@ -32,7 +32,7 @@ class TestModelWithEnumDefault(BaseModel): test_string: Optional[StrictStr] = None test_enum_with_default: Optional[TestEnumWithDefault] = TestEnumWithDefault.ZWEI test_string_with_default: Optional[StrictStr] = 'ahoy matey' - test_inline_defined_enum_with_default: Optional[StrictStr] = 'B' + test_inline_defined_enum_with_default: Optional[StrictStr] = Bs __properties: ClassVar[List[str]] = ["test_enum", "test_string", "test_enum_with_default", "test_string_with_default", "test_inline_defined_enum_with_default"] @field_validator('test_inline_defined_enum_with_default') @@ -100,7 +100,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "test_string": obj.get("test_string"), "test_enum_with_default": obj.get("test_enum_with_default") if obj.get("test_enum_with_default") is not None else TestEnumWithDefault.ZWEI, "test_string_with_default": obj.get("test_string_with_default") if obj.get("test_string_with_default") is not None else 'ahoy matey', - "test_inline_defined_enum_with_default": obj.get("test_inline_defined_enum_with_default") if obj.get("test_inline_defined_enum_with_default") is not None else 'B' + "test_inline_defined_enum_with_default": obj.get("test_inline_defined_enum_with_default") if obj.get("test_inline_defined_enum_with_default") is not None else Bs }) return _obj diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/type.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/type.py new file mode 100644 index 000000000000..35a847de894f --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/type.py @@ -0,0 +1,39 @@ +# 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 json +from enum import Enum +from typing_extensions import Self + + +class Type(int, Enum): + """ + Type + """ + + """ + allowed enum values + """ + NUMBER_2_DOT_0 = 2.0 + NUMBER_1_DOT_0 = 1.0 + NUMBER_0_DOT_5 = 0.5 + NUMBER_0_DOT_25 = 0.25 + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of Type from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-aiohttp/test/test_pony_sizes.py b/samples/openapi3/client/petstore/python-aiohttp/test/test_pony_sizes.py new file mode 100644 index 000000000000..8586169f7986 --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/test/test_pony_sizes.py @@ -0,0 +1,51 @@ +# 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 + +from petstore_api.models.pony_sizes import PonySizes + +class TestPonySizes(unittest.TestCase): + """PonySizes unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PonySizes: + """Test PonySizes + include_optional 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 `PonySizes` + """ + model = PonySizes() + if include_optional: + return PonySizes( + type = 2.0 + ) + else: + return PonySizes( + ) + """ + + def testPonySizes(self): + """Test PonySizes""" + # 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-aiohttp/test/test_type.py b/samples/openapi3/client/petstore/python-aiohttp/test/test_type.py new file mode 100644 index 000000000000..ecafff8199db --- /dev/null +++ b/samples/openapi3/client/petstore/python-aiohttp/test/test_type.py @@ -0,0 +1,33 @@ +# 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 + +from petstore_api.models.type import Type + +class TestType(unittest.TestCase): + """Type unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testType(self): + """Test Type""" + # inst = Type() + +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 2e28d350da1a..8fcd0acf7a1d 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 @@ -89,6 +89,7 @@ docs/ParentWithOptionalDict.md docs/Pet.md docs/PetApi.md docs/Pig.md +docs/PonySizes.md docs/PoopCleaning.md docs/PrimitiveString.md docs/PropertyMap.md @@ -113,6 +114,7 @@ docs/TestInlineFreeformAdditionalPropertiesRequest.md docs/TestModelWithEnumDefault.md docs/TestObjectForMultipartRequestsRequestMarker.md docs/Tiger.md +docs/Type.md docs/UnnamedDictWithAdditionalModelListProperties.md docs/UnnamedDictWithAdditionalStringListProperties.md docs/UploadFileWithAdditionalPropertiesRequestObject.md @@ -215,6 +217,7 @@ petstore_api/models/parent.py petstore_api/models/parent_with_optional_dict.py petstore_api/models/pet.py petstore_api/models/pig.py +petstore_api/models/pony_sizes.py petstore_api/models/poop_cleaning.py petstore_api/models/primitive_string.py petstore_api/models/property_map.py @@ -238,6 +241,7 @@ petstore_api/models/test_inline_freeform_additional_properties_request.py petstore_api/models/test_model_with_enum_default.py petstore_api/models/test_object_for_multipart_requests_request_marker.py petstore_api/models/tiger.py +petstore_api/models/type.py petstore_api/models/unnamed_dict_with_additional_model_list_properties.py petstore_api/models/unnamed_dict_with_additional_string_list_properties.py petstore_api/models/upload_file_with_additional_properties_request_object.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 61ef8074074e..350d0ca3afc7 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/README.md @@ -232,6 +232,7 @@ Class | Method | HTTP request | Description - [ParentWithOptionalDict](docs/ParentWithOptionalDict.md) - [Pet](docs/Pet.md) - [Pig](docs/Pig.md) + - [PonySizes](docs/PonySizes.md) - [PoopCleaning](docs/PoopCleaning.md) - [PrimitiveString](docs/PrimitiveString.md) - [PropertyMap](docs/PropertyMap.md) @@ -255,6 +256,7 @@ Class | Method | HTTP request | Description - [TestModelWithEnumDefault](docs/TestModelWithEnumDefault.md) - [TestObjectForMultipartRequestsRequestMarker](docs/TestObjectForMultipartRequestsRequestMarker.md) - [Tiger](docs/Tiger.md) + - [Type](docs/Type.md) - [UnnamedDictWithAdditionalModelListProperties](docs/UnnamedDictWithAdditionalModelListProperties.md) - [UnnamedDictWithAdditionalStringListProperties](docs/UnnamedDictWithAdditionalStringListProperties.md) - [UploadFileWithAdditionalPropertiesRequestObject](docs/UploadFileWithAdditionalPropertiesRequestObject.md) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PonySizes.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PonySizes.md new file mode 100644 index 000000000000..6abdccaf3a74 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/PonySizes.md @@ -0,0 +1,28 @@ +# PonySizes + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**Type**](Type.md) | | [optional] + +## Example + +```python +from petstore_api.models.pony_sizes import PonySizes + +# TODO update the JSON string below +json = "{}" +# create an instance of PonySizes from a JSON string +pony_sizes_instance = PonySizes.from_json(json) +# print the JSON string representation of the object +print PonySizes.to_json() + +# convert the object into a dict +pony_sizes_dict = pony_sizes_instance.to_dict() +# create an instance of PonySizes from a dict +pony_sizes_from_dict = PonySizes.from_dict(pony_sizes_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/docs/TestModelWithEnumDefault.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestModelWithEnumDefault.md index 7adae701beb2..90b0d84b8fdb 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestModelWithEnumDefault.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestModelWithEnumDefault.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **test_string** | **str** | | [optional] **test_enum_with_default** | [**TestEnumWithDefault**](TestEnumWithDefault.md) | | [optional] **test_string_with_default** | **str** | | [optional] [default to 'ahoy matey'] -**test_inline_defined_enum_with_default** | **str** | | [optional] [default to 'B'] +**test_inline_defined_enum_with_default** | **str** | | [optional] [default to 'Bs'] ## Example diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Type.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Type.md new file mode 100644 index 000000000000..19ca807d66c2 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Type.md @@ -0,0 +1,16 @@ +# Type + + +## Enum + +* `NUMBER_2.0` (value: `2.0`) + +* `NUMBER_1.0` (value: `1.0`) + +* `NUMBER_0.5` (value: `0.5`) + +* `NUMBER_0.25` (value: `0.25`) + +[[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 450799b5e559..343757e2f372 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 @@ -116,6 +116,7 @@ "ParentWithOptionalDict", "Pet", "Pig", + "PonySizes", "PoopCleaning", "PrimitiveString", "PropertyMap", @@ -139,6 +140,7 @@ "TestModelWithEnumDefault", "TestObjectForMultipartRequestsRequestMarker", "Tiger", + "Type", "UnnamedDictWithAdditionalModelListProperties", "UnnamedDictWithAdditionalStringListProperties", "UploadFileWithAdditionalPropertiesRequestObject", @@ -249,6 +251,7 @@ from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict as ParentWithOptionalDict from petstore_api.models.pet import Pet as Pet from petstore_api.models.pig import Pig as Pig +from petstore_api.models.pony_sizes import PonySizes as PonySizes from petstore_api.models.poop_cleaning import PoopCleaning as PoopCleaning from petstore_api.models.primitive_string import PrimitiveString as PrimitiveString from petstore_api.models.property_map import PropertyMap as PropertyMap @@ -272,6 +275,7 @@ from petstore_api.models.test_model_with_enum_default import TestModelWithEnumDefault as TestModelWithEnumDefault from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker as TestObjectForMultipartRequestsRequestMarker from petstore_api.models.tiger import Tiger as Tiger +from petstore_api.models.type import Type as Type from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties as UnnamedDictWithAdditionalModelListProperties from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties as UnnamedDictWithAdditionalStringListProperties from petstore_api.models.upload_file_with_additional_properties_request_object import UploadFileWithAdditionalPropertiesRequestObject as UploadFileWithAdditionalPropertiesRequestObject 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 91f0aad8026f..8244d7625958 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 @@ -94,6 +94,7 @@ from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict from petstore_api.models.pet import Pet from petstore_api.models.pig import Pig +from petstore_api.models.pony_sizes import PonySizes from petstore_api.models.poop_cleaning import PoopCleaning from petstore_api.models.primitive_string import PrimitiveString from petstore_api.models.property_map import PropertyMap @@ -117,6 +118,7 @@ from petstore_api.models.test_model_with_enum_default import TestModelWithEnumDefault from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker from petstore_api.models.tiger import Tiger +from petstore_api.models.type import Type from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties from petstore_api.models.upload_file_with_additional_properties_request_object import UploadFileWithAdditionalPropertiesRequestObject diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pony_sizes.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pony_sizes.py new file mode 100644 index 000000000000..d7c0716b43db --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/pony_sizes.py @@ -0,0 +1,72 @@ +# 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 +from petstore_api.models.type import Type + +class PonySizes(BaseModel): + """ + PonySizes + """ + type: Optional[Type] = None + __properties = ["type"] + + 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) -> PonySizes: + """Create an instance of PonySizes 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) -> PonySizes: + """Create an instance of PonySizes from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PonySizes.parse_obj(obj) + + _obj = PonySizes.parse_obj({ + "type": obj.get("type") + }) + return _obj + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_model_with_enum_default.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_model_with_enum_default.py index 861926379409..629360b3ddb8 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_model_with_enum_default.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_model_with_enum_default.py @@ -31,7 +31,7 @@ class TestModelWithEnumDefault(BaseModel): test_string: Optional[StrictStr] = None test_enum_with_default: Optional[TestEnumWithDefault] = None test_string_with_default: Optional[StrictStr] = 'ahoy matey' - test_inline_defined_enum_with_default: Optional[StrictStr] = 'B' + test_inline_defined_enum_with_default: Optional[StrictStr] = 'Bs' __properties = ["test_enum", "test_string", "test_enum_with_default", "test_string_with_default", "test_inline_defined_enum_with_default"] @validator('test_inline_defined_enum_with_default') @@ -84,7 +84,7 @@ def from_dict(cls, obj: dict) -> TestModelWithEnumDefault: "test_string": obj.get("test_string"), "test_enum_with_default": obj.get("test_enum_with_default"), "test_string_with_default": obj.get("test_string_with_default") if obj.get("test_string_with_default") is not None else 'ahoy matey', - "test_inline_defined_enum_with_default": obj.get("test_inline_defined_enum_with_default") if obj.get("test_inline_defined_enum_with_default") is not None else 'B' + "test_inline_defined_enum_with_default": obj.get("test_inline_defined_enum_with_default") if obj.get("test_inline_defined_enum_with_default") is not None else 'Bs' }) return _obj diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/type.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/type.py new file mode 100644 index 000000000000..855822717b22 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/type.py @@ -0,0 +1,42 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class Type(int, Enum): + """ + Type + """ + + """ + allowed enum values + """ + NUMBER_2.0 = 2.0 + NUMBER_1.0 = 1.0 + NUMBER_0.5 = 0.5 + NUMBER_0.25 = 0.25 + + @classmethod + def from_json(cls, json_str: str) -> Type: + """Create an instance of Type from a JSON string""" + return Type(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pony_sizes.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pony_sizes.py new file mode 100644 index 000000000000..69af8a41f58f --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_pony_sizes.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.pony_sizes import PonySizes # noqa: E501 + +class TestPonySizes(unittest.TestCase): + """PonySizes unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PonySizes: + """Test PonySizes + 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 `PonySizes` + """ + model = PonySizes() # noqa: E501 + if include_optional: + return PonySizes( + type = 2.0 + ) + else: + return PonySizes( + ) + """ + + def testPonySizes(self): + """Test PonySizes""" + # 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/test/test_type.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_type.py new file mode 100644 index 000000000000..9738be707f26 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/test/test_type.py @@ -0,0 +1,34 @@ +# 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.type import Type # noqa: E501 + +class TestType(unittest.TestCase): + """Type unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testType(self): + """Test Type""" + # inst = Type() + +if __name__ == '__main__': + unittest.main() 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 2e28d350da1a..8fcd0acf7a1d 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python-pydantic-v1/.openapi-generator/FILES @@ -89,6 +89,7 @@ docs/ParentWithOptionalDict.md docs/Pet.md docs/PetApi.md docs/Pig.md +docs/PonySizes.md docs/PoopCleaning.md docs/PrimitiveString.md docs/PropertyMap.md @@ -113,6 +114,7 @@ docs/TestInlineFreeformAdditionalPropertiesRequest.md docs/TestModelWithEnumDefault.md docs/TestObjectForMultipartRequestsRequestMarker.md docs/Tiger.md +docs/Type.md docs/UnnamedDictWithAdditionalModelListProperties.md docs/UnnamedDictWithAdditionalStringListProperties.md docs/UploadFileWithAdditionalPropertiesRequestObject.md @@ -215,6 +217,7 @@ petstore_api/models/parent.py petstore_api/models/parent_with_optional_dict.py petstore_api/models/pet.py petstore_api/models/pig.py +petstore_api/models/pony_sizes.py petstore_api/models/poop_cleaning.py petstore_api/models/primitive_string.py petstore_api/models/property_map.py @@ -238,6 +241,7 @@ petstore_api/models/test_inline_freeform_additional_properties_request.py petstore_api/models/test_model_with_enum_default.py petstore_api/models/test_object_for_multipart_requests_request_marker.py petstore_api/models/tiger.py +petstore_api/models/type.py petstore_api/models/unnamed_dict_with_additional_model_list_properties.py petstore_api/models/unnamed_dict_with_additional_string_list_properties.py petstore_api/models/upload_file_with_additional_properties_request_object.py diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/README.md b/samples/openapi3/client/petstore/python-pydantic-v1/README.md index 90e3cd59ee68..8f4277c9986b 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/README.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1/README.md @@ -232,6 +232,7 @@ Class | Method | HTTP request | Description - [ParentWithOptionalDict](docs/ParentWithOptionalDict.md) - [Pet](docs/Pet.md) - [Pig](docs/Pig.md) + - [PonySizes](docs/PonySizes.md) - [PoopCleaning](docs/PoopCleaning.md) - [PrimitiveString](docs/PrimitiveString.md) - [PropertyMap](docs/PropertyMap.md) @@ -255,6 +256,7 @@ Class | Method | HTTP request | Description - [TestModelWithEnumDefault](docs/TestModelWithEnumDefault.md) - [TestObjectForMultipartRequestsRequestMarker](docs/TestObjectForMultipartRequestsRequestMarker.md) - [Tiger](docs/Tiger.md) + - [Type](docs/Type.md) - [UnnamedDictWithAdditionalModelListProperties](docs/UnnamedDictWithAdditionalModelListProperties.md) - [UnnamedDictWithAdditionalStringListProperties](docs/UnnamedDictWithAdditionalStringListProperties.md) - [UploadFileWithAdditionalPropertiesRequestObject](docs/UploadFileWithAdditionalPropertiesRequestObject.md) diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/PonySizes.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/PonySizes.md new file mode 100644 index 000000000000..6abdccaf3a74 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/PonySizes.md @@ -0,0 +1,28 @@ +# PonySizes + + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**Type**](Type.md) | | [optional] + +## Example + +```python +from petstore_api.models.pony_sizes import PonySizes + +# TODO update the JSON string below +json = "{}" +# create an instance of PonySizes from a JSON string +pony_sizes_instance = PonySizes.from_json(json) +# print the JSON string representation of the object +print PonySizes.to_json() + +# convert the object into a dict +pony_sizes_dict = pony_sizes_instance.to_dict() +# create an instance of PonySizes from a dict +pony_sizes_from_dict = PonySizes.from_dict(pony_sizes_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/docs/TestModelWithEnumDefault.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/TestModelWithEnumDefault.md index 7adae701beb2..90b0d84b8fdb 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/docs/TestModelWithEnumDefault.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/TestModelWithEnumDefault.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **test_string** | **str** | | [optional] **test_enum_with_default** | [**TestEnumWithDefault**](TestEnumWithDefault.md) | | [optional] **test_string_with_default** | **str** | | [optional] [default to 'ahoy matey'] -**test_inline_defined_enum_with_default** | **str** | | [optional] [default to 'B'] +**test_inline_defined_enum_with_default** | **str** | | [optional] [default to 'Bs'] ## Example diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Type.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Type.md new file mode 100644 index 000000000000..19ca807d66c2 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Type.md @@ -0,0 +1,16 @@ +# Type + + +## Enum + +* `NUMBER_2.0` (value: `2.0`) + +* `NUMBER_1.0` (value: `1.0`) + +* `NUMBER_0.5` (value: `0.5`) + +* `NUMBER_0.25` (value: `0.25`) + +[[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 450799b5e559..343757e2f372 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 @@ -116,6 +116,7 @@ "ParentWithOptionalDict", "Pet", "Pig", + "PonySizes", "PoopCleaning", "PrimitiveString", "PropertyMap", @@ -139,6 +140,7 @@ "TestModelWithEnumDefault", "TestObjectForMultipartRequestsRequestMarker", "Tiger", + "Type", "UnnamedDictWithAdditionalModelListProperties", "UnnamedDictWithAdditionalStringListProperties", "UploadFileWithAdditionalPropertiesRequestObject", @@ -249,6 +251,7 @@ from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict as ParentWithOptionalDict from petstore_api.models.pet import Pet as Pet from petstore_api.models.pig import Pig as Pig +from petstore_api.models.pony_sizes import PonySizes as PonySizes from petstore_api.models.poop_cleaning import PoopCleaning as PoopCleaning from petstore_api.models.primitive_string import PrimitiveString as PrimitiveString from petstore_api.models.property_map import PropertyMap as PropertyMap @@ -272,6 +275,7 @@ from petstore_api.models.test_model_with_enum_default import TestModelWithEnumDefault as TestModelWithEnumDefault from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker as TestObjectForMultipartRequestsRequestMarker from petstore_api.models.tiger import Tiger as Tiger +from petstore_api.models.type import Type as Type from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties as UnnamedDictWithAdditionalModelListProperties from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties as UnnamedDictWithAdditionalStringListProperties from petstore_api.models.upload_file_with_additional_properties_request_object import UploadFileWithAdditionalPropertiesRequestObject as UploadFileWithAdditionalPropertiesRequestObject 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 91f0aad8026f..8244d7625958 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 @@ -94,6 +94,7 @@ from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict from petstore_api.models.pet import Pet from petstore_api.models.pig import Pig +from petstore_api.models.pony_sizes import PonySizes from petstore_api.models.poop_cleaning import PoopCleaning from petstore_api.models.primitive_string import PrimitiveString from petstore_api.models.property_map import PropertyMap @@ -117,6 +118,7 @@ from petstore_api.models.test_model_with_enum_default import TestModelWithEnumDefault from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker from petstore_api.models.tiger import Tiger +from petstore_api.models.type import Type from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties from petstore_api.models.upload_file_with_additional_properties_request_object import UploadFileWithAdditionalPropertiesRequestObject diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/pony_sizes.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/pony_sizes.py new file mode 100644 index 000000000000..2d04b866cb17 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/pony_sizes.py @@ -0,0 +1,84 @@ +# 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 +from petstore_api.models.type import Type + +class PonySizes(BaseModel): + """ + PonySizes + """ + type: Optional[Type] = None + additional_properties: Dict[str, Any] = {} + __properties = ["type"] + + 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) -> PonySizes: + """Create an instance of PonySizes 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) -> PonySizes: + """Create an instance of PonySizes from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PonySizes.parse_obj(obj) + + _obj = PonySizes.parse_obj({ + "type": obj.get("type") + }) + # 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/petstore_api/models/test_model_with_enum_default.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/test_model_with_enum_default.py index 3775fd5e29c2..b0801ae66ec8 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/test_model_with_enum_default.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/test_model_with_enum_default.py @@ -31,7 +31,7 @@ class TestModelWithEnumDefault(BaseModel): test_string: Optional[StrictStr] = None test_enum_with_default: Optional[TestEnumWithDefault] = None test_string_with_default: Optional[StrictStr] = 'ahoy matey' - test_inline_defined_enum_with_default: Optional[StrictStr] = 'B' + test_inline_defined_enum_with_default: Optional[StrictStr] = 'Bs' additional_properties: Dict[str, Any] = {} __properties = ["test_enum", "test_string", "test_enum_with_default", "test_string_with_default", "test_inline_defined_enum_with_default"] @@ -91,7 +91,7 @@ def from_dict(cls, obj: dict) -> TestModelWithEnumDefault: "test_string": obj.get("test_string"), "test_enum_with_default": obj.get("test_enum_with_default"), "test_string_with_default": obj.get("test_string_with_default") if obj.get("test_string_with_default") is not None else 'ahoy matey', - "test_inline_defined_enum_with_default": obj.get("test_inline_defined_enum_with_default") if obj.get("test_inline_defined_enum_with_default") is not None else 'B' + "test_inline_defined_enum_with_default": obj.get("test_inline_defined_enum_with_default") if obj.get("test_inline_defined_enum_with_default") is not None else 'Bs' }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/type.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/type.py new file mode 100644 index 000000000000..855822717b22 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/type.py @@ -0,0 +1,42 @@ +# 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 json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class Type(int, Enum): + """ + Type + """ + + """ + allowed enum values + """ + NUMBER_2.0 = 2.0 + NUMBER_1.0 = 1.0 + NUMBER_0.5 = 0.5 + NUMBER_0.25 = 0.25 + + @classmethod + def from_json(cls, json_str: str) -> Type: + """Create an instance of Type from a JSON string""" + return Type(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pony_sizes.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pony_sizes.py new file mode 100644 index 000000000000..69af8a41f58f --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_pony_sizes.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.pony_sizes import PonySizes # noqa: E501 + +class TestPonySizes(unittest.TestCase): + """PonySizes unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PonySizes: + """Test PonySizes + 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 `PonySizes` + """ + model = PonySizes() # noqa: E501 + if include_optional: + return PonySizes( + type = 2.0 + ) + else: + return PonySizes( + ) + """ + + def testPonySizes(self): + """Test PonySizes""" + # 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/test/test_type.py b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_type.py new file mode 100644 index 000000000000..9738be707f26 --- /dev/null +++ b/samples/openapi3/client/petstore/python-pydantic-v1/test/test_type.py @@ -0,0 +1,34 @@ +# 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.type import Type # noqa: E501 + +class TestType(unittest.TestCase): + """Type unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testType(self): + """Test Type""" + # inst = Type() + +if __name__ == '__main__': + unittest.main() diff --git a/samples/openapi3/client/petstore/python/.openapi-generator/FILES b/samples/openapi3/client/petstore/python/.openapi-generator/FILES index e9cb10689de7..97c491419a4c 100755 --- a/samples/openapi3/client/petstore/python/.openapi-generator/FILES +++ b/samples/openapi3/client/petstore/python/.openapi-generator/FILES @@ -89,6 +89,7 @@ docs/ParentWithOptionalDict.md docs/Pet.md docs/PetApi.md docs/Pig.md +docs/PonySizes.md docs/PoopCleaning.md docs/PrimitiveString.md docs/PropertyMap.md @@ -113,6 +114,7 @@ docs/TestInlineFreeformAdditionalPropertiesRequest.md docs/TestModelWithEnumDefault.md docs/TestObjectForMultipartRequestsRequestMarker.md docs/Tiger.md +docs/Type.md docs/UnnamedDictWithAdditionalModelListProperties.md docs/UnnamedDictWithAdditionalStringListProperties.md docs/UploadFileWithAdditionalPropertiesRequestObject.md @@ -215,6 +217,7 @@ petstore_api/models/parent.py petstore_api/models/parent_with_optional_dict.py petstore_api/models/pet.py petstore_api/models/pig.py +petstore_api/models/pony_sizes.py petstore_api/models/poop_cleaning.py petstore_api/models/primitive_string.py petstore_api/models/property_map.py @@ -238,6 +241,7 @@ petstore_api/models/test_inline_freeform_additional_properties_request.py petstore_api/models/test_model_with_enum_default.py petstore_api/models/test_object_for_multipart_requests_request_marker.py petstore_api/models/tiger.py +petstore_api/models/type.py petstore_api/models/unnamed_dict_with_additional_model_list_properties.py petstore_api/models/unnamed_dict_with_additional_string_list_properties.py petstore_api/models/upload_file_with_additional_properties_request_object.py diff --git a/samples/openapi3/client/petstore/python/README.md b/samples/openapi3/client/petstore/python/README.md index ccfeba8f72e8..da1b17db8613 100755 --- a/samples/openapi3/client/petstore/python/README.md +++ b/samples/openapi3/client/petstore/python/README.md @@ -231,6 +231,7 @@ Class | Method | HTTP request | Description - [ParentWithOptionalDict](docs/ParentWithOptionalDict.md) - [Pet](docs/Pet.md) - [Pig](docs/Pig.md) + - [PonySizes](docs/PonySizes.md) - [PoopCleaning](docs/PoopCleaning.md) - [PrimitiveString](docs/PrimitiveString.md) - [PropertyMap](docs/PropertyMap.md) @@ -254,6 +255,7 @@ Class | Method | HTTP request | Description - [TestModelWithEnumDefault](docs/TestModelWithEnumDefault.md) - [TestObjectForMultipartRequestsRequestMarker](docs/TestObjectForMultipartRequestsRequestMarker.md) - [Tiger](docs/Tiger.md) + - [Type](docs/Type.md) - [UnnamedDictWithAdditionalModelListProperties](docs/UnnamedDictWithAdditionalModelListProperties.md) - [UnnamedDictWithAdditionalStringListProperties](docs/UnnamedDictWithAdditionalStringListProperties.md) - [UploadFileWithAdditionalPropertiesRequestObject](docs/UploadFileWithAdditionalPropertiesRequestObject.md) diff --git a/samples/openapi3/client/petstore/python/docs/PonySizes.md b/samples/openapi3/client/petstore/python/docs/PonySizes.md new file mode 100644 index 000000000000..ced44c872060 --- /dev/null +++ b/samples/openapi3/client/petstore/python/docs/PonySizes.md @@ -0,0 +1,29 @@ +# PonySizes + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | [**Type**](Type.md) | | [optional] + +## Example + +```python +from petstore_api.models.pony_sizes import PonySizes + +# TODO update the JSON string below +json = "{}" +# create an instance of PonySizes from a JSON string +pony_sizes_instance = PonySizes.from_json(json) +# print the JSON string representation of the object +print(PonySizes.to_json()) + +# convert the object into a dict +pony_sizes_dict = pony_sizes_instance.to_dict() +# create an instance of PonySizes from a dict +pony_sizes_from_dict = PonySizes.from_dict(pony_sizes_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/docs/TestModelWithEnumDefault.md b/samples/openapi3/client/petstore/python/docs/TestModelWithEnumDefault.md index 7d46e86deba4..986779f8c7b2 100644 --- a/samples/openapi3/client/petstore/python/docs/TestModelWithEnumDefault.md +++ b/samples/openapi3/client/petstore/python/docs/TestModelWithEnumDefault.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **test_string** | **str** | | [optional] **test_enum_with_default** | [**TestEnumWithDefault**](TestEnumWithDefault.md) | | [optional] [default to TestEnumWithDefault.ZWEI] **test_string_with_default** | **str** | | [optional] [default to 'ahoy matey'] -**test_inline_defined_enum_with_default** | **str** | | [optional] [default to 'B'] +**test_inline_defined_enum_with_default** | **str** | | [optional] [default to Bs] ## Example diff --git a/samples/openapi3/client/petstore/python/docs/Type.md b/samples/openapi3/client/petstore/python/docs/Type.md new file mode 100644 index 000000000000..f7ff2903a728 --- /dev/null +++ b/samples/openapi3/client/petstore/python/docs/Type.md @@ -0,0 +1,16 @@ +# Type + + +## Enum + +* `NUMBER_2_DOT_0` (value: `2.0`) + +* `NUMBER_1_DOT_0` (value: `1.0`) + +* `NUMBER_0_DOT_5` (value: `0.5`) + +* `NUMBER_0_DOT_25` (value: `0.25`) + +[[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 50788f3e21c0..21f88b7adb35 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/__init__.py +++ b/samples/openapi3/client/petstore/python/petstore_api/__init__.py @@ -116,6 +116,7 @@ "ParentWithOptionalDict", "Pet", "Pig", + "PonySizes", "PoopCleaning", "PrimitiveString", "PropertyMap", @@ -139,6 +140,7 @@ "TestModelWithEnumDefault", "TestObjectForMultipartRequestsRequestMarker", "Tiger", + "Type", "UnnamedDictWithAdditionalModelListProperties", "UnnamedDictWithAdditionalStringListProperties", "UploadFileWithAdditionalPropertiesRequestObject", @@ -249,6 +251,7 @@ from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict as ParentWithOptionalDict from petstore_api.models.pet import Pet as Pet from petstore_api.models.pig import Pig as Pig +from petstore_api.models.pony_sizes import PonySizes as PonySizes from petstore_api.models.poop_cleaning import PoopCleaning as PoopCleaning from petstore_api.models.primitive_string import PrimitiveString as PrimitiveString from petstore_api.models.property_map import PropertyMap as PropertyMap @@ -272,6 +275,7 @@ from petstore_api.models.test_model_with_enum_default import TestModelWithEnumDefault as TestModelWithEnumDefault from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker as TestObjectForMultipartRequestsRequestMarker from petstore_api.models.tiger import Tiger as Tiger +from petstore_api.models.type import Type as Type from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties as UnnamedDictWithAdditionalModelListProperties from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties as UnnamedDictWithAdditionalStringListProperties from petstore_api.models.upload_file_with_additional_properties_request_object import UploadFileWithAdditionalPropertiesRequestObject as UploadFileWithAdditionalPropertiesRequestObject 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 fc1f4acbdaf6..c9dd877ed2a7 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/__init__.py @@ -94,6 +94,7 @@ from petstore_api.models.parent_with_optional_dict import ParentWithOptionalDict from petstore_api.models.pet import Pet from petstore_api.models.pig import Pig +from petstore_api.models.pony_sizes import PonySizes from petstore_api.models.poop_cleaning import PoopCleaning from petstore_api.models.primitive_string import PrimitiveString from petstore_api.models.property_map import PropertyMap @@ -117,6 +118,7 @@ from petstore_api.models.test_model_with_enum_default import TestModelWithEnumDefault from petstore_api.models.test_object_for_multipart_requests_request_marker import TestObjectForMultipartRequestsRequestMarker from petstore_api.models.tiger import Tiger +from petstore_api.models.type import Type from petstore_api.models.unnamed_dict_with_additional_model_list_properties import UnnamedDictWithAdditionalModelListProperties from petstore_api.models.unnamed_dict_with_additional_string_list_properties import UnnamedDictWithAdditionalStringListProperties from petstore_api.models.upload_file_with_additional_properties_request_object import UploadFileWithAdditionalPropertiesRequestObject diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/pony_sizes.py b/samples/openapi3/client/petstore/python/petstore_api/models/pony_sizes.py new file mode 100644 index 000000000000..74efce9a4d06 --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/models/pony_sizes.py @@ -0,0 +1,101 @@ +# 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 pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List, Optional +from petstore_api.models.type import Type +from typing import Optional, Set +from typing_extensions import Self + +class PonySizes(BaseModel): + """ + PonySizes + """ # noqa: E501 + type: Optional[Type] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["type"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + 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) -> Optional[Self]: + """Create an instance of PonySizes from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + 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: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PonySizes from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type") + }) + # 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/test_model_with_enum_default.py b/samples/openapi3/client/petstore/python/petstore_api/models/test_model_with_enum_default.py index 4bff5e699a37..3af0b9ad1145 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/test_model_with_enum_default.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/test_model_with_enum_default.py @@ -32,7 +32,7 @@ class TestModelWithEnumDefault(BaseModel): test_string: Optional[StrictStr] = None test_enum_with_default: Optional[TestEnumWithDefault] = TestEnumWithDefault.ZWEI test_string_with_default: Optional[StrictStr] = 'ahoy matey' - test_inline_defined_enum_with_default: Optional[StrictStr] = 'B' + test_inline_defined_enum_with_default: Optional[StrictStr] = Bs additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["test_enum", "test_string", "test_enum_with_default", "test_string_with_default", "test_inline_defined_enum_with_default"] @@ -108,7 +108,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "test_string": obj.get("test_string"), "test_enum_with_default": obj.get("test_enum_with_default") if obj.get("test_enum_with_default") is not None else TestEnumWithDefault.ZWEI, "test_string_with_default": obj.get("test_string_with_default") if obj.get("test_string_with_default") is not None else 'ahoy matey', - "test_inline_defined_enum_with_default": obj.get("test_inline_defined_enum_with_default") if obj.get("test_inline_defined_enum_with_default") is not None else 'B' + "test_inline_defined_enum_with_default": obj.get("test_inline_defined_enum_with_default") if obj.get("test_inline_defined_enum_with_default") is not None else Bs }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/type.py b/samples/openapi3/client/petstore/python/petstore_api/models/type.py new file mode 100644 index 000000000000..35a847de894f --- /dev/null +++ b/samples/openapi3/client/petstore/python/petstore_api/models/type.py @@ -0,0 +1,39 @@ +# 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 json +from enum import Enum +from typing_extensions import Self + + +class Type(int, Enum): + """ + Type + """ + + """ + allowed enum values + """ + NUMBER_2_DOT_0 = 2.0 + NUMBER_1_DOT_0 = 1.0 + NUMBER_0_DOT_5 = 0.5 + NUMBER_0_DOT_25 = 0.25 + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of Type from a JSON string""" + return cls(json.loads(json_str)) + + diff --git a/samples/openapi3/client/petstore/python/test/test_pony_sizes.py b/samples/openapi3/client/petstore/python/test/test_pony_sizes.py new file mode 100644 index 000000000000..8586169f7986 --- /dev/null +++ b/samples/openapi3/client/petstore/python/test/test_pony_sizes.py @@ -0,0 +1,51 @@ +# 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 + +from petstore_api.models.pony_sizes import PonySizes + +class TestPonySizes(unittest.TestCase): + """PonySizes unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> PonySizes: + """Test PonySizes + include_optional 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 `PonySizes` + """ + model = PonySizes() + if include_optional: + return PonySizes( + type = 2.0 + ) + else: + return PonySizes( + ) + """ + + def testPonySizes(self): + """Test PonySizes""" + # 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/test/test_type.py b/samples/openapi3/client/petstore/python/test/test_type.py new file mode 100644 index 000000000000..ecafff8199db --- /dev/null +++ b/samples/openapi3/client/petstore/python/test/test_type.py @@ -0,0 +1,33 @@ +# 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 + +from petstore_api.models.type import Type + +class TestType(unittest.TestCase): + """Type unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def testType(self): + """Test Type""" + # inst = Type() + +if __name__ == '__main__': + unittest.main() From 3970889803e2587c478cb7b4720165e5c284500d Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 4 Jun 2025 15:27:13 +0800 Subject: [PATCH 2/4] remove file --- .../src/test/resources/3_0/enum_float.yaml | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 modules/openapi-generator/src/test/resources/3_0/enum_float.yaml diff --git a/modules/openapi-generator/src/test/resources/3_0/enum_float.yaml b/modules/openapi-generator/src/test/resources/3_0/enum_float.yaml deleted file mode 100644 index 909521c8c61f..000000000000 --- a/modules/openapi-generator/src/test/resources/3_0/enum_float.yaml +++ /dev/null @@ -1,33 +0,0 @@ -openapi: 3.0.0 -info: - title: Sample API - description: API description in Markdown. - version: 1.0.0 -paths: - /pony-sizes: - get: - summary: Returns all pony sizes. - description: Optional extended description in Markdown. - responses: - 200: - description: OK - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/PonySizes' -components: - schemas: - PonySizes: - type: object - properties: - type: - $ref: '#/components/schemas/Type' - Type: - type: float - enum: - - 2.0 - - 1.0 - - 0.5 - - 0.25 From ef61753e274f150e74bf862d855cc1898d67c0eb Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 4 Jun 2025 15:49:58 +0800 Subject: [PATCH 3/4] apply same fix to python pydantic v1 --- .../languages/AbstractPythonPydanticV1Codegen.java | 2 ++ .../petstore/python-pydantic-v1-aiohttp/docs/Type.md | 8 ++++---- .../petstore_api/models/type.py | 8 ++++---- .../client/petstore/python-pydantic-v1/docs/Type.md | 8 ++++---- .../python-pydantic-v1/petstore_api/models/type.py | 8 ++++---- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonPydanticV1Codegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonPydanticV1Codegen.java index 52f370673bf2..da8434e1ae33 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonPydanticV1Codegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonPydanticV1Codegen.java @@ -1593,6 +1593,8 @@ public void setMapNumberTo(String mapNumberTo) { } public String toEnumVariableName(String name, String datatype) { + name = name.replace(".", "_DOT_"); + if ("int".equals(datatype)) { return "NUMBER_" + name.replace("-", "MINUS_"); } diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Type.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Type.md index 19ca807d66c2..f7ff2903a728 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Type.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/Type.md @@ -3,13 +3,13 @@ ## Enum -* `NUMBER_2.0` (value: `2.0`) +* `NUMBER_2_DOT_0` (value: `2.0`) -* `NUMBER_1.0` (value: `1.0`) +* `NUMBER_1_DOT_0` (value: `1.0`) -* `NUMBER_0.5` (value: `0.5`) +* `NUMBER_0_DOT_5` (value: `0.5`) -* `NUMBER_0.25` (value: `0.25`) +* `NUMBER_0_DOT_25` (value: `0.25`) [[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/models/type.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/type.py index 855822717b22..6cfa8b4bf309 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/type.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/type.py @@ -29,10 +29,10 @@ class Type(int, Enum): """ allowed enum values """ - NUMBER_2.0 = 2.0 - NUMBER_1.0 = 1.0 - NUMBER_0.5 = 0.5 - NUMBER_0.25 = 0.25 + NUMBER_2_DOT_0 = 2.0 + NUMBER_1_DOT_0 = 1.0 + NUMBER_0_DOT_5 = 0.5 + NUMBER_0_DOT_25 = 0.25 @classmethod def from_json(cls, json_str: str) -> Type: diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Type.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Type.md index 19ca807d66c2..f7ff2903a728 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/docs/Type.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/Type.md @@ -3,13 +3,13 @@ ## Enum -* `NUMBER_2.0` (value: `2.0`) +* `NUMBER_2_DOT_0` (value: `2.0`) -* `NUMBER_1.0` (value: `1.0`) +* `NUMBER_1_DOT_0` (value: `1.0`) -* `NUMBER_0.5` (value: `0.5`) +* `NUMBER_0_DOT_5` (value: `0.5`) -* `NUMBER_0.25` (value: `0.25`) +* `NUMBER_0_DOT_25` (value: `0.25`) [[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/models/type.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/type.py index 855822717b22..6cfa8b4bf309 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/type.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/type.py @@ -29,10 +29,10 @@ class Type(int, Enum): """ allowed enum values """ - NUMBER_2.0 = 2.0 - NUMBER_1.0 = 1.0 - NUMBER_0.5 = 0.5 - NUMBER_0.25 = 0.25 + NUMBER_2_DOT_0 = 2.0 + NUMBER_1_DOT_0 = 1.0 + NUMBER_0_DOT_5 = 0.5 + NUMBER_0_DOT_25 = 0.25 @classmethod def from_json(cls, json_str: str) -> Type: From 9f5a955927c51d700ddfd71e3af8176cbf83d1b0 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 4 Jun 2025 15:55:05 +0800 Subject: [PATCH 4/4] update test --- .../petstore-with-fake-endpoints-models-for-testing.yaml | 2 +- .../petstore/python-aiohttp/docs/TestModelWithEnumDefault.md | 2 +- .../petstore_api/models/test_model_with_enum_default.py | 4 ++-- .../docs/TestModelWithEnumDefault.md | 2 +- .../petstore_api/models/test_model_with_enum_default.py | 4 ++-- .../python-pydantic-v1/docs/TestModelWithEnumDefault.md | 2 +- .../petstore_api/models/test_model_with_enum_default.py | 4 ++-- .../client/petstore/python/docs/TestModelWithEnumDefault.md | 2 +- .../petstore_api/models/test_model_with_enum_default.py | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-) 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 48712fc412ed..e1c1388f3df7 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 @@ -2897,7 +2897,7 @@ components: - A - B - C - default: Bs + default: B PonySizes: type: object properties: diff --git a/samples/openapi3/client/petstore/python-aiohttp/docs/TestModelWithEnumDefault.md b/samples/openapi3/client/petstore/python-aiohttp/docs/TestModelWithEnumDefault.md index 986779f8c7b2..7d46e86deba4 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/TestModelWithEnumDefault.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/TestModelWithEnumDefault.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **test_string** | **str** | | [optional] **test_enum_with_default** | [**TestEnumWithDefault**](TestEnumWithDefault.md) | | [optional] [default to TestEnumWithDefault.ZWEI] **test_string_with_default** | **str** | | [optional] [default to 'ahoy matey'] -**test_inline_defined_enum_with_default** | **str** | | [optional] [default to Bs] +**test_inline_defined_enum_with_default** | **str** | | [optional] [default to 'B'] ## Example diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_model_with_enum_default.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_model_with_enum_default.py index b41747151ff3..218fa8f16d22 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_model_with_enum_default.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_model_with_enum_default.py @@ -32,7 +32,7 @@ class TestModelWithEnumDefault(BaseModel): test_string: Optional[StrictStr] = None test_enum_with_default: Optional[TestEnumWithDefault] = TestEnumWithDefault.ZWEI test_string_with_default: Optional[StrictStr] = 'ahoy matey' - test_inline_defined_enum_with_default: Optional[StrictStr] = Bs + test_inline_defined_enum_with_default: Optional[StrictStr] = 'B' __properties: ClassVar[List[str]] = ["test_enum", "test_string", "test_enum_with_default", "test_string_with_default", "test_inline_defined_enum_with_default"] @field_validator('test_inline_defined_enum_with_default') @@ -100,7 +100,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "test_string": obj.get("test_string"), "test_enum_with_default": obj.get("test_enum_with_default") if obj.get("test_enum_with_default") is not None else TestEnumWithDefault.ZWEI, "test_string_with_default": obj.get("test_string_with_default") if obj.get("test_string_with_default") is not None else 'ahoy matey', - "test_inline_defined_enum_with_default": obj.get("test_inline_defined_enum_with_default") if obj.get("test_inline_defined_enum_with_default") is not None else Bs + "test_inline_defined_enum_with_default": obj.get("test_inline_defined_enum_with_default") if obj.get("test_inline_defined_enum_with_default") is not None else 'B' }) return _obj diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestModelWithEnumDefault.md b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestModelWithEnumDefault.md index 90b0d84b8fdb..7adae701beb2 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestModelWithEnumDefault.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/TestModelWithEnumDefault.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **test_string** | **str** | | [optional] **test_enum_with_default** | [**TestEnumWithDefault**](TestEnumWithDefault.md) | | [optional] **test_string_with_default** | **str** | | [optional] [default to 'ahoy matey'] -**test_inline_defined_enum_with_default** | **str** | | [optional] [default to 'Bs'] +**test_inline_defined_enum_with_default** | **str** | | [optional] [default to 'B'] ## Example diff --git a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_model_with_enum_default.py b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_model_with_enum_default.py index 629360b3ddb8..861926379409 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_model_with_enum_default.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/models/test_model_with_enum_default.py @@ -31,7 +31,7 @@ class TestModelWithEnumDefault(BaseModel): test_string: Optional[StrictStr] = None test_enum_with_default: Optional[TestEnumWithDefault] = None test_string_with_default: Optional[StrictStr] = 'ahoy matey' - test_inline_defined_enum_with_default: Optional[StrictStr] = 'Bs' + test_inline_defined_enum_with_default: Optional[StrictStr] = 'B' __properties = ["test_enum", "test_string", "test_enum_with_default", "test_string_with_default", "test_inline_defined_enum_with_default"] @validator('test_inline_defined_enum_with_default') @@ -84,7 +84,7 @@ def from_dict(cls, obj: dict) -> TestModelWithEnumDefault: "test_string": obj.get("test_string"), "test_enum_with_default": obj.get("test_enum_with_default"), "test_string_with_default": obj.get("test_string_with_default") if obj.get("test_string_with_default") is not None else 'ahoy matey', - "test_inline_defined_enum_with_default": obj.get("test_inline_defined_enum_with_default") if obj.get("test_inline_defined_enum_with_default") is not None else 'Bs' + "test_inline_defined_enum_with_default": obj.get("test_inline_defined_enum_with_default") if obj.get("test_inline_defined_enum_with_default") is not None else 'B' }) return _obj diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/docs/TestModelWithEnumDefault.md b/samples/openapi3/client/petstore/python-pydantic-v1/docs/TestModelWithEnumDefault.md index 90b0d84b8fdb..7adae701beb2 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/docs/TestModelWithEnumDefault.md +++ b/samples/openapi3/client/petstore/python-pydantic-v1/docs/TestModelWithEnumDefault.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **test_string** | **str** | | [optional] **test_enum_with_default** | [**TestEnumWithDefault**](TestEnumWithDefault.md) | | [optional] **test_string_with_default** | **str** | | [optional] [default to 'ahoy matey'] -**test_inline_defined_enum_with_default** | **str** | | [optional] [default to 'Bs'] +**test_inline_defined_enum_with_default** | **str** | | [optional] [default to 'B'] ## Example diff --git a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/test_model_with_enum_default.py b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/test_model_with_enum_default.py index b0801ae66ec8..3775fd5e29c2 100644 --- a/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/test_model_with_enum_default.py +++ b/samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/models/test_model_with_enum_default.py @@ -31,7 +31,7 @@ class TestModelWithEnumDefault(BaseModel): test_string: Optional[StrictStr] = None test_enum_with_default: Optional[TestEnumWithDefault] = None test_string_with_default: Optional[StrictStr] = 'ahoy matey' - test_inline_defined_enum_with_default: Optional[StrictStr] = 'Bs' + test_inline_defined_enum_with_default: Optional[StrictStr] = 'B' additional_properties: Dict[str, Any] = {} __properties = ["test_enum", "test_string", "test_enum_with_default", "test_string_with_default", "test_inline_defined_enum_with_default"] @@ -91,7 +91,7 @@ def from_dict(cls, obj: dict) -> TestModelWithEnumDefault: "test_string": obj.get("test_string"), "test_enum_with_default": obj.get("test_enum_with_default"), "test_string_with_default": obj.get("test_string_with_default") if obj.get("test_string_with_default") is not None else 'ahoy matey', - "test_inline_defined_enum_with_default": obj.get("test_inline_defined_enum_with_default") if obj.get("test_inline_defined_enum_with_default") is not None else 'Bs' + "test_inline_defined_enum_with_default": obj.get("test_inline_defined_enum_with_default") if obj.get("test_inline_defined_enum_with_default") is not None else 'B' }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/samples/openapi3/client/petstore/python/docs/TestModelWithEnumDefault.md b/samples/openapi3/client/petstore/python/docs/TestModelWithEnumDefault.md index 986779f8c7b2..7d46e86deba4 100644 --- a/samples/openapi3/client/petstore/python/docs/TestModelWithEnumDefault.md +++ b/samples/openapi3/client/petstore/python/docs/TestModelWithEnumDefault.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **test_string** | **str** | | [optional] **test_enum_with_default** | [**TestEnumWithDefault**](TestEnumWithDefault.md) | | [optional] [default to TestEnumWithDefault.ZWEI] **test_string_with_default** | **str** | | [optional] [default to 'ahoy matey'] -**test_inline_defined_enum_with_default** | **str** | | [optional] [default to Bs] +**test_inline_defined_enum_with_default** | **str** | | [optional] [default to 'B'] ## Example diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/test_model_with_enum_default.py b/samples/openapi3/client/petstore/python/petstore_api/models/test_model_with_enum_default.py index 3af0b9ad1145..4bff5e699a37 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/test_model_with_enum_default.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/test_model_with_enum_default.py @@ -32,7 +32,7 @@ class TestModelWithEnumDefault(BaseModel): test_string: Optional[StrictStr] = None test_enum_with_default: Optional[TestEnumWithDefault] = TestEnumWithDefault.ZWEI test_string_with_default: Optional[StrictStr] = 'ahoy matey' - test_inline_defined_enum_with_default: Optional[StrictStr] = Bs + test_inline_defined_enum_with_default: Optional[StrictStr] = 'B' additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["test_enum", "test_string", "test_enum_with_default", "test_string_with_default", "test_inline_defined_enum_with_default"] @@ -108,7 +108,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "test_string": obj.get("test_string"), "test_enum_with_default": obj.get("test_enum_with_default") if obj.get("test_enum_with_default") is not None else TestEnumWithDefault.ZWEI, "test_string_with_default": obj.get("test_string_with_default") if obj.get("test_string_with_default") is not None else 'ahoy matey', - "test_inline_defined_enum_with_default": obj.get("test_inline_defined_enum_with_default") if obj.get("test_inline_defined_enum_with_default") is not None else Bs + "test_inline_defined_enum_with_default": obj.get("test_inline_defined_enum_with_default") if obj.get("test_inline_defined_enum_with_default") is not None else 'B' }) # store additional fields in additional_properties for _key in obj.keys():