OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.48k stars 6.5k forks source link

[REQ][typescript] Enable header override at request time #18846

Open davidgamero opened 4 months ago

davidgamero commented 4 months ago

Is your feature request related to a problem? Please describe.

When making requests, the current options only allow passing in a full Configuration, but for cases like supplying a Content-Type for a JSON Merges it would be much easier to allow passing an additional header when making a request

Describe the solution you'd like

Adding an additional input, or overloading the optional _options?: Configuration parameter for generated operations

Alternatively, allow supplying custom middleware at request time, which would provide a more potentially more flexible solution, and allow the existing middleware implementation to handle the header override

Describe alternatives you've considered

The current approach has been to re-created a fully new Configuration from an existing one each time we want to change a header, and then supply the header addition as a middleware. We could continue to modify the entire configuration per-request, continuing to rely on internals instead of using a dedicated per-request mechanism

Additional context

Thread from kubernetes-client/javascript discussion: https://github.com/kubernetes-client/javascript/issues/754#issuecomment-2004562303