swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

[Angular 4+] [Typescript Client] OpaqueToken deprecated in Angular 4

Open iblocks-Xander opened this issue 9 years ago • 4 comments

Description

OpaqueToken is deprecated in Angular 4 and will be removed in 2 versions according to the Angular deprecation policy. InjectionToken

Swagger-codegen version

2.2.2

Steps to reproduce

Use PetStore example to generate Angular2TypescriptClient

Related issues

https://github.com/angular/angular/issues/14763

Suggest a Fix

Simply changing the type from OpaqueToken to InjectionToken<string> will work, however, this is will break Angular 2 clients, so I am unsure of how to approach this. Should it be a command line flag on the Angular client build or should it be a separate client?

iblocks-Xander avatar May 05 '17 11:05 iblocks-Xander

@iblocks-Xander CC @wing328 How about providing command line option like useOpaqueToken? If this option is provided as true, generator will use OpaqueToken as it does now. If this option is not provided or provided as false, it will use InjectionToken<string>.

taxpon avatar May 05 '17 14:05 taxpon

@iblocks-Xander please pull the latest master to give it a try.

Thanks for the PR from @taxpon

wing328 avatar May 08 '17 13:05 wing328

@wing328 Works for me. Although I wonder whether the default should be OpaqueToken rather than InjectionToken, just so updating does break existing workflows.

Thanks for the PR @taxpon

iblocks-Xander avatar May 12 '17 09:05 iblocks-Xander

@iblocks-Xander what about setting the default to "OpaqueToken" in current master and "InJectionToken" in 2.3.0 (a branch with breaking changes)?

wing328 avatar May 12 '17 13:05 wing328