diff --git a/modules/openapi-generator/src/main/resources/python-flask/model.mustache b/modules/openapi-generator/src/main/resources/python-flask/model.mustache index 47394704bf96..bf1818f6c104 100644 --- a/modules/openapi-generator/src/main/resources/python-flask/model.mustache +++ b/modules/openapi-generator/src/main/resources/python-flask/model.mustache @@ -147,7 +147,7 @@ class {{classname}}(Model): {{/minimum}} {{#pattern}} if {{name}} is not None and not re.search(r'{{{vendorExtensions.x-regex}}}', {{name}}{{#vendorExtensions.x-modifiers}}{{#-first}}, flags={{/-first}}re.{{.}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}): # noqa: E501 - raise ValueError("Invalid value for `{{name}}`, must be a follow pattern or equal to `{{{pattern}}}`") # noqa: E501 + raise ValueError(r"Invalid value for `{{name}}`, must be a follow pattern or equal to `{{{pattern}}}`") # noqa: E501 {{/pattern}} {{#maxItems}} if {{name}} is not None and len({{name}}) > {{maxItems}}: diff --git a/samples/server/petstore/python-flask/openapi_server/models/category.py b/samples/server/petstore/python-flask/openapi_server/models/category.py index 233e4db0d421..9f9805e6f38f 100644 --- a/samples/server/petstore/python-flask/openapi_server/models/category.py +++ b/samples/server/petstore/python-flask/openapi_server/models/category.py @@ -86,6 +86,6 @@ def name(self, name: str): :type name: str """ if name is not None and not re.search(r'^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$', name): # noqa: E501 - raise ValueError("Invalid value for `name`, must be a follow pattern or equal to `/^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$/`") # noqa: E501 + raise ValueError(r"Invalid value for `name`, must be a follow pattern or equal to `/^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$/`") # noqa: E501 self._name = name