swagger-api / swagger-api/swagger-codegen
Python client with codegen 2.3.0 does not include api_client attribute in configuration which breaks tests after generation
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When generating python client with codegen 2.3.0, the Configuration class does not initialize an api_client attribute. This attribute is expected in the DefaultApi class initialization and hence fails the tests we are trying to run via CI automation.
This issue does not exist in 2.2.3 and has been tested and verified for the same OpenAPI spec.
Swagger-codegen version
2.3.0
Swagger declaration file content or url
Unfortunately the spec file is in a private repository right now so cannot be shared.
Command line used for generation
swagger-codegen generate -i api.yaml -l python -o python_client/ -c config/python.json
Steps to reproduce
- Create the python_client and
- Run the unit tests which would initialize the client.
This would fail because of "config object has no attribute api_client"
Related issues/PRs
Suggest a fix/enhancement
Either initialize the api_client in configuration if it is in use, or otherwise remove the instances of config.api_client from DefaultApi class.
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
Generate a Python client with the shown swagger-codegen command, then inspect the generated Configuration and DefaultApi classes and run the generated unit tests. Confirm the missing api_client attribute and compare generation with version 2.2.3; done means the generated client initializes successfully and its tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100