From 3a502aab8dcec170d57c7a670b0eb3641fe0a30b Mon Sep 17 00:00:00 2001 From: William Cheng Date: Tue, 30 Sep 2025 16:41:06 +0800 Subject: [PATCH] test the new option --- bin/configs/python-aiohttp.yaml | 1 + .../python-aiohttp/docs/DataOutputFormat.md | 2 ++ .../petstore/python-aiohttp/docs/EnumClass.md | 2 ++ .../docs/EnumNumberVendorExt.md | 2 ++ .../python-aiohttp/docs/EnumString1.md | 2 ++ .../python-aiohttp/docs/EnumString2.md | 2 ++ .../docs/EnumStringVendorExt.md | 2 ++ .../python-aiohttp/docs/OneOfEnumString.md | 2 ++ .../petstore/python-aiohttp/docs/OuterEnum.md | 2 ++ .../docs/OuterEnumDefaultValue.md | 2 ++ .../python-aiohttp/docs/OuterEnumInteger.md | 2 ++ .../docs/OuterEnumIntegerDefaultValue.md | 2 ++ .../python-aiohttp/docs/SingleRefType.md | 2 ++ .../docs/SpecialCharacterEnum.md | 2 ++ .../petstore/python-aiohttp/docs/TestEnum.md | 2 ++ .../docs/TestEnumWithDefault.md | 2 ++ .../petstore/python-aiohttp/docs/Type.md | 2 ++ .../petstore_api/models/bathing.py | 8 +++--- .../petstore_api/models/data_output_format.py | 6 ++++ .../petstore_api/models/enum_arrays.py | 8 +++--- .../petstore_api/models/enum_class.py | 6 ++++ .../models/enum_number_vendor_ext.py | 6 ++++ .../petstore_api/models/enum_string1.py | 6 ++++ .../petstore_api/models/enum_string2.py | 6 ++++ .../models/enum_string_vendor_ext.py | 6 ++++ .../petstore_api/models/enum_test.py | 28 +++++++++---------- .../petstore_api/models/feeding.py | 8 +++--- .../petstore_api/models/map_test.py | 4 +-- .../petstore_api/models/one_of_enum_string.py | 6 ++++ .../petstore_api/models/order.py | 4 +-- .../petstore_api/models/outer_enum.py | 6 ++++ .../models/outer_enum_default_value.py | 6 ++++ .../petstore_api/models/outer_enum_integer.py | 6 ++++ .../outer_enum_integer_default_value.py | 6 ++++ .../python-aiohttp/petstore_api/models/pet.py | 4 +-- .../petstore_api/models/poop_cleaning.py | 8 +++--- .../petstore_api/models/single_ref_type.py | 6 ++++ .../models/special_character_enum.py | 6 ++++ .../petstore_api/models/special_name.py | 4 +-- .../petstore_api/models/test_enum.py | 6 ++++ .../models/test_enum_with_default.py | 6 ++++ .../models/test_model_with_enum_default.py | 4 +-- .../petstore_api/models/type.py | 6 ++++ 43 files changed, 169 insertions(+), 40 deletions(-) diff --git a/bin/configs/python-aiohttp.yaml b/bin/configs/python-aiohttp.yaml index 14a1adeffd3..52f57d5f36d 100644 --- a/bin/configs/python-aiohttp.yaml +++ b/bin/configs/python-aiohttp.yaml @@ -7,6 +7,7 @@ additionalProperties: packageName: petstore_api mapNumberTo: float poetry1: true + enumUnknownDefaultCase: true nameMappings: _type: underscore_type type_: type_with_underscore diff --git a/samples/openapi3/client/petstore/python-aiohttp/docs/DataOutputFormat.md b/samples/openapi3/client/petstore/python-aiohttp/docs/DataOutputFormat.md index d9df2a1cffd..d16909b2580 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/DataOutputFormat.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/DataOutputFormat.md @@ -9,6 +9,8 @@ * `XML` (value: `'XML'`) +* `UNKNOWN_DEFAULT_OPEN_API` (value: `'unknown_default_open_api'`) + [[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/EnumClass.md b/samples/openapi3/client/petstore/python-aiohttp/docs/EnumClass.md index 725b617bdad..f6d43e9be20 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/EnumClass.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/EnumClass.md @@ -9,6 +9,8 @@ * `LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS` (value: `'(xyz)'`) +* `UNKNOWN_DEFAULT_OPEN_API` (value: `'unknown_default_open_api'`) + [[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/EnumNumberVendorExt.md b/samples/openapi3/client/petstore/python-aiohttp/docs/EnumNumberVendorExt.md index 4c1572b1d27..60e2541a826 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/EnumNumberVendorExt.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/EnumNumberVendorExt.md @@ -9,6 +9,8 @@ * `FiftySix` (value: `56`) +* `unknown_default_open_api` (value: `11184809`) + [[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/EnumString1.md b/samples/openapi3/client/petstore/python-aiohttp/docs/EnumString1.md index aa214538bca..d177a4db51d 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/EnumString1.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/EnumString1.md @@ -7,6 +7,8 @@ * `B` (value: `'b'`) +* `UNKNOWN_DEFAULT_OPEN_API` (value: `'unknown_default_open_api'`) + [[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/EnumString2.md b/samples/openapi3/client/petstore/python-aiohttp/docs/EnumString2.md index d1b49f8dddd..b430966dcce 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/EnumString2.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/EnumString2.md @@ -7,6 +7,8 @@ * `D` (value: `'d'`) +* `UNKNOWN_DEFAULT_OPEN_API` (value: `'unknown_default_open_api'`) + [[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/EnumStringVendorExt.md b/samples/openapi3/client/petstore/python-aiohttp/docs/EnumStringVendorExt.md index ce6077c18a3..f97739e8ea8 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/EnumStringVendorExt.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/EnumStringVendorExt.md @@ -9,6 +9,8 @@ * `bazVar_XEnumVarname` (value: `'baz'`) +* `'unknown_default_open_api'` (value: `'unknown_default_open_api'`) + [[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/OneOfEnumString.md b/samples/openapi3/client/petstore/python-aiohttp/docs/OneOfEnumString.md index 6f1b157c36c..6fd81f92b94 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/OneOfEnumString.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/OneOfEnumString.md @@ -12,6 +12,8 @@ oneOf enum strings * `D` (value: `'d'`) +* `UNKNOWN_DEFAULT_OPEN_API` (value: `'unknown_default_open_api'`) + [[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/OuterEnum.md b/samples/openapi3/client/petstore/python-aiohttp/docs/OuterEnum.md index 9ba4f91069a..137be383829 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/OuterEnum.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/OuterEnum.md @@ -9,6 +9,8 @@ * `DELIVERED` (value: `'delivered'`) +* `UNKNOWN_DEFAULT_OPEN_API` (value: `'unknown_default_open_api'`) + [[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/OuterEnumDefaultValue.md b/samples/openapi3/client/petstore/python-aiohttp/docs/OuterEnumDefaultValue.md index 0c97f8c9cb6..c43eeab66d2 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/OuterEnumDefaultValue.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/OuterEnumDefaultValue.md @@ -9,6 +9,8 @@ * `DELIVERED` (value: `'delivered'`) +* `UNKNOWN_DEFAULT_OPEN_API` (value: `'unknown_default_open_api'`) + [[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/OuterEnumInteger.md b/samples/openapi3/client/petstore/python-aiohttp/docs/OuterEnumInteger.md index 052b5163814..fcc49edae9f 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/OuterEnumInteger.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/OuterEnumInteger.md @@ -9,6 +9,8 @@ * `NUMBER_2` (value: `2`) +* `NUMBER_11184809` (value: `11184809`) + [[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/OuterEnumIntegerDefaultValue.md b/samples/openapi3/client/petstore/python-aiohttp/docs/OuterEnumIntegerDefaultValue.md index 66cd0abdb0a..2d95078fb0d 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/OuterEnumIntegerDefaultValue.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/OuterEnumIntegerDefaultValue.md @@ -11,6 +11,8 @@ * `NUMBER_2` (value: `2`) +* `NUMBER_11184809` (value: `11184809`) + [[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/SingleRefType.md b/samples/openapi3/client/petstore/python-aiohttp/docs/SingleRefType.md index 8f0f60e5678..9c9269b03f0 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/SingleRefType.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/SingleRefType.md @@ -7,6 +7,8 @@ * `USER` (value: `'user'`) +* `UNKNOWN_DEFAULT_OPEN_API` (value: `'unknown_default_open_api'`) + [[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/SpecialCharacterEnum.md b/samples/openapi3/client/petstore/python-aiohttp/docs/SpecialCharacterEnum.md index 71a3affc4fe..a8a78276b08 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/SpecialCharacterEnum.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/SpecialCharacterEnum.md @@ -23,6 +23,8 @@ * `HELLO_WORLD` (value: `' hello world '`) +* `UNKNOWN_DEFAULT_OPEN_API` (value: `'unknown_default_open_api'`) + [[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/TestEnum.md b/samples/openapi3/client/petstore/python-aiohttp/docs/TestEnum.md index 612b62bd4dc..2fe27924ccb 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/TestEnum.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/TestEnum.md @@ -11,6 +11,8 @@ * `FOUR` (value: `'foUr'`) +* `UNKNOWN_DEFAULT_OPEN_API` (value: `'unknown_default_open_api'`) + [[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/TestEnumWithDefault.md b/samples/openapi3/client/petstore/python-aiohttp/docs/TestEnumWithDefault.md index ac8591c95c0..114bd187459 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/TestEnumWithDefault.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/TestEnumWithDefault.md @@ -9,6 +9,8 @@ * `DREI` (value: `'DREI'`) +* `UNKNOWN_DEFAULT_OPEN_API` (value: `'unknown_default_open_api'`) + [[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/Type.md b/samples/openapi3/client/petstore/python-aiohttp/docs/Type.md index f7ff2903a72..a132564bfaa 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/docs/Type.md +++ b/samples/openapi3/client/petstore/python-aiohttp/docs/Type.md @@ -11,6 +11,8 @@ * `NUMBER_0_DOT_25` (value: `0.25`) +* `NUMBER_11184809` (value: `11184809`) + [[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/models/bathing.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/bathing.py index 088e6ad3b87..2685383bace 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/bathing.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/bathing.py @@ -34,15 +34,15 @@ class Bathing(BaseModel): @field_validator('task_name') def task_name_validate_enum(cls, value): """Validates the enum""" - if value not in set(['cleaning_deep']): - raise ValueError("must be one of enum values ('cleaning_deep')") + if value not in set(['cleaning_deep', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('cleaning_deep', 'unknown_default_open_api')") return value @field_validator('function_name') def function_name_validate_enum(cls, value): """Validates the enum""" - if value not in set(['care_nourish']): - raise ValueError("must be one of enum values ('care_nourish')") + if value not in set(['care_nourish', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('care_nourish', 'unknown_default_open_api')") return value model_config = ConfigDict( diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/data_output_format.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/data_output_format.py index ee3df76c516..6ba277d4a5c 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/data_output_format.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/data_output_format.py @@ -29,10 +29,16 @@ class DataOutputFormat(str, Enum): JSON = 'JSON' CSV = 'CSV' XML = 'XML' + UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api' @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of DataOutputFormat from a JSON string""" return cls(json.loads(json_str)) + @classmethod + def _missing_(cls, value): + """Handle unknown enum values""" + return cls.UNKNOWN_DEFAULT_OPEN_API + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_arrays.py index 68ceb962b03..068d7c18384 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_arrays.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_arrays.py @@ -36,8 +36,8 @@ class EnumArrays(BaseModel): if value is None: return value - if value not in set(['>=', '$']): - raise ValueError("must be one of enum values ('>=', '$')") + if value not in set(['>=', '$', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('>=', '$', 'unknown_default_open_api')") return value @field_validator('array_enum') @@ -47,8 +47,8 @@ class EnumArrays(BaseModel): return value for i in value: - if i not in set(['fish', 'crab']): - raise ValueError("each list item must be one of ('fish', 'crab')") + if i not in set(['fish', 'crab', 'unknown_default_open_api']): + raise ValueError("each list item must be one of ('fish', 'crab', 'unknown_default_open_api')") return value model_config = ConfigDict( diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_class.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_class.py index 1ba5af8036d..dd3b506f794 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_class.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_class.py @@ -29,10 +29,16 @@ class EnumClass(str, Enum): ABC = '_abc' MINUS_EFG = '-efg' LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS = '(xyz)' + UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api' @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of EnumClass from a JSON string""" return cls(json.loads(json_str)) + @classmethod + def _missing_(cls, value): + """Handle unknown enum values""" + return cls.UNKNOWN_DEFAULT_OPEN_API + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_number_vendor_ext.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_number_vendor_ext.py index 5588de5c704..703db0a10e9 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_number_vendor_ext.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_number_vendor_ext.py @@ -29,10 +29,16 @@ class EnumNumberVendorExt(int, Enum): FortyTwo = 42 Eigtheen = 18 FiftySix = 56 + unknown_default_open_api = 11184809 @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of EnumNumberVendorExt from a JSON string""" return cls(json.loads(json_str)) + @classmethod + def _missing_(cls, value): + """Handle unknown enum values""" + return cls.UNKNOWN_DEFAULT_OPEN_API + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string1.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string1.py index 678b4e12661..e5211bc83c6 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string1.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string1.py @@ -28,10 +28,16 @@ class EnumString1(str, Enum): """ A = 'a' B = 'b' + UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api' @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of EnumString1 from a JSON string""" return cls(json.loads(json_str)) + @classmethod + def _missing_(cls, value): + """Handle unknown enum values""" + return cls.UNKNOWN_DEFAULT_OPEN_API + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string2.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string2.py index a959f554e0a..92f9f3a437f 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string2.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string2.py @@ -28,10 +28,16 @@ class EnumString2(str, Enum): """ C = 'c' D = 'd' + UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api' @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of EnumString2 from a JSON string""" return cls(json.loads(json_str)) + @classmethod + def _missing_(cls, value): + """Handle unknown enum values""" + return cls.UNKNOWN_DEFAULT_OPEN_API + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string_vendor_ext.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string_vendor_ext.py index 821812e9b08..3a48ef50c1b 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string_vendor_ext.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_string_vendor_ext.py @@ -29,10 +29,16 @@ class EnumStringVendorExt(str, Enum): FOO_XEnumVarname = 'FOO' BarVar_XEnumVarname = 'Bar' bazVar_XEnumVarname = 'baz' + 'unknown_default_open_api' = 'unknown_default_open_api' @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of EnumStringVendorExt from a JSON string""" return cls(json.loads(json_str)) + @classmethod + def _missing_(cls, value): + """Handle unknown enum values""" + return cls.UNKNOWN_DEFAULT_OPEN_API + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_test.py index b7e6ec36230..1fe3bab0936 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_test.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/enum_test.py @@ -53,15 +53,15 @@ class EnumTest(BaseModel): if value is None: return value - if value not in set(['UPPER', 'lower', '']): - raise ValueError("must be one of enum values ('UPPER', 'lower', '')") + if value not in set(['UPPER', 'lower', '', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('UPPER', 'lower', '', 'unknown_default_open_api')") return value @field_validator('enum_string_required') def enum_string_required_validate_enum(cls, value): """Validates the enum""" - if value not in set(['UPPER', 'lower', '']): - raise ValueError("must be one of enum values ('UPPER', 'lower', '')") + if value not in set(['UPPER', 'lower', '', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('UPPER', 'lower', '', 'unknown_default_open_api')") return value @field_validator('enum_integer_default') @@ -70,8 +70,8 @@ class EnumTest(BaseModel): if value is None: return value - if value not in set([1, 5, 14]): - raise ValueError("must be one of enum values (1, 5, 14)") + if value not in set([1, 5, 14, 11184809]): + raise ValueError("must be one of enum values (1, 5, 14, 11184809)") return value @field_validator('enum_integer') @@ -80,8 +80,8 @@ class EnumTest(BaseModel): if value is None: return value - if value not in set([1, -1]): - raise ValueError("must be one of enum values (1, -1)") + if value not in set([1, -1, 11184809]): + raise ValueError("must be one of enum values (1, -1, 11184809)") return value @field_validator('enum_number') @@ -90,8 +90,8 @@ class EnumTest(BaseModel): if value is None: return value - if value not in set([1.1, -1.2]): - raise ValueError("must be one of enum values (1.1, -1.2)") + if value not in set([1.1, -1.2, 11184809]): + raise ValueError("must be one of enum values (1.1, -1.2, 11184809)") return value @field_validator('enum_string_single_member') @@ -100,8 +100,8 @@ class EnumTest(BaseModel): if value is None: return value - if value not in set(['abc']): - raise ValueError("must be one of enum values ('abc')") + if value not in set(['abc', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('abc', 'unknown_default_open_api')") return value @field_validator('enum_integer_single_member') @@ -110,8 +110,8 @@ class EnumTest(BaseModel): if value is None: return value - if value not in set([100]): - raise ValueError("must be one of enum values (100)") + if value not in set([100, 11184809]): + raise ValueError("must be one of enum values (100, 11184809)") return value model_config = ConfigDict( diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/feeding.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/feeding.py index 1183b314fdd..798001a36db 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/feeding.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/feeding.py @@ -34,15 +34,15 @@ class Feeding(BaseModel): @field_validator('task_name') def task_name_validate_enum(cls, value): """Validates the enum""" - if value not in set(['cleaning']): - raise ValueError("must be one of enum values ('cleaning')") + if value not in set(['cleaning', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('cleaning', 'unknown_default_open_api')") return value @field_validator('function_name') def function_name_validate_enum(cls, value): """Validates the enum""" - if value not in set(['care_nourish']): - raise ValueError("must be one of enum values ('care_nourish')") + if value not in set(['care_nourish', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('care_nourish', 'unknown_default_open_api')") return value model_config = ConfigDict( diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_test.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_test.py index 2a056ab5532..a620b82535b 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_test.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/map_test.py @@ -39,8 +39,8 @@ class MapTest(BaseModel): return value for i in value.values(): - if i not in set(['UPPER', 'lower']): - raise ValueError("dict values must be one of enum values ('UPPER', 'lower')") + if i not in set(['UPPER', 'lower', 'unknown_default_open_api']): + raise ValueError("dict values must be one of enum values ('UPPER', 'lower', 'unknown_default_open_api')") return value model_config = ConfigDict( diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/one_of_enum_string.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/one_of_enum_string.py index 53101c37cc8..0eeeffe8c6f 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/one_of_enum_string.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/one_of_enum_string.py @@ -30,10 +30,16 @@ class OneOfEnumString(str, Enum): B = 'b' C = 'c' D = 'd' + UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api' @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of OneOfEnumString from a JSON string""" return cls(json.loads(json_str)) + @classmethod + def _missing_(cls, value): + """Handle unknown enum values""" + return cls.UNKNOWN_DEFAULT_OPEN_API + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/order.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/order.py index f742027e088..97ac2bdaaa6 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/order.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/order.py @@ -41,8 +41,8 @@ class Order(BaseModel): if value is None: return value - if value not in set(['placed', 'approved', 'delivered']): - raise ValueError("must be one of enum values ('placed', 'approved', 'delivered')") + if value not in set(['placed', 'approved', 'delivered', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('placed', 'approved', 'delivered', 'unknown_default_open_api')") return value model_config = ConfigDict( diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum.py index ac48cc0dc4d..a8a5f7b9d22 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum.py @@ -29,10 +29,16 @@ class OuterEnum(str, Enum): PLACED = 'placed' APPROVED = 'approved' DELIVERED = 'delivered' + UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api' @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of OuterEnum from a JSON string""" return cls(json.loads(json_str)) + @classmethod + def _missing_(cls, value): + """Handle unknown enum values""" + return cls.UNKNOWN_DEFAULT_OPEN_API + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_default_value.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_default_value.py index 99d6fd5fc04..717d1688a4a 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_default_value.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_default_value.py @@ -29,10 +29,16 @@ class OuterEnumDefaultValue(str, Enum): PLACED = 'placed' APPROVED = 'approved' DELIVERED = 'delivered' + UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api' @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of OuterEnumDefaultValue from a JSON string""" return cls(json.loads(json_str)) + @classmethod + def _missing_(cls, value): + """Handle unknown enum values""" + return cls.UNKNOWN_DEFAULT_OPEN_API + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_integer.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_integer.py index b771b7a61f5..fd0265ef2c2 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_integer.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_integer.py @@ -29,10 +29,16 @@ class OuterEnumInteger(int, Enum): NUMBER_0 = 0 NUMBER_1 = 1 NUMBER_2 = 2 + NUMBER_11184809 = 11184809 @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of OuterEnumInteger from a JSON string""" return cls(json.loads(json_str)) + @classmethod + def _missing_(cls, value): + """Handle unknown enum values""" + return cls.UNKNOWN_DEFAULT_OPEN_API + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_integer_default_value.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_integer_default_value.py index 8df41b2bd32..eb48bfb3b5e 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_integer_default_value.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/outer_enum_integer_default_value.py @@ -30,10 +30,16 @@ class OuterEnumIntegerDefaultValue(int, Enum): NUMBER_0 = 0 NUMBER_1 = 1 NUMBER_2 = 2 + NUMBER_11184809 = 11184809 @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of OuterEnumIntegerDefaultValue from a JSON string""" return cls(json.loads(json_str)) + @classmethod + def _missing_(cls, value): + """Handle unknown enum values""" + return cls.UNKNOWN_DEFAULT_OPEN_API + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pet.py index be47c3b1a89..1c9aee8e56e 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/pet.py @@ -43,8 +43,8 @@ class Pet(BaseModel): if value is None: return value - if value not in set(['available', 'pending', 'sold']): - raise ValueError("must be one of enum values ('available', 'pending', 'sold')") + if value not in set(['available', 'pending', 'sold', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('available', 'pending', 'sold', 'unknown_default_open_api')") return value model_config = ConfigDict( diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/poop_cleaning.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/poop_cleaning.py index 047cf0d481a..78c3ea97cc0 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/poop_cleaning.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/poop_cleaning.py @@ -34,15 +34,15 @@ class PoopCleaning(BaseModel): @field_validator('task_name') def task_name_validate_enum(cls, value): """Validates the enum""" - if value not in set(['cleaning']): - raise ValueError("must be one of enum values ('cleaning')") + if value not in set(['cleaning', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('cleaning', 'unknown_default_open_api')") return value @field_validator('function_name') def function_name_validate_enum(cls, value): """Validates the enum""" - if value not in set(['care']): - raise ValueError("must be one of enum values ('care')") + if value not in set(['care', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('care', 'unknown_default_open_api')") return value model_config = ConfigDict( diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/single_ref_type.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/single_ref_type.py index 91ab07e2535..2a2b2b4888b 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/single_ref_type.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/single_ref_type.py @@ -28,10 +28,16 @@ class SingleRefType(str, Enum): """ ADMIN = 'admin' USER = 'user' + UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api' @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of SingleRefType from a JSON string""" return cls(json.loads(json_str)) + @classmethod + def _missing_(cls, value): + """Handle unknown enum values""" + return cls.UNKNOWN_DEFAULT_OPEN_API + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_character_enum.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_character_enum.py index 1d85fd148d4..072a330ff18 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_character_enum.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_character_enum.py @@ -36,10 +36,16 @@ class SpecialCharacterEnum(str, Enum): THIS_IS_EXCLAMATION = 'this_is_!' IMPORT = 'import' HELLO_WORLD = ' hello world ' + UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api' @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of SpecialCharacterEnum from a JSON string""" return cls(json.loads(json_str)) + @classmethod + def _missing_(cls, value): + """Handle unknown enum values""" + return cls.UNKNOWN_DEFAULT_OPEN_API + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_name.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_name.py index d3c8f618568..e175613d5cc 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_name.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/special_name.py @@ -38,8 +38,8 @@ class SpecialName(BaseModel): if value is None: return value - if value not in set(['available', 'pending', 'sold']): - raise ValueError("must be one of enum values ('available', 'pending', 'sold')") + if value not in set(['available', 'pending', 'sold', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('available', 'pending', 'sold', 'unknown_default_open_api')") return value model_config = ConfigDict( diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_enum.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_enum.py index 8eae227a84e..f864a8f8dde 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_enum.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_enum.py @@ -30,10 +30,16 @@ class TestEnum(str, Enum): TWO = 'TWO' THREE = 'THREE' FOUR = 'foUr' + UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api' @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of TestEnum from a JSON string""" return cls(json.loads(json_str)) + @classmethod + def _missing_(cls, value): + """Handle unknown enum values""" + return cls.UNKNOWN_DEFAULT_OPEN_API + diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_enum_with_default.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_enum_with_default.py index 9304d3ab849..f3e5c201850 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_enum_with_default.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/test_enum_with_default.py @@ -29,10 +29,16 @@ class TestEnumWithDefault(str, Enum): EIN = 'EIN' ZWEI = 'ZWEI' DREI = 'DREI' + UNKNOWN_DEFAULT_OPEN_API = 'unknown_default_open_api' @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of TestEnumWithDefault from a JSON string""" return cls(json.loads(json_str)) + @classmethod + def _missing_(cls, value): + """Handle unknown enum values""" + return cls.UNKNOWN_DEFAULT_OPEN_API + 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 218fa8f16d2..611b5e5f8e0 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 @@ -41,8 +41,8 @@ class TestModelWithEnumDefault(BaseModel): if value is None: return value - if value not in set(['A', 'B', 'C']): - raise ValueError("must be one of enum values ('A', 'B', 'C')") + if value not in set(['A', 'B', 'C', 'unknown_default_open_api']): + raise ValueError("must be one of enum values ('A', 'B', 'C', 'unknown_default_open_api')") return value model_config = ConfigDict( 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 index 35a847de894..3dffd4a61ca 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/type.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/type.py @@ -30,10 +30,16 @@ class Type(int, Enum): NUMBER_1_DOT_0 = 1.0 NUMBER_0_DOT_5 = 0.5 NUMBER_0_DOT_25 = 0.25 + NUMBER_11184809 = 11184809 @classmethod def from_json(cls, json_str: str) -> Self: """Create an instance of Type from a JSON string""" return cls(json.loads(json_str)) + @classmethod + def _missing_(cls, value): + """Handle unknown enum values""" + return cls.UNKNOWN_DEFAULT_OPEN_API +