-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[typescript-angular] service configuration/basePath modification after construction #7949
Comments
@chrismellard I would say your solution of extending the service and updating the basePath from an observable sounds reasonable. Moreover, In order to allow this behavior without having to extend the generated services, I would suggest to have a |
I have a PR ready to go if you're interested that is injecting an optional injection token The benefit here above and beyond a setBasePath method (if I understand your proposal correctly) is that I can let DI take of the problem for me - so long as I create an |
@chrismellard ok sounds good. please open a PR |
This would be neat to have. Where are we on the PR? |
@crhistianramirez I'll merge from master and push it up later today. |
Description
From what I can tell I cannot achieve what I describe below with current versions of codegen - I'm prepared to stand corrected ;)
A nice feature to have for typescript-angular would be the ability to modify configuration settings on the client stubs after the services have been constructed. Currently, basePath is set on service construction and remain impossible to modify for the lifetime of that service once the constructor has completed. There are scenarios where when using ngrx/effects where swagger services can be injected prior to APP_INITIALIZER completing. It would therefore be nice to have the ability to modify the api service configuration post construction.
Swagger-codegen version
Whatever dockerhub - swaggerapi/swagger-codegen-cli:latest is currently building - this is unclear from the docker hub info.
Suggest a fix/enhancement
I've currently worked around this by extending the generated angular service and injecting a BehaviorSubject of Configuration. The api service subscribes to changes to this stream and updates its configuration/basePath as appropriate. There's obviously a reason the existing basePath property is defined as protected rather than public so I'm clearly circumventing this for my own evil needs.
The text was updated successfully, but these errors were encountered: