swagger-api / swagger-api/swagger-codegen-generators
[Python] API Key sharing between Configuration instances (port the 2.x fix)
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 299
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
Description
Swagger-codegen version
3.0.22
In 3.0.x the instances of the Configuration Python class generated still share the api_key. This has been fixed in 2.4: https://github.com/swagger-api/swagger-codegen/issues/9117
Steps to reproduce
I confirmed that, after creating 2 instances of Configuration changing the content of the api_key dict on one instance changes its content in the other:
>>> from my_client import Configuration
>>> c1 = Configuration()
>>> c1.api_key['Authorization'] = "c1 auth"
>>> c2 = Configuration()
>>> c2.api_key['Authorization'] = "c2 auth"
>>> for c in [c1, c2]:
... print(c.api_key)
...
{'Authorization': 'c2 auth'}
{'Authorization': 'c2 auth'}
Related issues/PRs
https://github.com/swagger-api/swagger-codegen/issues/9117
Suggest a fix/enhancement
The fix for https://github.com/swagger-api/swagger-codegen/issues/9117 (https://github.com/swagger-api/swagger-codegen/pull/9130) could conceivably be ported to 3.0.0.
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 generated Python Configuration class and compare its api_key handling with the 2.4 fix in issue #9117 and pull request #9130. Reproduce the two-instance example from this issue; done means changing one instance's api_key no longer changes the other.
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
- 30/100