mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-03 00:43:46 +00:00
[python-nextgen] Fix validation of list of enums (#14809)
* [python-nextgen] check enum arrady values better * [python-nextgen] re-generate exapmles for #14809
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user