OpenAPITools / OpenAPITools/openapi-generator
[BUG] Newly generated [python-legacy] repo failing tests
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? - Tested with openapi-cli-generator tool, so tested latest published version
- Have you searched for related issues/PRs?
- What's the actual output vs expected output? Described below
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
A newly generated python repo produces python tests. For the attached example, the error is AttributeError: module 'openapi_client.models.user_response_data' has no attribute 'UserResponse_data'.
openapi-generator version
The latest version (4.3.1) has this issue, but this issue goes back to 4.2.3. 4.2.2 is the newest version that doesn't generate failing tests.
OpenAPI declaration file content or url
https://gist.github.com/davidhao3300/c9584ee864bfbc6ca3d273d5c918509f
Generation Details
openapi-generator-cli generate -g python -i {path to swagger.json}
Steps to reproduce
python3 -m venv venv
source venv/bin/activate
openapi-generator-cli generate -g python -i {path to swagger.json}
pip install -r requirements.txt
pip install -r test-requirements.txt
python -m pytest test/
Related issues/PRs
Could not find one
Suggest a fix
I haven't done a bisect beyond knowing the issue is between 4.2.2 and 4.2.3. Happy to do a bisect if openapi-generator-cli is able to point to commits instead of git tags.
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 with the attached OpenAPI declaration and reproduce using openapi-generator-cli generate -g python, then install the generated requirements and run python -m pytest test/. Compare versions 4.2.2 through 4.3.1 to locate the regression causing UserResponse_data to be referenced instead of the generated model attribute; done means the generated tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi, python
- Domain
- devtools, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100