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.36k stars 6.46k forks source link

[REQ] [JAVA] [resttemplate] [webclient] option to disable auto instantiation of Components #13362

Open z06lsouc opened 2 years ago

z06lsouc commented 2 years ago

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

I'm using openapi-generator to generate a lib (not an app) with continuous integration of an API definition. The issue is that my lib must provide multiple clients of the same API with different basePath and dynamically generated headers. I can't rely on the autowired components generated because there is only one ApiClient and one suite of APIs instanciated. Also ApiClient takes the default RestTemplate bean in the ApplicationContext meaning no API specific header is possible without conflict issues. This last part is quite problematic as it applies for any project that would need multiple ApiClient within the same app.

Describe the solution you'd like

An option to disable the generation of the @Component and @Autowire annotations on the ApiClient and APIs classes for springboot related librairies.

Describe alternatives you've considered

Use sed to hack into the generated classes and remove the annotations...

delps1001 commented 11 months ago

I would appreciate this enhancement as well! Basically the same as #14832 but for web client instead of rest template.