openapi-generator icon indicating copy to clipboard operation
openapi-generator copied to clipboard

[BUG][PYTHON] Generated files have simple syntax errors from unescaped quotes

Open syntaxaire opened this issue 2 years ago • 0 comments

Bug Report Checklist

  • [x] Have you provided a full/minimal spec to reproduce the issue?
  • [x] Have you validated the input using an OpenAPI validator (example)?
  • [x] Have you tested with the latest master to confirm the issue still exists?
  • [x] Have you searched for related issues/PRs?
  • [x] What's the actual output vs expected output?
Description

The Python files produced by this OpenAPI spec have syntax errors that make them impossible to run without editing.

openapi-generator version

Latest

OpenAPI declaration file content or url

Minimal reproduction: https://gist.github.com/syntaxaire/6469bbbc7f866918eea0143343f38638

Generation Details

docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:latest generate --global-property skipFormModel=false -i /local/openapi.json -g python -o /local/openapi-client

Steps to reproduce
  1. Download the minimal reproduction from the gist link.
  2. Run the command in "Generation Details". (${PWD} is a PowerShell construction, substitute your own working directory if necessary.)
  3. Inspect openapi-client/openapi_client/api/sample_api.py
  4. Line 66 has a syntax error:
                'allowed_values': {
                    ('close',): {

                        "">DATE",": "">DATE","
                    },
                },

There are extra quotation marks that make the file unparseable. In the OpenAPI spec, they were escaped but here they are not.

syntaxaire avatar Sep 07 '22 15:09 syntaxaire