OpenAPITools / OpenAPITools/openapi-generator
[BUG][Python] Syntax Error when importing generated library
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
Description
Similar error as #17447, tested on both latest stable version 7.3.0 and latest master branch commit.
openapi-generator version
7.3.0
OpenAPI declaration file content or url
https://github.com/Endgrate/OpenAPI
Generation Details
Steps to reproduce
Copy OpenAPI spec
Run
openapi-generator-cli generate -g python -o test --additional-properties=projectName=endgrate,packageName=endgrate --openapi-normalizer SET_TAGS_FOR_ALL_OPERATIONS=endgrate -i OpenAPI/openapi.yaml
Install
pip install -e test
Import in Python
import endgrate
Gives:
line 26
from endgrate.models.dict[str,_configuration_callback_schema_passthrough_schemas_value] import Dict[str, ConfigurationCallbackSchemaPassthroughSchemasValue]
^
SyntaxError: invalid syntax
Related issues/PRs
#17447, seems like #17659 did not handle all edge cases? Does this have to do with beta support for OpenAPI 3.1?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the stated openapi-generator command with OpenAPI/openapi.yaml, then install the generated test package and reproduce the import failure. Inspect how the Python generator turns the schema into the generated model import shown in the traceback; done means the generated library installs and import endgrate completes without a SyntaxError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, python
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100