diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java index fab3a567742..f77c17f555b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java @@ -135,6 +135,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode additionalProperties.put("injectionToken", ngVersion.atLeast("4.0.0") ? "InjectionToken" : "OpaqueToken"); additionalProperties.put("injectionTokenTyped", ngVersion.atLeast("4.0.0")); additionalProperties.put("useHttpClient", ngVersion.atLeast("4.3.0")); + additionalProperties.put("useRxJS6", ngVersion.atLeast("6.0.0")); if (!ngVersion.atLeast("4.3.0")) { supportingFiles.add(new SupportingFile("rxjs-operators.mustache", getIndexDirectory(), "rxjs-operators.ts")); } diff --git a/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache index af0d3d55d85..575811da812 100644 --- a/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/build.gradle.mustache @@ -18,7 +18,6 @@ repositories { jcenter() } - if(hasProperty('target') && target == 'android') { apply plugin: 'com.android.library' @@ -103,6 +102,21 @@ if(hasProperty('target') && target == 'android') { main = System.getProperty('mainClass') classpath = sourceSets.main.runtimeClasspath } + + task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource + } + + task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir + } + + artifacts { + archives sourcesJar + archives javadocJar + } } ext { @@ -135,3 +149,4 @@ dependencies { {{/java8}} testCompile "junit:junit:$junit_version" } + diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache index 52680fa13de..027725ef013 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/api.service.mustache @@ -14,7 +14,12 @@ import { Response, ResponseContentType } from '@angular/http import { CustomQueryEncoderHelper } from '../encoder'; {{/useHttpClient}} +{{^useRxJS6}} import { Observable } from 'rxjs/Observable'; +{{/useRxJS6}} +{{#useRxJS6}} +import { Observable } from 'rxjs'; +{{/useRxJS6}} {{^useHttpClient}} import '../rxjs-operators'; {{/useHttpClient}} diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/apiInterface.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/apiInterface.mustache index 1427ff27ad7..fb60c1a394f 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/apiInterface.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/apiInterface.mustache @@ -6,8 +6,12 @@ import { HttpHeaders } from '@angular/comm import { Headers } from '@angular/http'; {{/useHttpClient}} +{{^useRxJS6}} import { Observable } from 'rxjs/Observable'; - +{{/useRxJS6}} +{{#useRxJS6}} +import { Observable } from 'rxjs'; +{{/useRxJS6}} {{#imports}} import { {{classname}} } from '../{{filename}}'; diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/package.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/package.mustache index a8a2a1bebb8..9ecc2a8265a 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/package.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/package.mustache @@ -29,7 +29,7 @@ "@angular/compiler": "^{{ngVersion}}", "core-js": "^2.4.0", "reflect-metadata": "^0.1.3", - "rxjs": "^5.4.0", + "rxjs": "{{#useRxJS6}}^6.1.0{{/useRxJS6}}{{^useRxJS6}}^5.4.0{{/useRxJS6}}", "zone.js": "^0.7.6" }, "devDependencies": { @@ -41,9 +41,9 @@ "@angular/platform-browser": "^{{ngVersion}}",{{#useNgPackagr}} "ng-packagr": {{#useOldNgPackagr}}"^1.6.0"{{/useOldNgPackagr}}{{^useOldNgPackagr}}"^2.4.1"{{/useOldNgPackagr}},{{/useNgPackagr}} "reflect-metadata": "^0.1.3", - "rxjs": "^5.4.0", + "rxjs": "{{#useRxJS6}}^6.1.0{{/useRxJS6}}{{^useRxJS6}}^5.4.0{{/useRxJS6}}", "zone.js": "^0.7.6", - "typescript": "^2.1.5" + "typescript": ">=2.1.5 <2.8" }{{#npmRepository}},{{/npmRepository}} {{#npmRepository}} "publishConfig": { diff --git a/modules/openapi-generator/src/main/resources/typescript-node/api.mustache b/modules/openapi-generator/src/main/resources/typescript-node/api.mustache index 602c908dcdd..c12d04a4ddc 100644 --- a/modules/openapi-generator/src/main/resources/typescript-node/api.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-node/api.mustache @@ -145,10 +145,10 @@ export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ {{/vars}} {{#discriminator}} - static discriminator = {{{discriminatorName}}}; + static discriminator: string | undefined = "{{discriminatorName}}"; {{/discriminator}} {{^discriminator}} - static discriminator = undefined; + static discriminator: string | undefined = undefined; {{/discriminator}} {{^isArrayModel}}