forked from loafle/openapi-generator-original
fix issue 7048 (#7108)
This commit is contained in:
parent
a7da5d8098
commit
b0f61f394c
@ -51,12 +51,16 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
|
|||||||
apiPackage = "api";
|
apiPackage = "api";
|
||||||
modelPackage = "model";
|
modelPackage = "model";
|
||||||
|
|
||||||
|
|
||||||
this.cliOptions.add(new CliOption(NPM_NAME, "The name under which you want to publish generated npm package"));
|
this.cliOptions.add(new CliOption(NPM_NAME, "The name under which you want to publish generated npm package"));
|
||||||
this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package"));
|
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(NPM_REPOSITORY,
|
||||||
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()));
|
"Use this property to set an url your private npmRepo in the package.json"));
|
||||||
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(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(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. Default is '4.3'"));
|
this.cliOptions.add(new CliOption(NG_VERSION, "The version of Angular. Default is '4.3'"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,11 +83,12 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
|
|||||||
@Override
|
@Override
|
||||||
public void processOpts() {
|
public void processOpts() {
|
||||||
super.processOpts();
|
super.processOpts();
|
||||||
supportingFiles.add(new SupportingFile("models.mustache", modelPackage().replace('.', File.separatorChar), "models.ts"));
|
supportingFiles.add(
|
||||||
supportingFiles.add(new SupportingFile("apis.mustache", apiPackage().replace('.', File.separatorChar), "api.ts"));
|
new SupportingFile("models.mustache", modelPackage().replace('.', File.separatorChar), "models.ts"));
|
||||||
|
supportingFiles
|
||||||
|
.add(new SupportingFile("apis.mustache", apiPackage().replace('.', File.separatorChar), "api.ts"));
|
||||||
supportingFiles.add(new SupportingFile("index.mustache", getIndexDirectory(), "index.ts"));
|
supportingFiles.add(new SupportingFile("index.mustache", getIndexDirectory(), "index.ts"));
|
||||||
supportingFiles.add(new SupportingFile("api.module.mustache", getIndexDirectory(), "api.module.ts"));
|
supportingFiles.add(new SupportingFile("api.module.mustache", getIndexDirectory(), "api.module.ts"));
|
||||||
supportingFiles.add(new SupportingFile("rxjs-operators.mustache", getIndexDirectory(), "rxjs-operators.ts"));
|
|
||||||
supportingFiles.add(new SupportingFile("configuration.mustache", getIndexDirectory(), "configuration.ts"));
|
supportingFiles.add(new SupportingFile("configuration.mustache", getIndexDirectory(), "configuration.ts"));
|
||||||
supportingFiles.add(new SupportingFile("variables.mustache", getIndexDirectory(), "variables.ts"));
|
supportingFiles.add(new SupportingFile("variables.mustache", getIndexDirectory(), "variables.ts"));
|
||||||
supportingFiles.add(new SupportingFile("encoder.mustache", getIndexDirectory(), "encoder.ts"));
|
supportingFiles.add(new SupportingFile("encoder.mustache", getIndexDirectory(), "encoder.ts"));
|
||||||
@ -114,6 +119,9 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
|
|||||||
additionalProperties.put("injectionToken", ngVersion.atLeast("4.0.0") ? "InjectionToken" : "OpaqueToken");
|
additionalProperties.put("injectionToken", ngVersion.atLeast("4.0.0") ? "InjectionToken" : "OpaqueToken");
|
||||||
additionalProperties.put("injectionTokenTyped", ngVersion.atLeast("4.0.0"));
|
additionalProperties.put("injectionTokenTyped", ngVersion.atLeast("4.0.0"));
|
||||||
additionalProperties.put("useHttpClient", ngVersion.atLeast("4.3.0"));
|
additionalProperties.put("useHttpClient", ngVersion.atLeast("4.3.0"));
|
||||||
|
if (!ngVersion.atLeast("4.3.0")) {
|
||||||
|
supportingFiles.add(new SupportingFile("rxjs-operators.mustache", getIndexDirectory(), "rxjs-operators.ts"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addNpmPackageGeneration() {
|
private void addNpmPackageGeneration() {
|
||||||
@ -125,7 +133,8 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode
|
|||||||
this.setNpmVersion(additionalProperties.get(NPM_VERSION).toString());
|
this.setNpmVersion(additionalProperties.get(NPM_VERSION).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (additionalProperties.containsKey(SNAPSHOT) && Boolean.valueOf(additionalProperties.get(SNAPSHOT).toString())) {
|
if (additionalProperties.containsKey(SNAPSHOT)
|
||||||
|
&& Boolean.valueOf(additionalProperties.get(SNAPSHOT).toString())) {
|
||||||
this.setNpmVersion(npmVersion + "-SNAPSHOT." + SNAPSHOT_SUFFIX_FORMAT.format(new Date()));
|
this.setNpmVersion(npmVersion + "-SNAPSHOT." + SNAPSHOT_SUFFIX_FORMAT.format(new Date()));
|
||||||
}
|
}
|
||||||
additionalProperties.put(NPM_VERSION, npmVersion);
|
additionalProperties.put(NPM_VERSION, npmVersion);
|
||||||
|
@ -1,8 +1,3 @@
|
|||||||
{{#useHttpClient}}
|
|
||||||
// RxJS imports are not needed for Angular 4.3 and later
|
|
||||||
{{/useHttpClient}}
|
|
||||||
|
|
||||||
{{^useHttpClient}}
|
|
||||||
// RxJS imports according to https://angular.io/docs/ts/latest/guide/server-communication.html#!#rxjs
|
// RxJS imports according to https://angular.io/docs/ts/latest/guide/server-communication.html#!#rxjs
|
||||||
|
|
||||||
// See node_module/rxjs/Rxjs.js
|
// See node_module/rxjs/Rxjs.js
|
||||||
@ -14,4 +9,3 @@ import 'rxjs/add/observable/throw';
|
|||||||
// Operators
|
// Operators
|
||||||
import 'rxjs/add/operator/catch';
|
import 'rxjs/add/operator/catch';
|
||||||
import 'rxjs/add/operator/map';
|
import 'rxjs/add/operator/map';
|
||||||
{{/useHttpClient}}
|
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
// RxJS imports according to https://angular.io/docs/ts/latest/guide/server-communication.html#!#rxjs
|
// RxJS imports according to https://angular.io/docs/ts/latest/guide/server-communication.html#!#rxjs
|
||||||
|
|
||||||
// See node_module/rxjs/Rxjs.js
|
// See node_module/rxjs/Rxjs.js
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
// RxJS imports according to https://angular.io/docs/ts/latest/guide/server-communication.html#!#rxjs
|
// RxJS imports according to https://angular.io/docs/ts/latest/guide/server-communication.html#!#rxjs
|
||||||
|
|
||||||
// See node_module/rxjs/Rxjs.js
|
// See node_module/rxjs/Rxjs.js
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
// RxJS imports according to https://angular.io/docs/ts/latest/guide/server-communication.html#!#rxjs
|
// RxJS imports according to https://angular.io/docs/ts/latest/guide/server-communication.html#!#rxjs
|
||||||
|
|
||||||
// See node_module/rxjs/Rxjs.js
|
// See node_module/rxjs/Rxjs.js
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
// RxJS imports are not needed for Angular 4.3 and later
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
// RxJS imports according to https://angular.io/docs/ts/latest/guide/server-communication.html#!#rxjs
|
// RxJS imports according to https://angular.io/docs/ts/latest/guide/server-communication.html#!#rxjs
|
||||||
|
|
||||||
// See node_module/rxjs/Rxjs.js
|
// See node_module/rxjs/Rxjs.js
|
||||||
|
Loading…
x
Reference in New Issue
Block a user