Skip to content

Commit 1271dee

Browse files
committed
fix(python) str non-str values before validating with regex
1 parent e1513f7 commit 1271dee

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

modules/openapi-generator/src/main/resources/python/model_generic.mustache

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
5353

5454
{{/isNullable}}
5555
{{/required}}
56+
if not isinstance(value, str):
57+
value = str(value)
58+
5659
if not re.match(r"{{{.}}}", value{{#vendorExtensions.x-modifiers}} ,re.{{{.}}}{{/vendorExtensions.x-modifiers}}):
5760
raise ValueError(r"must validate the regular expression {{{vendorExtensions.x-pattern}}}")
5861
return value

0 commit comments

Comments
 (0)