"DeprecationWarning: invalid escape sequence \d" while using OpenAPI generator

Viewed 181

I'm using OpenAPI Swagger 'python-flask' generator to generate server code. My YAML contains:

  properties:
    value:
      type: string
      format: decimal
      pattern: '^\d+([.]\d+)?$'

Generating with:

npx @openapitools/openapi-generator-cli  \
    generate \
    -i "$OPEN_API_YAML" \
    -g python-flask  \
    -o gen/python-flask \
    --additional-properties=packageName=my_server

Generated python code produces deprecation warnings, like this:

DeprecationWarning: invalid escape sequence \d
raise ValueError("Invalid value for `value`, must be a follow pattern or equal to `/^\d+([.]\d+)?$/`")  # noqa: E501

I have a tons of such attributes and get a tons of such warnings :(

My question: how can I prevent these warnings from showing up?

I'm using python 3.6.9

0 Answers
Related