diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java index afcf3bdaadc9..8fe2e2d849b0 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/TypeScriptAngular2ClientCodegen.java @@ -26,14 +26,11 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod public static final String NPM_VERSION = "npmVersion"; public static final String NPM_REPOSITORY = "npmRepository"; public static final String SNAPSHOT = "snapshot"; - public static final String USE_OPAQUE_TOKEN = "useOpaqueToken"; - public static final String INJECTION_TOKEN = "injectionToken"; public static final String WITH_INTERFACES = "withInterfaces"; protected String npmName = null; protected String npmVersion = "1.0.0"; protected String npmRepository = null; - protected String injectionToken = "InjectionToken"; public TypeScriptAngular2ClientCodegen() { super(); @@ -51,7 +48,6 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package")); this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json")); this.cliOptions.add(new CliOption(SNAPSHOT, "When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString())); - this.cliOptions.add(new CliOption(USE_OPAQUE_TOKEN, "When setting this property to true, OpaqueToken is used instead of InjectionToken", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString())); this.cliOptions.add(new CliOption(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", BooleanProperty.TYPE).defaultValue(Boolean.FALSE.toString())); } @@ -86,11 +82,6 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod addNpmPackageGeneration(); } - if(additionalProperties.containsKey(USE_OPAQUE_TOKEN) && Boolean.valueOf(additionalProperties.get(USE_OPAQUE_TOKEN).toString())) { - this.setOpaqueToken(); - } - additionalProperties.put(INJECTION_TOKEN, this.injectionToken); - if(additionalProperties.containsKey(WITH_INTERFACES)) { boolean withInterfaces = Boolean.parseBoolean(additionalProperties.get(WITH_INTERFACES).toString()); if (withInterfaces) { @@ -253,7 +244,4 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod this.npmRepository = npmRepository; } - public void setOpaqueToken() { - this.injectionToken = "OpaqueToken"; - } } diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache index 2f3b55bbccff..eac59ada743a 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache @@ -133,14 +133,14 @@ export class {{classname}} { // to determine the Content-Type header let consumes: string[] = [ {{#consumes}} - '{{{mediaType}}}'{{#hasMore}}, {{/hasMore}} + '{{{mediaType}}}'{{#hasMore}},{{/hasMore}} {{/consumes}} ]; // to determine the Accept header let produces: string[] = [ {{#produces}} - '{{{mediaType}}}'{{#hasMore}}, {{/hasMore}} + '{{{mediaType}}}'{{#hasMore}},{{/hasMore}} {{/produces}} ]; diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular2/variables.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular2/variables.mustache index f5cdcf76e945..29b7e5b1d716 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/variables.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/variables.mustache @@ -1,9 +1,9 @@ -import { {{{injectionToken}}} } from '@angular/core'; +import { OpaqueToken } from '@angular/core'; -export const BASE_PATH = new {{{injectionToken}}}('basePath'); +export const BASE_PATH = new OpaqueToken('basePath'); export const COLLECTION_FORMATS = { 'csv': ',', 'tsv': ' ', 'ssv': ' ', 'pipes': '|' -} \ No newline at end of file +} diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java index f7d430c1f4cb..fd5961b99bd3 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/options/TypeScriptAngular2ClientOptionsProvider.java @@ -36,7 +36,6 @@ public class TypeScriptAngular2ClientOptionsProvider implements OptionsProvider .put(TypeScriptAngular2ClientCodegen.WITH_INTERFACES, Boolean.FALSE.toString()) .put(TypeScriptAngular2ClientCodegen.NPM_REPOSITORY, NPM_REPOSITORY) .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) - .put(TypeScriptAngular2ClientCodegen.USE_OPAQUE_TOKEN, Boolean.FALSE.toString()) .build(); } diff --git a/samples/client/petstore/typescript-angular2/default/variables.ts b/samples/client/petstore/typescript-angular2/default/variables.ts index b734b2e59182..29b7e5b1d716 100644 --- a/samples/client/petstore/typescript-angular2/default/variables.ts +++ b/samples/client/petstore/typescript-angular2/default/variables.ts @@ -1,9 +1,9 @@ -import { InjectionToken } from '@angular/core'; +import { OpaqueToken } from '@angular/core'; -export const BASE_PATH = new InjectionToken('basePath'); +export const BASE_PATH = new OpaqueToken('basePath'); export const COLLECTION_FORMATS = { 'csv': ',', 'tsv': ' ', 'ssv': ' ', 'pipes': '|' -} \ No newline at end of file +} diff --git a/samples/client/petstore/typescript-angular2/npm/variables.ts b/samples/client/petstore/typescript-angular2/npm/variables.ts index b734b2e59182..29b7e5b1d716 100644 --- a/samples/client/petstore/typescript-angular2/npm/variables.ts +++ b/samples/client/petstore/typescript-angular2/npm/variables.ts @@ -1,9 +1,9 @@ -import { InjectionToken } from '@angular/core'; +import { OpaqueToken } from '@angular/core'; -export const BASE_PATH = new InjectionToken('basePath'); +export const BASE_PATH = new OpaqueToken('basePath'); export const COLLECTION_FORMATS = { 'csv': ',', 'tsv': ' ', 'ssv': ' ', 'pipes': '|' -} \ No newline at end of file +} diff --git a/samples/client/petstore/typescript-angular2/with-interfaces/variables.ts b/samples/client/petstore/typescript-angular2/with-interfaces/variables.ts index b734b2e59182..29b7e5b1d716 100644 --- a/samples/client/petstore/typescript-angular2/with-interfaces/variables.ts +++ b/samples/client/petstore/typescript-angular2/with-interfaces/variables.ts @@ -1,9 +1,9 @@ -import { InjectionToken } from '@angular/core'; +import { OpaqueToken } from '@angular/core'; -export const BASE_PATH = new InjectionToken('basePath'); +export const BASE_PATH = new OpaqueToken('basePath'); export const COLLECTION_FORMATS = { 'csv': ',', 'tsv': ' ', 'ssv': ' ', 'pipes': '|' -} \ No newline at end of file +}