openapi-generators / openapi-generators/openapi-python-client
Auto generated use of the client with context manager is wrong
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2k
- Forks
- 293
- Avg merge
- 34m
- Merged PRs (30d)
- 1
Description
There should be a new instance every time we use the with statement. because if not the next time you use the client you'll get "Cannot reopen a client instance, once it has been closed."
Like in this example you should write in the docs:
with Client(base_url="Somthing") as client:
and not:
with client as client:
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
The issue names no repository file or test; start by locating the generated Client context-manager template and the documentation example, then compare them with the linked HTTPX example. Done means the generated usage and docs consistently show a fresh client for each with statement, with any relevant regression check passing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100