OpenAPITools / OpenAPITools/openapi-generator
[REQ][Ruby] Override header params by passing options from client
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
I want to pass header AUTHORIZATION token and Accept per request by passing it as an option from the generated client. Here is an example in ruby
api_client = DefaultApiClient.new
api_client.get_pet(pet_id: 'abc', header_params: {'Authorization' => 'Bearer', 'Accept' => 'text/html'})
Describe the solution you'd like
If I pass any header params from client it should not be overridden.
Update the template before this line so
next unless header_params[auth_setting[:key]].to_s.strip.empty?
Describe alternatives you've considered
Two things that we can do now as an alternative but none of them are ideal
- Override auth_settings method on config object.
- Pass option
debug_auth_namesfrom 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
Start with the linked samples/client/petstore/ruby/lib/petstore/api_client.rb lines 307-312, then locate the generator template that produces this section. Check how per-request header_params are handled around the auth-setting condition, and verify that generated Ruby clients preserve explicitly supplied Authorization and Accept headers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100