mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-18 20:57:06 +00:00
[python] Check if the given input is a container (Array or Map) when validating enum values (#19316)
* checks if input is Array or Map in validate_enum * update samples
This commit is contained in:
@@ -38,8 +38,9 @@ class MapTest(BaseModel):
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if value not in set(['UPPER', 'lower']):
|
||||
raise ValueError("must be one of enum values ('UPPER', 'lower')")
|
||||
for i in value.values():
|
||||
if i not in set(['UPPER', 'lower']):
|
||||
raise ValueError("dict values must be one of enum values ('UPPER', 'lower')")
|
||||
return value
|
||||
|
||||
model_config = ConfigDict(
|
||||
|
||||
Reference in New Issue
Block a user