-
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] Bug ModuleWithProviders missing generic type for Angular 10 #10417
Comments
Hey, do we really need to support Angular < 6.1.x? Your solution seems to work, so push it please. |
The typescript-angular generator maintenance could be better. There are only samples up to Angular 6. Version 7 was released almost 2 years ago. There is a fork of this project called OpenAPI Generator which has samples up to Angular 9. I'm using it with Angular 10 and it is working great. |
Same problem here, just migrated to Angular 10 and found that we have to change the auto-generated code to make it work :-( Edit: I have tried the OpenAPITools generator 5.0 0-beta2 and it looks like working, still have to make further tests but the code generated compiles in Angular 10. |
As a workaround, I am running the following command after generating the typescript-angular client: sed -i 's/ModuleWithProviders {/ModuleWithProviders<ApiModule> {/' <path_to_generated_folder>/api.module.ts This is the same approach as a workaround for #8836 |
Make ModuleWithProviders generic for all Angular version >= 10 because it is mandatory. Fixes swagger-api#10417 Signed-off-by: Christian Köberl <christian.koeberl@porscheinformatik.com>
Description
ModuleWithProviders without a generic type is deprecated since Angular 9 and mandatory since Angular 10:
See: angular/angular@20cc3ab
Swagger-codegen version
3.0.21
Steps to reproduce
Using the generated code (without npm) in an Angular 10 project leads to a TypeScript error and the application not compiling.
Suggest a fix/enhancement
Change
ModuleWithProviders
toModuleWithProviders<ApiModule>
to:swagger-codegen/modules/swagger-codegen/src/main/resources/typescript-angular/api.module.mustache
Line 21 in e6d69ab
Edit:
Looks like the option to add a generic type was added in Angular 6.1.0, so my solution breaks earlier versions.
angular/angular@60aeee7#diff-968ca8dead1eca4223cb534b9f0b9c02R79
The text was updated successfully, but these errors were encountered: