openapi-generator
openapi-generator copied to clipboard
[BUG][PYTHON] Generated files have simple syntax errors from unescaped quotes
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
- Download the minimal reproduction from the gist link.
- Run the command in "Generation Details". (
${PWD}
is a PowerShell construction, substitute your own working directory if necessary.) - Inspect
openapi-client/openapi_client/api/sample_api.py
- 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.