OpenAPITools / OpenAPITools/openapi-generator
[BUG] Ruby Client generates docs that encourage bad client configuration.
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)?
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Bounty to sponsor the fix (example)
Description
The ruby client documentation encourages the use of the default client constructor. This is fine in most cases, but does carry the caveat that the default constructor will use the later given access_token across all threads. Passing access_token to constructors avoids this.
This is because the configure method modifies a @@default variable which is passed as the default argument to the initialize method for DefaultApi.
Not a ruby expert - so can't comment on whether the generated code follows the right ruby patterns/conventions. I do think this can be avoided with tweaks in the documentation that accompanies the generated client.
openapi-generator version
Using 4.2.1.
OpenAPI declaration file content or url
NA.
Command line used for generation
NA.
Steps to reproduce
Generate any client and look at the rendered documentation.
Related issues/PRs
Checked. Unclear from my 10 mins search.
Suggest a fix
Not an expert on the ruby generation bit of this codebase. Open to pointers. Filing an issue for myself now. Will likely get to it when I have some time.
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 any Ruby client and inspect its rendered documentation, then trace the configure method and DefaultApi initialize behavior described in the report. The work is done when the documentation no longer encourages the shared default constructor and instead explains passing access_token to constructors to avoid cross-thread configuration issues.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, ruby
- Domain
- api, documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100