[BUG] Python pattern re.search('r incorrect in generated server model
Created by: nathan5280
Generators aren't consistently escaping the regex patterns for python and python-flask.
Description
openapi-codegen python and python-flask generate different regex escapes.
Generated Client
if business_addr_zip is not None and not re.search(r'^\d{5}(?:[-\s]\d{4})?$', business_addr_zip): # noqa: E501
Generated Server
if business_addr_zip is not None and not re.search(r'^\\d{5}(?:[-\\s]\\d{4})?$', business_addr_zip): # noqa: E501
The client seems fine, but the server is double escaped.
openapi-generator version
docker image https://hub.docker.com/r/openapitools/openapi-generator-cli/
OpenAPI declaration file content or url
Specification:
PlaceQuery:
properties:
data:
properties:
entity_name:
type: string
physical_address:
properties:
business_addr_zip:
pattern: ^\d{5}(?:[-\s]\d{4})?$
type: string
required:
- business_addr_zip
type: object
required:
- entity_name
- physical_address
type: object
required:
- data
type: object