forked from loafle/openapi-generator-original
python-pydantic-v1: Keep trailing commas for enum validation tuples (#19985)
* python-pydantic-v1: Keep trailing commas for tuples when enum has just single member * Update samples * Add test for single member enums * Refactor test name
This commit is contained in:
@@ -44,7 +44,7 @@ class DefaultValue(BaseModel):
|
||||
return value
|
||||
|
||||
for i in value:
|
||||
if i not in ('success', 'failure', 'unclassified'):
|
||||
if i not in ('success', 'failure', 'unclassified',):
|
||||
raise ValueError("each list item must be one of ('success', 'failure', 'unclassified')")
|
||||
return value
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class Pet(BaseModel):
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if value not in ('available', 'pending', 'sold'):
|
||||
if value not in ('available', 'pending', 'sold',):
|
||||
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
|
||||
return value
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class Query(BaseModel):
|
||||
return value
|
||||
|
||||
for i in value:
|
||||
if i not in ('SUCCESS', 'FAILURE', 'SKIPPED'):
|
||||
if i not in ('SUCCESS', 'FAILURE', 'SKIPPED',):
|
||||
raise ValueError("each list item must be one of ('SUCCESS', 'FAILURE', 'SKIPPED')")
|
||||
return value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user