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 a2f88b05bca9..4eae99d749e1 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular2/api.mustache @@ -1,5 +1,5 @@ import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from '@angular/http'; -import {Injectable} from '@angular/core'; +import {Injectable, Optional} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import * as models from '../model/models'; @@ -18,10 +18,10 @@ export class {{classname}} { protected basePath = '{{basePath}}'; public defaultHeaders : Headers = new Headers(); - constructor(protected http: Http) {} - - setBasePath(basePath: string) { - this.basePath = basePath; + constructor(protected http: Http, @Optional() basePath: string) { + if (basePath) { + this.basePath = basePath; + } } {{#operation}} diff --git a/samples/client/petstore/typescript-angular2/default/api/PetApi.ts b/samples/client/petstore/typescript-angular2/default/api/PetApi.ts index f69a78df3c40..4a858fa75eda 100644 --- a/samples/client/petstore/typescript-angular2/default/api/PetApi.ts +++ b/samples/client/petstore/typescript-angular2/default/api/PetApi.ts @@ -1,5 +1,5 @@ import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from '@angular/http'; -import {Injectable} from '@angular/core'; +import {Injectable, Optional} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import * as models from '../model/models'; @@ -12,10 +12,10 @@ export class PetApi { protected basePath = 'http://petstore.swagger.io/v2'; public defaultHeaders : Headers = new Headers(); - constructor(protected http: Http) {} - - setBasePath(basePath: string) { - this.basePath = basePath; + constructor(protected http: Http, @Optional() basePath: string) { + if (basePath) { + this.basePath = basePath; + } } /** diff --git a/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts b/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts index f7b52337a0af..b6c8b5022b06 100644 --- a/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts +++ b/samples/client/petstore/typescript-angular2/default/api/StoreApi.ts @@ -1,5 +1,5 @@ import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from '@angular/http'; -import {Injectable} from '@angular/core'; +import {Injectable, Optional} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import * as models from '../model/models'; @@ -12,10 +12,10 @@ export class StoreApi { protected basePath = 'http://petstore.swagger.io/v2'; public defaultHeaders : Headers = new Headers(); - constructor(protected http: Http) {} - - setBasePath(basePath: string) { - this.basePath = basePath; + constructor(protected http: Http, @Optional() basePath: string) { + if (basePath) { + this.basePath = basePath; + } } /** diff --git a/samples/client/petstore/typescript-angular2/default/api/UserApi.ts b/samples/client/petstore/typescript-angular2/default/api/UserApi.ts index 95cb5febff53..0fd1fd0d25ec 100644 --- a/samples/client/petstore/typescript-angular2/default/api/UserApi.ts +++ b/samples/client/petstore/typescript-angular2/default/api/UserApi.ts @@ -1,5 +1,5 @@ import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from '@angular/http'; -import {Injectable} from '@angular/core'; +import {Injectable, Optional} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import * as models from '../model/models'; @@ -12,10 +12,10 @@ export class UserApi { protected basePath = 'http://petstore.swagger.io/v2'; public defaultHeaders : Headers = new Headers(); - constructor(protected http: Http) {} - - setBasePath(basePath: string) { - this.basePath = basePath; + constructor(protected http: Http, @Optional() basePath: string) { + if (basePath) { + this.basePath = basePath; + } } /** diff --git a/samples/client/petstore/typescript-angular2/npm/README.md b/samples/client/petstore/typescript-angular2/npm/README.md index c3d0ec569562..07c8035e9229 100644 --- a/samples/client/petstore/typescript-angular2/npm/README.md +++ b/samples/client/petstore/typescript-angular2/npm/README.md @@ -1,4 +1,4 @@ -## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201605041712 +## @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201605041838 ### Building @@ -19,7 +19,7 @@ navigate to the folder of your consuming project and run one of next commando's. _published:_ ``` -npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201605041712 --save +npm install @swagger/angular2-typescript-petstore@0.0.1-SNAPSHOT.201605041838 --save ``` _unPublished (not recommended):_ diff --git a/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts b/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts index f69a78df3c40..4a858fa75eda 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/PetApi.ts @@ -1,5 +1,5 @@ import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from '@angular/http'; -import {Injectable} from '@angular/core'; +import {Injectable, Optional} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import * as models from '../model/models'; @@ -12,10 +12,10 @@ export class PetApi { protected basePath = 'http://petstore.swagger.io/v2'; public defaultHeaders : Headers = new Headers(); - constructor(protected http: Http) {} - - setBasePath(basePath: string) { - this.basePath = basePath; + constructor(protected http: Http, @Optional() basePath: string) { + if (basePath) { + this.basePath = basePath; + } } /** diff --git a/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts b/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts index f7b52337a0af..b6c8b5022b06 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/StoreApi.ts @@ -1,5 +1,5 @@ import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from '@angular/http'; -import {Injectable} from '@angular/core'; +import {Injectable, Optional} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import * as models from '../model/models'; @@ -12,10 +12,10 @@ export class StoreApi { protected basePath = 'http://petstore.swagger.io/v2'; public defaultHeaders : Headers = new Headers(); - constructor(protected http: Http) {} - - setBasePath(basePath: string) { - this.basePath = basePath; + constructor(protected http: Http, @Optional() basePath: string) { + if (basePath) { + this.basePath = basePath; + } } /** diff --git a/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts b/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts index 95cb5febff53..0fd1fd0d25ec 100644 --- a/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts +++ b/samples/client/petstore/typescript-angular2/npm/api/UserApi.ts @@ -1,5 +1,5 @@ import {Http, Headers, RequestOptionsArgs, Response, URLSearchParams} from '@angular/http'; -import {Injectable} from '@angular/core'; +import {Injectable, Optional} from '@angular/core'; import {Observable} from 'rxjs/Observable'; import * as models from '../model/models'; @@ -12,10 +12,10 @@ export class UserApi { protected basePath = 'http://petstore.swagger.io/v2'; public defaultHeaders : Headers = new Headers(); - constructor(protected http: Http) {} - - setBasePath(basePath: string) { - this.basePath = basePath; + constructor(protected http: Http, @Optional() basePath: string) { + if (basePath) { + this.basePath = basePath; + } } /** diff --git a/samples/client/petstore/typescript-angular2/npm/package.json b/samples/client/petstore/typescript-angular2/npm/package.json index 9ac748fce108..9fbaef443ff3 100644 --- a/samples/client/petstore/typescript-angular2/npm/package.json +++ b/samples/client/petstore/typescript-angular2/npm/package.json @@ -1,6 +1,6 @@ { "name": "@swagger/angular2-typescript-petstore", - "version": "0.0.1-SNAPSHOT.201605041712", + "version": "0.0.1-SNAPSHOT.201605041838", "description": "swagger client for @swagger/angular2-typescript-petstore", "author": "Swagger Codegen Contributors", "keywords": [