Merge 'master' branch of 'swagger-codegen' into 'master' (#422)

Corresponding commit swagger-codegen: cccd0930368dd4c54d04bdfcaa3496685c3ed9b8

Co-authored-by: Andreas Müller <inidona@users.noreply.github.com>
Co-authored-by: Geoff Brown <gbrown@centeredgesoftware.com>
Co-authored-by: Raphael Ochsenbein <akekahn@gmail.com>
This commit is contained in:
Jérémie Bresson 2018-05-11 14:35:56 +02:00 committed by GitHub
parent 70733deab9
commit fcec2d74e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 7 deletions

View File

@ -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"));
}

View File

@ -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"
}

View File

@ -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}}

View File

@ -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}}';

View File

@ -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": {

View File

@ -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}}