forked from loafle/openapi-generator-original
remove options to set token
This commit is contained in:
@@ -29,17 +29,12 @@ 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 INJECTION_TOKEN_IMPORT = "injectionTokenImport";
|
||||
public static final String WITH_INTERFACES = "withInterfaces";
|
||||
public static final String NG_VERSION = "ngVersion";
|
||||
|
||||
protected String npmName = null;
|
||||
protected String npmVersion = "1.0.0";
|
||||
protected String npmRepository = null;
|
||||
protected String injectionToken = "InjectionToken<string>";
|
||||
protected String injectionTokenImport = "InjectionToken";
|
||||
protected String ngVersion = "4";
|
||||
|
||||
public TypeScriptAngular2ClientCodegen() {
|
||||
@@ -59,7 +54,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()));
|
||||
this.cliOptions.add(new CliOption(NG_VERSION, "The version of Angular (2 or 4). Default is '4'"));
|
||||
}
|
||||
@@ -97,12 +91,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);
|
||||
additionalProperties.put(INJECTION_TOKEN_IMPORT, this.injectionTokenImport);
|
||||
|
||||
if(additionalProperties.containsKey(WITH_INTERFACES)) {
|
||||
boolean withInterfaces = Boolean.parseBoolean(additionalProperties.get(WITH_INTERFACES).toString());
|
||||
if (withInterfaces) {
|
||||
@@ -369,8 +357,4 @@ public class TypeScriptAngular2ClientCodegen extends AbstractTypeScriptClientCod
|
||||
return camelize(name);
|
||||
}
|
||||
|
||||
public void setOpaqueToken() {
|
||||
this.injectionToken = "OpaqueToken";
|
||||
this.injectionTokenImport = "OpaqueToken";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "{{npmName}}",
|
||||
"version": "{{npmVersion}}",
|
||||
"description": "swagger client for {{npmName}}",
|
||||
"name": "{{{npmName}}}",
|
||||
"version": "{{{npmVersion}}}",
|
||||
"description": "swagger client for {{{npmName}}}",
|
||||
"author": "Swagger Codegen Contributors",
|
||||
"keywords": [
|
||||
"swagger-client"
|
||||
@@ -31,12 +31,12 @@
|
||||
"@angular/platform-browser": "{{#isNg2x}}^2.2.2{{/isNg2x}}{{#isNg4x}}^4.2.5{{/isNg4x}}",
|
||||
"reflect-metadata": "^0.1.3",
|
||||
"rxjs": "^5.4.0",
|
||||
"zone.js": "^0.7.6",
|
||||
"zone.js": "^0.7.6",
|
||||
"typescript": "^2.1.5"
|
||||
}{{#npmRepository}},{{/npmRepository}}
|
||||
{{#npmRepository}}
|
||||
"publishConfig":{
|
||||
"registry":"{{npmRepository}}"
|
||||
"publishConfig": {
|
||||
"registry":"{{{npmRepository}}}"
|
||||
}
|
||||
{{/npmRepository}}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { {{{injectionTokenImport}}} } from '@angular/core';
|
||||
import { {{#isNg2x}}OpaqueToken{{/isNg2x}}{{#isNg4x}}InjectionToken{{/isNg4x}} } from '@angular/core';
|
||||
|
||||
export const BASE_PATH = new {{{injectionToken}}}('basePath');
|
||||
export const BASE_PATH = new {{#isNg2x}}OpaqueToken{{/isNg2x}}{{#isNg4x}}InjectionToken<string>{{/isNg4x}}('basePath');
|
||||
export const COLLECTION_FORMATS = {
|
||||
'csv': ',',
|
||||
'tsv': ' ',
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { InjectionToken } from '@angular/core';
|
||||
import { OpaqueToken } from '@angular/core';
|
||||
|
||||
export const BASE_PATH = new InjectionToken<string>('basePath');
|
||||
export const BASE_PATH = new OpaqueToken('basePath');
|
||||
export const COLLECTION_FORMATS = {
|
||||
'csv': ',',
|
||||
'tsv': ' ',
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
"@angular/compiler": "^2.2.2",
|
||||
"core-js": "^2.4.0",
|
||||
"reflect-metadata": "^0.1.3",
|
||||
"rxjs": "^5.1.0",
|
||||
"rxjs": "^5.4.0",
|
||||
"zone.js": "^0.7.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -30,11 +30,11 @@
|
||||
"@angular/compiler": "^2.2.2",
|
||||
"@angular/platform-browser": "^2.2.2",
|
||||
"reflect-metadata": "^0.1.3",
|
||||
"rxjs": "5.1.0",
|
||||
"zone.js": "^0.7.6",
|
||||
"rxjs": "^5.4.0",
|
||||
"zone.js": "^0.7.6",
|
||||
"typescript": "^2.1.5"
|
||||
},
|
||||
"publishConfig":{
|
||||
"registry":"https://skimdb.npmjs.com/registry"
|
||||
"publishConfig": {
|
||||
"registry": "https://skimdb.npmjs.com/registry"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { InjectionToken } from '@angular/core';
|
||||
import { OpaqueToken } from '@angular/core';
|
||||
|
||||
export const BASE_PATH = new InjectionToken<string>('basePath');
|
||||
export const BASE_PATH = new OpaqueToken('basePath');
|
||||
export const COLLECTION_FORMATS = {
|
||||
'csv': ',',
|
||||
'tsv': ' ',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { InjectionToken } from '@angular/core';
|
||||
import { OpaqueToken } from '@angular/core';
|
||||
|
||||
export const BASE_PATH = new InjectionToken<string>('basePath');
|
||||
export const BASE_PATH = new OpaqueToken('basePath');
|
||||
export const COLLECTION_FORMATS = {
|
||||
'csv': ',',
|
||||
'tsv': ' ',
|
||||
|
||||
Reference in New Issue
Block a user