diff --git a/samples/client/echo_api/python-nextgen/openapi_client/models/default_value.py b/samples/client/echo_api/python-nextgen/openapi_client/models/default_value.py index 92ecd2aba30..b4a7d1160c8 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/models/default_value.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/models/default_value.py @@ -42,9 +42,9 @@ class DefaultValue(BaseModel): def array_string_enum_default_validate_enum(cls, v): if v is None: return v - - if v not in ('success', 'failure', 'unclassified'): - raise ValueError("must validate the enum values ('success', 'failure', 'unclassified')") + for i in v: + if i not in ('success', 'failure', 'unclassified'): + raise ValueError("each list item must be one of ('success', 'failure', 'unclassified')") return v class Config: diff --git a/samples/client/echo_api/python-nextgen/openapi_client/models/pet.py b/samples/client/echo_api/python-nextgen/openapi_client/models/pet.py index 00eb3d7be1f..d34df26fa5c 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/models/pet.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/models/pet.py @@ -41,9 +41,8 @@ class Pet(BaseModel): def status_validate_enum(cls, v): if v is None: return v - if v not in ('available', 'pending', 'sold'): - raise ValueError("must validate the enum values ('available', 'pending', 'sold')") + raise ValueError("must be one of enum values ('available', 'pending', 'sold')") return v class Config: diff --git a/samples/client/echo_api/python-nextgen/openapi_client/models/query.py b/samples/client/echo_api/python-nextgen/openapi_client/models/query.py index d52e87c6f50..531f366ed5c 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/models/query.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/models/query.py @@ -35,9 +35,9 @@ class Query(BaseModel): def outcomes_validate_enum(cls, v): if v is None: return v - - if v not in ('SUCCESS', 'FAILURE', 'SKIPPED'): - raise ValueError("must validate the enum values ('SUCCESS', 'FAILURE', 'SKIPPED')") + for i in v: + if i not in ('SUCCESS', 'FAILURE', 'SKIPPED'): + raise ValueError("each list item must be one of ('SUCCESS', 'FAILURE', 'SKIPPED')") return v class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_arrays.py index ce596ea3491..a3665c53ded 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_arrays.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_arrays.py @@ -34,18 +34,17 @@ class EnumArrays(BaseModel): def just_symbol_validate_enum(cls, v): if v is None: return v - if v not in ('>=', '$'): - raise ValueError("must validate the enum values ('>=', '$')") + raise ValueError("must be one of enum values ('>=', '$')") return v @validator('array_enum') def array_enum_validate_enum(cls, v): if v is None: return v - - if v not in ('fish', 'crab'): - raise ValueError("must validate the enum values ('fish', 'crab')") + for i in v: + if i not in ('fish', 'crab'): + raise ValueError("each list item must be one of ('fish', 'crab')") return v class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_test.py index e610ed2c1a0..5f097942ba5 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_test.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/enum_test.py @@ -45,42 +45,38 @@ class EnumTest(BaseModel): def enum_string_validate_enum(cls, v): if v is None: return v - if v not in ('UPPER', 'lower', ''): - raise ValueError("must validate the enum values ('UPPER', 'lower', '')") + raise ValueError("must be one of enum values ('UPPER', 'lower', '')") return v @validator('enum_string_required') def enum_string_required_validate_enum(cls, v): if v not in ('UPPER', 'lower', ''): - raise ValueError("must validate the enum values ('UPPER', 'lower', '')") + raise ValueError("must be one of enum values ('UPPER', 'lower', '')") return v @validator('enum_integer_default') def enum_integer_default_validate_enum(cls, v): if v is None: return v - if v not in (1, 5, 14): - raise ValueError("must validate the enum values (1, 5, 14)") + raise ValueError("must be one of enum values (1, 5, 14)") return v @validator('enum_integer') def enum_integer_validate_enum(cls, v): if v is None: return v - if v not in (1, -1): - raise ValueError("must validate the enum values (1, -1)") + raise ValueError("must be one of enum values (1, -1)") return v @validator('enum_number') def enum_number_validate_enum(cls, v): if v is None: return v - if v not in (1.1, -1.2): - raise ValueError("must validate the enum values (1.1, -1.2)") + raise ValueError("must be one of enum values (1.1, -1.2)") return v class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/map_test.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/map_test.py index 14e866474e5..36d415ccbf6 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/map_test.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/map_test.py @@ -36,9 +36,8 @@ class MapTest(BaseModel): def map_of_enum_string_validate_enum(cls, v): if v is None: return v - if v not in ('UPPER', 'lower'): - raise ValueError("must validate the enum values ('UPPER', 'lower')") + raise ValueError("must be one of enum values ('UPPER', 'lower')") return v class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/order.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/order.py index cb8cb389940..c44c3a2eea9 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/order.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/order.py @@ -38,9 +38,8 @@ class Order(BaseModel): def status_validate_enum(cls, v): if v is None: return v - if v not in ('placed', 'approved', 'delivered'): - raise ValueError("must validate the enum values ('placed', 'approved', 'delivered')") + raise ValueError("must be one of enum values ('placed', 'approved', 'delivered')") return v class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/pet.py index 9967660b383..f8bb0d46377 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/pet.py @@ -40,9 +40,8 @@ class Pet(BaseModel): def status_validate_enum(cls, v): if v is None: return v - if v not in ('available', 'pending', 'sold'): - raise ValueError("must validate the enum values ('available', 'pending', 'sold')") + raise ValueError("must be one of enum values ('available', 'pending', 'sold')") return v class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/special_name.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/special_name.py index 372f43fe052..811569b1c98 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/special_name.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/models/special_name.py @@ -36,9 +36,8 @@ class SpecialName(BaseModel): def var_schema_validate_enum(cls, v): if v is None: return v - if v not in ('available', 'pending', 'sold'): - raise ValueError("must validate the enum values ('available', 'pending', 'sold')") + raise ValueError("must be one of enum values ('available', 'pending', 'sold')") return v class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/tests/test_model.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/tests/test_model.py index b2954d10e0a..b67782c7745 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/tests/test_model.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/tests/test_model.py @@ -235,4 +235,4 @@ class ModelTests(unittest.TestCase): self.pet.status = "error" self.assertTrue(False) # this line shouldn't execute except ValueError as e: - self.assertTrue("must validate the enum values ('available', 'pending', 'sold')" in str(e)) + self.assertTrue("must be one of enum values ('available', 'pending', 'sold')" in str(e)) diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_arrays.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_arrays.py index 0c096aa0fc8..82b7bcfc92d 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_arrays.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_arrays.py @@ -35,18 +35,17 @@ class EnumArrays(BaseModel): def just_symbol_validate_enum(cls, v): if v is None: return v - if v not in ('>=', '$'): - raise ValueError("must validate the enum values ('>=', '$')") + raise ValueError("must be one of enum values ('>=', '$')") return v @validator('array_enum') def array_enum_validate_enum(cls, v): if v is None: return v - - if v not in ('fish', 'crab'): - raise ValueError("must validate the enum values ('fish', 'crab')") + for i in v: + if i not in ('fish', 'crab'): + raise ValueError("each list item must be one of ('fish', 'crab')") return v class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_test.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_test.py index 8a562bd0941..560b95f7bb4 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_test.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/enum_test.py @@ -46,42 +46,38 @@ class EnumTest(BaseModel): def enum_string_validate_enum(cls, v): if v is None: return v - if v not in ('UPPER', 'lower', ''): - raise ValueError("must validate the enum values ('UPPER', 'lower', '')") + raise ValueError("must be one of enum values ('UPPER', 'lower', '')") return v @validator('enum_string_required') def enum_string_required_validate_enum(cls, v): if v not in ('UPPER', 'lower', ''): - raise ValueError("must validate the enum values ('UPPER', 'lower', '')") + raise ValueError("must be one of enum values ('UPPER', 'lower', '')") return v @validator('enum_integer_default') def enum_integer_default_validate_enum(cls, v): if v is None: return v - if v not in (1, 5, 14): - raise ValueError("must validate the enum values (1, 5, 14)") + raise ValueError("must be one of enum values (1, 5, 14)") return v @validator('enum_integer') def enum_integer_validate_enum(cls, v): if v is None: return v - if v not in (1, -1): - raise ValueError("must validate the enum values (1, -1)") + raise ValueError("must be one of enum values (1, -1)") return v @validator('enum_number') def enum_number_validate_enum(cls, v): if v is None: return v - if v not in (1.1, -1.2): - raise ValueError("must validate the enum values (1.1, -1.2)") + raise ValueError("must be one of enum values (1.1, -1.2)") return v class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/map_test.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/map_test.py index 9d2d840b1f3..ac702eb0a7f 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/map_test.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/map_test.py @@ -37,9 +37,8 @@ class MapTest(BaseModel): def map_of_enum_string_validate_enum(cls, v): if v is None: return v - if v not in ('UPPER', 'lower'): - raise ValueError("must validate the enum values ('UPPER', 'lower')") + raise ValueError("must be one of enum values ('UPPER', 'lower')") return v class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/order.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/order.py index a6866f134eb..cdd825329e9 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/order.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/order.py @@ -39,9 +39,8 @@ class Order(BaseModel): def status_validate_enum(cls, v): if v is None: return v - if v not in ('placed', 'approved', 'delivered'): - raise ValueError("must validate the enum values ('placed', 'approved', 'delivered')") + raise ValueError("must be one of enum values ('placed', 'approved', 'delivered')") return v class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/pet.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/pet.py index a23db1e79b4..ae46c225407 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/pet.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/pet.py @@ -41,9 +41,8 @@ class Pet(BaseModel): def status_validate_enum(cls, v): if v is None: return v - if v not in ('available', 'pending', 'sold'): - raise ValueError("must validate the enum values ('available', 'pending', 'sold')") + raise ValueError("must be one of enum values ('available', 'pending', 'sold')") return v class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/special_name.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/special_name.py index 58e7a590478..e0a6c30fa77 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/special_name.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/models/special_name.py @@ -37,9 +37,8 @@ class SpecialName(BaseModel): def var_schema_validate_enum(cls, v): if v is None: return v - if v not in ('available', 'pending', 'sold'): - raise ValueError("must validate the enum values ('available', 'pending', 'sold')") + raise ValueError("must be one of enum values ('available', 'pending', 'sold')") return v class Config: diff --git a/samples/openapi3/client/petstore/python-nextgen/tests/test_model.py b/samples/openapi3/client/petstore/python-nextgen/tests/test_model.py index e437c7b6d80..3fbcbc493ac 100644 --- a/samples/openapi3/client/petstore/python-nextgen/tests/test_model.py +++ b/samples/openapi3/client/petstore/python-nextgen/tests/test_model.py @@ -319,7 +319,7 @@ class ModelTests(unittest.TestCase): self.pet.status = "error" self.assertTrue(False) # this line shouldn't execute except ValueError as e: - self.assertTrue("must validate the enum values ('available', 'pending', 'sold')" in str(e)) + self.assertTrue("must be one of enum values ('available', 'pending', 'sold')" in str(e)) def test_object_id(self): pet_ap = petstore_api.Pet(name="test name", photo_urls=["string"])