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 697438906315018ace49b2445a29fd0fbd618cf3..1db1321381b4e76076e87a4d5b1571178e1cb60c 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 @@ -66,13 +66,14 @@ export class {{classname}} { {{/useHttpClient}} constructor(protected {{#useHttpClient}}httpClient: HttpClient{{/useHttpClient}}{{^useHttpClient}}http: Http{{/useHttpClient}}, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } {{#useHttpClient}} this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); diff --git a/samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts index 62bfcb0f689266cbc23b026a58c27c5044f84202..9c9ee52b1e56e8966e8023cf3e64fa7baffba4cd 100644 --- a/samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v2/default/api/pet.service.ts @@ -35,13 +35,14 @@ export class PetService { public encoder: QueryEncoder; constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper(); } diff --git a/samples/client/petstore/typescript-angular-v2/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v2/default/api/store.service.ts index 31b3c70469183ee9c6cffdb415d285763bf78803..2c74563940277bf3c983e6d16e7c53fc8223b188 100644 --- a/samples/client/petstore/typescript-angular-v2/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v2/default/api/store.service.ts @@ -34,13 +34,14 @@ export class StoreService { public encoder: QueryEncoder; constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper(); } diff --git a/samples/client/petstore/typescript-angular-v2/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v2/default/api/user.service.ts index 42bac67fac3b69c938c99ab398011f349d0dffb6..9ce463aa829937bd78d52d2da29bf83aa528d144 100644 --- a/samples/client/petstore/typescript-angular-v2/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v2/default/api/user.service.ts @@ -34,13 +34,14 @@ export class UserService { public encoder: QueryEncoder; constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper(); } diff --git a/samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts index 62bfcb0f689266cbc23b026a58c27c5044f84202..9c9ee52b1e56e8966e8023cf3e64fa7baffba4cd 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v2/npm/api/pet.service.ts @@ -35,13 +35,14 @@ export class PetService { public encoder: QueryEncoder; constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper(); } diff --git a/samples/client/petstore/typescript-angular-v2/npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v2/npm/api/store.service.ts index 31b3c70469183ee9c6cffdb415d285763bf78803..2c74563940277bf3c983e6d16e7c53fc8223b188 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v2/npm/api/store.service.ts @@ -34,13 +34,14 @@ export class StoreService { public encoder: QueryEncoder; constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper(); } diff --git a/samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts index 42bac67fac3b69c938c99ab398011f349d0dffb6..9ce463aa829937bd78d52d2da29bf83aa528d144 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v2/npm/api/user.service.ts @@ -34,13 +34,14 @@ export class UserService { public encoder: QueryEncoder; constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper(); } diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts index 7aebfe5fef436b198a7edc2c581f7b936630320f..c75e5e46dddd3438878fd9e217be1ade6006f3f5 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/pet.service.ts @@ -36,13 +36,14 @@ export class PetService implements PetServiceInterface { public encoder: QueryEncoder; constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper(); } diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.service.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.service.ts index 7fdd6d038832cd3c81a7a20f36d811647d0b1692..147e0c8dfd57fac4a277c38e88fbd129adb7f3ee 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/store.service.ts @@ -35,13 +35,14 @@ export class StoreService implements StoreServiceInterface { public encoder: QueryEncoder; constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper(); } diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts index d852fae20a1c8737cae22768d5b05958ff29c711..d9acd360ef3a149726455d97da3b03bfdaab5ae4 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/api/user.service.ts @@ -35,13 +35,14 @@ export class UserService implements UserServiceInterface { public encoder: QueryEncoder; constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper(); } diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts index 52f9e5ee8d912a67ee6671f69916ef30b3788029..1d5843d4042caeed5a0c2efd2c194845ba7d8b8c 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v4.3/npm/api/pet.service.ts @@ -33,13 +33,14 @@ export class PetService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v4.3/npm/api/store.service.ts index d853a0f4c88d018977c30aeae79288600e3fc1d8..eb7539d0d529678615695dc96c5d2bb0c1849e59 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v4.3/npm/api/store.service.ts @@ -32,13 +32,14 @@ export class StoreService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts index b8f2a9f32d9ab72735f4cacdef07c484a8543db0..0f0a22e8234d0e83f44af653cf5b09498c6c039c 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v4.3/npm/api/user.service.ts @@ -32,13 +32,14 @@ export class UserService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts index 62bfcb0f689266cbc23b026a58c27c5044f84202..9c9ee52b1e56e8966e8023cf3e64fa7baffba4cd 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v4/npm/api/pet.service.ts @@ -35,13 +35,14 @@ export class PetService { public encoder: QueryEncoder; constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper(); } diff --git a/samples/client/petstore/typescript-angular-v4/npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v4/npm/api/store.service.ts index 31b3c70469183ee9c6cffdb415d285763bf78803..2c74563940277bf3c983e6d16e7c53fc8223b188 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v4/npm/api/store.service.ts @@ -34,13 +34,14 @@ export class StoreService { public encoder: QueryEncoder; constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper(); } diff --git a/samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts index 42bac67fac3b69c938c99ab398011f349d0dffb6..9ce463aa829937bd78d52d2da29bf83aa528d144 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v4/npm/api/user.service.ts @@ -34,13 +34,14 @@ export class UserService { public encoder: QueryEncoder; constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomQueryEncoderHelper(); } diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/pet.service.ts index 989d91b5c028c7af547c1ef254fd84f914f4aa9c..380838570e9d071331b9d082de5c280db7061346 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/pet.service.ts @@ -33,13 +33,14 @@ export class PetService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/store.service.ts index 97392be5f22a040c2e0097340285e213cea4c436..f1fc543ad0c209bf2ceec30c5a3f9cf60d938c37 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/store.service.ts @@ -32,13 +32,14 @@ export class StoreService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/user.service.ts index 5357ddadaa8f94f147a86b201608b11fa6191fdb..89ca23713a24dcba9a7879db7134a5369461b90e 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default/api/user.service.ts @@ -32,13 +32,14 @@ export class UserService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/pet.service.ts index 989d91b5c028c7af547c1ef254fd84f914f4aa9c..380838570e9d071331b9d082de5c280db7061346 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/pet.service.ts @@ -33,13 +33,14 @@ export class PetService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/store.service.ts index 97392be5f22a040c2e0097340285e213cea4c436..f1fc543ad0c209bf2ceec30c5a3f9cf60d938c37 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/store.service.ts @@ -32,13 +32,14 @@ export class StoreService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/user.service.ts index 5357ddadaa8f94f147a86b201608b11fa6191fdb..89ca23713a24dcba9a7879db7134a5369461b90e 100644 --- a/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm/api/user.service.ts @@ -32,13 +32,14 @@ export class UserService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/pet.service.ts index a0df069e6a4a484edfd1d0c2dd92ec220d7fd6e9..25f4cdfc7f4a8022999a46c1a19a70ff4bb0c9f7 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/pet.service.ts @@ -35,13 +35,14 @@ export class PetService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/store.service.ts index 6264d975e0027689f5df30c4b3d32db12889277e..8fba3b49de8736cccb1efee9d239988713b0e1db 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/store.service.ts @@ -34,13 +34,14 @@ export class StoreService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/user.service.ts index a85d856499526cead978048bf038b626bfa0197e..a9fc0b74c1a6b6eed725ea8fe3ba3335df0a28d7 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default/api/user.service.ts @@ -34,13 +34,14 @@ export class UserService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/pet.service.ts index a0df069e6a4a484edfd1d0c2dd92ec220d7fd6e9..25f4cdfc7f4a8022999a46c1a19a70ff4bb0c9f7 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/pet.service.ts @@ -35,13 +35,14 @@ export class PetService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/store.service.ts index 6264d975e0027689f5df30c4b3d32db12889277e..8fba3b49de8736cccb1efee9d239988713b0e1db 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/store.service.ts @@ -34,13 +34,14 @@ export class StoreService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/user.service.ts index a85d856499526cead978048bf038b626bfa0197e..a9fc0b74c1a6b6eed725ea8fe3ba3335df0a28d7 100644 --- a/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm/api/user.service.ts @@ -34,13 +34,14 @@ export class UserService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/pet.service.ts index 989d91b5c028c7af547c1ef254fd84f914f4aa9c..380838570e9d071331b9d082de5c280db7061346 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/pet.service.ts @@ -33,13 +33,14 @@ export class PetService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/store.service.ts index 97392be5f22a040c2e0097340285e213cea4c436..f1fc543ad0c209bf2ceec30c5a3f9cf60d938c37 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/store.service.ts @@ -32,13 +32,14 @@ export class StoreService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/user.service.ts index 5357ddadaa8f94f147a86b201608b11fa6191fdb..89ca23713a24dcba9a7879db7134a5369461b90e 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default/api/user.service.ts @@ -32,13 +32,14 @@ export class UserService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/pet.service.ts index 989d91b5c028c7af547c1ef254fd84f914f4aa9c..380838570e9d071331b9d082de5c280db7061346 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/pet.service.ts @@ -33,13 +33,14 @@ export class PetService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/store.service.ts index 97392be5f22a040c2e0097340285e213cea4c436..f1fc543ad0c209bf2ceec30c5a3f9cf60d938c37 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/store.service.ts @@ -32,13 +32,14 @@ export class StoreService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/user.service.ts index 5357ddadaa8f94f147a86b201608b11fa6191fdb..89ca23713a24dcba9a7879db7134a5369461b90e 100644 --- a/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm/api/user.service.ts @@ -32,13 +32,14 @@ export class UserService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/pet.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/pet.service.ts index a0df069e6a4a484edfd1d0c2dd92ec220d7fd6e9..25f4cdfc7f4a8022999a46c1a19a70ff4bb0c9f7 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/pet.service.ts @@ -35,13 +35,14 @@ export class PetService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/store.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/store.service.ts index 6264d975e0027689f5df30c4b3d32db12889277e..8fba3b49de8736cccb1efee9d239988713b0e1db 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/store.service.ts @@ -34,13 +34,14 @@ export class StoreService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/user.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/user.service.ts index a85d856499526cead978048bf038b626bfa0197e..a9fc0b74c1a6b6eed725ea8fe3ba3335df0a28d7 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/default/api/user.service.ts @@ -34,13 +34,14 @@ export class UserService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/pet.service.ts index a0df069e6a4a484edfd1d0c2dd92ec220d7fd6e9..25f4cdfc7f4a8022999a46c1a19a70ff4bb0c9f7 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/pet.service.ts @@ -35,13 +35,14 @@ export class PetService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/store.service.ts index 6264d975e0027689f5df30c4b3d32db12889277e..8fba3b49de8736cccb1efee9d239988713b0e1db 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/store.service.ts @@ -34,13 +34,14 @@ export class StoreService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/user.service.ts index a85d856499526cead978048bf038b626bfa0197e..a9fc0b74c1a6b6eed725ea8fe3ba3335df0a28d7 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/builds/with-npm/api/user.service.ts @@ -34,13 +34,14 @@ export class UserService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v7-provided-in-root/tests/default/src/test/configuration.spec.ts b/samples/client/petstore/typescript-angular-v7-provided-in-root/tests/default/src/test/configuration.spec.ts index 0b8ec658ac1d0a7110f62bd5f684702e7e0cb0c9..120c9d284cb030402ca665c2ceeba0ea0c57bb20 100644 --- a/samples/client/petstore/typescript-angular-v7-provided-in-root/tests/default/src/test/configuration.spec.ts +++ b/samples/client/petstore/typescript-angular-v7-provided-in-root/tests/default/src/test/configuration.spec.ts @@ -91,3 +91,68 @@ describe(`API (with ConfigurationFactory)`, () => { }); }); + +describe(`API (with ConfigurationFactory and empty basePath)`, () => { + let httpClient: HttpClient; + let httpTestingController: HttpTestingController; + + const pet: Pet = { + name: `pet`, + photoUrls: [] + }; + + let apiConfigurationParams: ConfigurationParameters = { + // add configuration params here + basePath: '' + }; + + let apiConfig: Configuration = new Configuration(apiConfigurationParams); + + const getApiConfig = () => { + return apiConfig; + }; + + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [ + HttpClientTestingModule , + ApiModule.forRoot(getApiConfig) + ], + providers: [ + PetService, + ] + }); + + // Inject the http service and test controller for each test + httpClient = TestBed.get(HttpClient); + httpTestingController = TestBed.get(HttpTestingController); + }); + + afterEach(() => { + // After every test, assert that there are no more pending requests. + httpTestingController.verify(); + }); + + describe(`PetService`, () => { + it(`should be provided`, () => { + const petService = TestBed.get(PetService); + expect(petService).toBeTruthy(); + }); + + it(`should call initially configured empty basePath /pet`, async(() => { + const petService = TestBed.get(PetService); + + petService.addPet(pet).subscribe( + result => expect(result).toEqual(pet), + error => fail(`expected a result, not the error: ${error.message}`), + ); + + const req = httpTestingController.expectOne('/pet'); + + expect(req.request.method).toEqual('POST'); + + req.flush(pet); + })); + }); + +}); diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/pet.service.ts index a0df069e6a4a484edfd1d0c2dd92ec220d7fd6e9..25f4cdfc7f4a8022999a46c1a19a70ff4bb0c9f7 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/pet.service.ts @@ -35,13 +35,14 @@ export class PetService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/store.service.ts index 6264d975e0027689f5df30c4b3d32db12889277e..8fba3b49de8736cccb1efee9d239988713b0e1db 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/store.service.ts @@ -34,13 +34,14 @@ export class StoreService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/user.service.ts index a85d856499526cead978048bf038b626bfa0197e..a9fc0b74c1a6b6eed725ea8fe3ba3335df0a28d7 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/api/user.service.ts @@ -34,13 +34,14 @@ export class UserService { public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { - if (configuration) { this.configuration = configuration; - this.configuration.basePath = configuration.basePath || basePath || this.basePath; - - } else { - this.configuration.basePath = basePath || this.basePath; + } + if (typeof this.configuration.basePath !== 'string') { + if (typeof basePath !== 'string') { + basePath = this.basePath; + } + this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); }