Skip to content
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

Templatized ModuleWithProviders in typescript-angular #730

Merged

Conversation

bezineb5
Copy link
Contributor

The call ModuleWithProviders requires a template: https://angular.io/api/core/ModuleWithProviders
Apparently, in Angular 10, this is strictly enforced

The call ModuleWithProviders requires a template: https://angular.io/api/core/ModuleWithProviders
Apparently, in Angular 10, this is strictly enforced
@@ -18,7 +18,7 @@ import { {{classname}} } from './{{importPath}}';
{{/hasMore}}{{/apis}}{{/apiInfo}} ]
})
export class ApiModule {
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders {
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders<ApiModule> {
Copy link

@jose-hernandez-iop jose-hernandez-iop Nov 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that for consistency with V2 and to allow backwards compatibility with versions of Angular <10 this should be:

public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders{{#genericModuleWithProviders}}<ApiModule>{{/genericModuleWithProviders}} {

To enable the change during code generation you would need to add a property to the Maven build:

<configuration>
    <language>typescript-angular</language>
    <additionalProperties>
        <additionalProperty>ngVersion=10.2.0</additionalProperty>
        <additionalProperty>genericModuleWithProviders=true</additionalProperty>
    </additionalProperties>
</configuration>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback!
I actually copied the method from swagger-api/swagger-codegen#10464 which automatically sets genericModuleWithProviders if angular is >= 7.

@jose-hernandez-iop
Copy link

@HugoMario any chance this PR could be merged in?

@raman-nbg
Copy link

Why is this not merged? With Angular 12 it is not possible to use ModuleWithProviders without generic type parameter.

@lab900-simon-dethuin
Copy link

Can we get this merged?

@doraemoncito
Copy link

It would be good to see this change merged in. The swagger generator for Angular is really falling behind the current version of Angular.

@KillDozerX2
Copy link

Why is this PR still not merged?

@hbtjma
Copy link

hbtjma commented Jul 21, 2021

Who is responsible for typescript-angular and is this person still active? What would I have to do, in order to overwrite the respective template manually? I tried it with option -t but to no avail.

@HugoMario
Copy link
Contributor

Thanks for PR, and sorry for this big delay :/

@HugoMario HugoMario merged commit 78ce303 into swagger-api:master Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants