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

[Typecscript-angular2] import Injection Token for BASE_PATH not correct [2.2.3-SNAPSHOT]

Open sidebaet opened this issue 9 years ago • 0 comments

Hi,

I use swagger-codegen 2.2.3-SNAPSHOT and I have an issue with typescript-angular2 generated client. In the file variable.ts I have the following :

`import { InjectionToken } from '@angular/core';

export const BASE_PATH = new InjectionToken('basePath'); export const COLLECTION_FORMATS = { 'csv': ',', 'tsv': ' ', 'ssv': ' ', 'pipes': '|' }`

The first line is not correct and should be import { InjectionToken } from '@angular/core';

To fix this, I think that we need to change:

  • In file TypeScriptAngular2ClientCodegen line 35 protected String injectionToken = "InjectionToken<string>"; to protected String injectionToken = "InjectionToken";
  • And file \typescript-angular2\variables.mustache should be: `import { {{{injectionToken}}} } from '@angular/core';

export const BASE_PATH = new {{{injectionToken}}}('basePath'); export const COLLECTION_FORMATS = { 'csv': ',', 'tsv': ' ', 'ssv': ' ', 'pipes': '|' }`

Could you have a look ?

Many thanks :) Simon

sidebaet avatar May 17 '17 11:05 sidebaet