cyclosproject / ng-openapi-gen

An OpenAPI 3.0 codegen for Angular
MIT License
397 stars 132 forks source link

Not able to modify the root url on a client provided by an imported library #298

Closed cvarona closed 11 months ago

cvarona commented 11 months ago

Hi,

it's being impossible for me to programatically modify the generated client's root url in my application.

Environment:

Despite the generated client's configuration class's injection being marked as 'provided in root' I will get a different, newly created instance in my app component, which will render any attempt to modify the root url for all generated and imported services meaningless.

Even if a generate a module (RestClientModule) and configure it upon bootstrapping: importProvidersFrom(RestClientModule.forRoot({rootUrl: environment.aDifferentRootUrl})) the problem will still be the same.

Any idea about how to circumvent this other than setting the url in the library itself?

Regards

luisfpg commented 11 months ago

I've never tried such a setup. Can you share an example project that reproduces the issue?

cvarona commented 11 months ago

Sure!

Ooops. When preparing the bundle for uploading I realized it was a wrong import that was causing the issue. I had neglected to export the api configuration class in the public api, so the class was being directly fetched from the source folder rather than from the output folder (dist). When done ok it works perfectly, both with and without a module.

Sorry for the false alarm!

Regards