- OpenAPI client generation module generates client-code(ApiClient-RestTemplate and APISpecificClient which uses ApiClient)
- The contract is always strict. Ex: I have to specify in:header in:path in:query for the etc... for API request and response.
- My requirement is apart from what the yml-contract says, I need to send additional headers as part of request. This is needed because sometimes engineers expect new-headers as part of their API and they don't update APISpec or Architect decides to ignore common-used-headers(Architect specifies additional headers are mentioned in WIKI).
- Simple solution is, as a Engineer I can update the yml-contract and all good to go.
- Alternate best solution is, if the ApiClient-APISpecificClient(codegen) accepts a additional header as Map, it solves a lot of problem... Note1: ApiClient supports addDefaultHeader, but this is wrong. Because value for defaultHeader is specific to each request, so I cannot use this. Note2: I can create new object of ApiClient/APISpecificClient for each request instead of "Component", this also solves the problem. But I feel it is heavy to create objects.
Any help would be appreciated.