Skip to content

Commit f59e289

Browse files
committed
fix(python-linter): regex pattern caused linter issues
Signed-off-by: Alexander Dahmen <[email protected]>
1 parent ec3ed8b commit f59e289

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

templates/python/model_oneof.mustache

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
2020
"""
2121
{{#composedSchemas.oneOf}}
2222
# data type: {{{dataType}}}
23+
# BEGIN of the workaround until upstream issues are fixed:
24+
# https://github.com/OpenAPITools/openapi-generator/issues/19034 from Jun 28, 2024
25+
# and https://github.com/OpenAPITools/openapi-generator/issues/19842 from Oct 11, 2024
26+
# Tracking issue on our side: https://jira.schwarz/browse/STACKITSDK-227
2327
{{#isString}}
24-
{{vendorExtensions.x-py-name}}: Optional[Annotated[{{{dataType}}}, Field(strict=True)]] = Field(default=None, description="{{{description}}}"{{#pattern}}, pattern=re.sub(r'^\/|\/$', '',"{{.}}"){{/pattern}})
28+
{{vendorExtensions.x-py-name}}: Optional[Annotated[{{{dataType}}}, Field(strict=True)]] = Field(default=None, description="{{{description}}}"{{#pattern}},
29+
pattern=re.sub(r'^\/|\/$', '',r"{{.}}"){{/pattern}})
2530
{{/isString}}
2631
{{^isString}}
2732
{{vendorExtensions.x-py-name}}: {{{vendorExtensions.x-py-typing}}}
2833
{{/isString}}
34+
# END of the workaround
2935
{{/composedSchemas.oneOf}}
3036
actual_instance: Optional[Union[{{#oneOf}}{{{.}}}{{^-last}}, {{/-last}}{{/oneOf}}]] = None
3137
one_of_schemas: Set[str] = { {{#oneOf}}"{{.}}"{{^-last}}, {{/-last}}{{/oneOf}} }

0 commit comments

Comments
 (0)