Open davinchia opened 4 years ago
I have this same issue. I don't want the access token to be global and so reading the generated code, it looks like I need to do something like this, nonintuitively. config = MyService::Configuration.new( access_token: "some-token" ) api = MyService::DefaultApi.new(MyService::ApiClient.new(config))
Bug Report Checklist
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.