forked from loafle/openapi-generator-original
Update model_generic.mustache, tuple notation breaks when there is only one element in the tuple (#17749)
* Update model_generic.mustache, tuple notation breaks when there is only one element in the tuple
In this excerpt of the mustache template, the matching behaviour is bugged when there is only one element in the tuple notation. A single string with the tuple notation, e.g., `("string")`, will result in a string, and when values are compared with the string, it will do a `contains` match instead of an exact match, which is unintended behaviour.
* Update with samples, step 3
* Add test spec and regenerate samples
* Update samples
* Update spec and samples
* update samples
---------
Co-authored-by: Edmund Loo <edmundloo@users.noreply.github.com>
Co-authored-by: Edmund Loo <github.yn0u9@simplelogin.com>
This commit is contained in:
@@ -45,7 +45,7 @@ class DefaultValue(BaseModel):
|
||||
return value
|
||||
|
||||
for i in value:
|
||||
if i not in ('success', 'failure', 'unclassified'):
|
||||
if i not in set(['success', 'failure', 'unclassified']):
|
||||
raise ValueError("each list item must be one of ('success', 'failure', 'unclassified')")
|
||||
return value
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ class Pet(BaseModel):
|
||||
if value is None:
|
||||
return value
|
||||
|
||||
if value not in ('available', 'pending', 'sold'):
|
||||
if value not in set(['available', 'pending', 'sold']):
|
||||
raise ValueError("must be one of enum values ('available', 'pending', 'sold')")
|
||||
return value
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class Query(BaseModel):
|
||||
return value
|
||||
|
||||
for i in value:
|
||||
if i not in ('SUCCESS', 'FAILURE', 'SKIPPED'):
|
||||
if i not in set(['SUCCESS', 'FAILURE', 'SKIPPED']):
|
||||
raise ValueError("each list item must be one of ('SUCCESS', 'FAILURE', 'SKIPPED')")
|
||||
return value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user