From 0c0134a2368bb06952f84c43dbf37d288b65c608 Mon Sep 17 00:00:00 2001 From: "m.buils" Date: Mon, 14 Jan 2019 19:03:00 +0100 Subject: [PATCH 1/2] [typescript-angular] error TS1345: An expression of type 'void' cannot be tested for truthiness #8836 --- .../typescript-angular/api.service.mustache | 5 +++++ .../typescript-angular/api/fake.service.ts | 2 +- .../typescript-angular2/api/fake.service.ts | 2 +- .../default/.swagger-codegen/VERSION | 2 +- .../default/api/pet.service.ts | 4 ++-- .../npm/.swagger-codegen/VERSION | 2 +- .../npm/api/pet.service.ts | 4 ++-- .../with-interfaces/.swagger-codegen/VERSION | 2 +- .../with-interfaces/api/pet.service.ts | 4 ++-- .../npm/.swagger-codegen/VERSION | 2 +- .../npm/api/pet.service.ts | 4 ++-- .../with-interfaces/.swagger-codegen/VERSION | 2 +- .../with-interfaces/api/pet.service.ts | 4 ++-- .../npm/.swagger-codegen/VERSION | 2 +- .../npm/api/pet.service.ts | 4 ++-- .../npm/.swagger-codegen/VERSION | 2 +- .../npm/api/pet.service.ts | 17 +++++++++++++++-- .../npm/api/store.service.ts | 3 +++ .../npm/api/user.service.ts | 9 +++++++++ .../typescript-angular-v5/npm/model/models.ts | 2 ++ .../with-interfaces/.swagger-codegen/VERSION | 2 +- .../with-interfaces/api/pet.service.ts | 4 ++-- .../npm/.swagger-codegen/VERSION | 2 +- .../npm/api/pet.service.ts | 17 +++++++++++++++-- .../npm/api/store.service.ts | 3 +++ .../npm/api/user.service.ts | 9 +++++++++ .../typescript-angular-v6/npm/model/models.ts | 2 ++ 27 files changed, 88 insertions(+), 29 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/typescript-angular/api.service.mustache b/modules/swagger-codegen/src/main/resources/typescript-angular/api.service.mustache index 1dd20307db1..a50970ee6dc 100644 --- a/modules/swagger-codegen/src/main/resources/typescript-angular/api.service.mustache +++ b/modules/swagger-codegen/src/main/resources/typescript-angular/api.service.mustache @@ -262,7 +262,12 @@ export class {{classname}} { {{#hasFormParams}} const canConsumeForm = this.canConsumeForm(consumes); +{{^useHttpClient}} let formParams: { append(param: string, value: any): void; }; +{{/useHttpClient}} +{{#useHttpClient}} + let formParams: { append(param: string, value: any): void | HttpParams; }; +{{/useHttpClient}} let useForm = false; let convertFormParamsToString = false; {{#formParams}} diff --git a/samples/client/petstore-security-test/typescript-angular/api/fake.service.ts b/samples/client/petstore-security-test/typescript-angular/api/fake.service.ts index d0047d78bee..3126bb86e55 100644 --- a/samples/client/petstore-security-test/typescript-angular/api/fake.service.ts +++ b/samples/client/petstore-security-test/typescript-angular/api/fake.service.ts @@ -87,7 +87,7 @@ export class FakeService { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; if (useForm) { diff --git a/samples/client/petstore-security-test/typescript-angular2/api/fake.service.ts b/samples/client/petstore-security-test/typescript-angular2/api/fake.service.ts index d0047d78bee..3126bb86e55 100644 --- a/samples/client/petstore-security-test/typescript-angular2/api/fake.service.ts +++ b/samples/client/petstore-security-test/typescript-angular2/api/fake.service.ts @@ -87,7 +87,7 @@ export class FakeService { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; if (useForm) { diff --git a/samples/client/petstore/typescript-angular-v2/default/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v2/default/.swagger-codegen/VERSION index 855ff9501eb..53cf8b59ba4 100644 --- a/samples/client/petstore/typescript-angular-v2/default/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v2/default/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +2.4.1-SNAPSHOT \ No newline at end of file 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 78080a33ea2..4ec67eb52cd 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 @@ -557,7 +557,7 @@ export class PetService { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; if (useForm) { @@ -633,7 +633,7 @@ export class PetService { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; // use FormData to transmit files using content-type "multipart/form-data" diff --git a/samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen/VERSION index 855ff9501eb..53cf8b59ba4 100644 --- a/samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v2/npm/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +2.4.1-SNAPSHOT \ No newline at end of file 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 78080a33ea2..4ec67eb52cd 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 @@ -557,7 +557,7 @@ export class PetService { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; if (useForm) { @@ -633,7 +633,7 @@ export class PetService { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; // use FormData to transmit files using content-type "multipart/form-data" diff --git a/samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen/VERSION index 855ff9501eb..53cf8b59ba4 100644 --- a/samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v2/with-interfaces/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +2.4.1-SNAPSHOT \ No newline at end of file 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 f3caaf58a5b..9b2445a93d9 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 @@ -558,7 +558,7 @@ export class PetService implements PetServiceInterface { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; if (useForm) { @@ -634,7 +634,7 @@ export class PetService implements PetServiceInterface { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; // use FormData to transmit files using content-type "multipart/form-data" diff --git a/samples/client/petstore/typescript-angular-v4.3/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v4.3/npm/.swagger-codegen/VERSION index 855ff9501eb..53cf8b59ba4 100644 --- a/samples/client/petstore/typescript-angular-v4.3/npm/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v4.3/npm/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +2.4.1-SNAPSHOT \ No newline at end of file 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 b3b51af413d..6df4a156372 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 @@ -432,7 +432,7 @@ export class PetService { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; if (useForm) { @@ -505,7 +505,7 @@ export class PetService { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; // use FormData to transmit files using content-type "multipart/form-data" diff --git a/samples/client/petstore/typescript-angular-v4.3/with-interfaces/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v4.3/with-interfaces/.swagger-codegen/VERSION index 855ff9501eb..53cf8b59ba4 100644 --- a/samples/client/petstore/typescript-angular-v4.3/with-interfaces/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v4.3/with-interfaces/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +2.4.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular-v4.3/with-interfaces/api/pet.service.ts b/samples/client/petstore/typescript-angular-v4.3/with-interfaces/api/pet.service.ts index a922b13249f..02f1039b98b 100644 --- a/samples/client/petstore/typescript-angular-v4.3/with-interfaces/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v4.3/with-interfaces/api/pet.service.ts @@ -433,7 +433,7 @@ export class PetService implements PetServiceInterface { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; if (useForm) { @@ -506,7 +506,7 @@ export class PetService implements PetServiceInterface { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; // use FormData to transmit files using content-type "multipart/form-data" diff --git a/samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen/VERSION index 855ff9501eb..53cf8b59ba4 100644 --- a/samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v4/npm/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +2.4.1-SNAPSHOT \ No newline at end of file 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 78080a33ea2..4ec67eb52cd 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 @@ -557,7 +557,7 @@ export class PetService { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; if (useForm) { @@ -633,7 +633,7 @@ export class PetService { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; // use FormData to transmit files using content-type "multipart/form-data" diff --git a/samples/client/petstore/typescript-angular-v5/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v5/npm/.swagger-codegen/VERSION index 855ff9501eb..53cf8b59ba4 100644 --- a/samples/client/petstore/typescript-angular-v5/npm/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v5/npm/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +2.4.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular-v5/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v5/npm/api/pet.service.ts index 18563adb1b3..6df4a156372 100644 --- a/samples/client/petstore/typescript-angular-v5/npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v5/npm/api/pet.service.ts @@ -68,6 +68,7 @@ export class PetService { public addPet(body: Pet, observe?: 'response', reportProgress?: boolean): Observable>; public addPet(body: Pet, observe?: 'events', reportProgress?: boolean): Observable>; public addPet(body: Pet, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling addPet.'); } @@ -125,10 +126,12 @@ export class PetService { public deletePet(petId: number, apiKey?: string, observe?: 'response', reportProgress?: boolean): Observable>; public deletePet(petId: number, apiKey?: string, observe?: 'events', reportProgress?: boolean): Observable>; public deletePet(petId: number, apiKey?: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (petId === null || petId === undefined) { throw new Error('Required parameter petId was null or undefined when calling deletePet.'); } + let headers = this.defaultHeaders; if (apiKey !== undefined && apiKey !== null) { headers = headers.set('api_key', String(apiKey)); @@ -177,6 +180,7 @@ export class PetService { public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'response', reportProgress?: boolean): Observable>>; public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'events', reportProgress?: boolean): Observable>>; public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (status === null || status === undefined) { throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); } @@ -232,6 +236,7 @@ export class PetService { public findPetsByTags(tags: Array, observe?: 'response', reportProgress?: boolean): Observable>>; public findPetsByTags(tags: Array, observe?: 'events', reportProgress?: boolean): Observable>>; public findPetsByTags(tags: Array, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (tags === null || tags === undefined) { throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.'); } @@ -287,6 +292,7 @@ export class PetService { public getPetById(petId: number, observe?: 'response', reportProgress?: boolean): Observable>; public getPetById(petId: number, observe?: 'events', reportProgress?: boolean): Observable>; public getPetById(petId: number, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (petId === null || petId === undefined) { throw new Error('Required parameter petId was null or undefined when calling getPetById.'); } @@ -333,6 +339,7 @@ export class PetService { public updatePet(body: Pet, observe?: 'response', reportProgress?: boolean): Observable>; public updatePet(body: Pet, observe?: 'events', reportProgress?: boolean): Observable>; public updatePet(body: Pet, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling updatePet.'); } @@ -391,10 +398,13 @@ export class PetService { public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'response', reportProgress?: boolean): Observable>; public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'events', reportProgress?: boolean): Observable>; public updatePetWithForm(petId: number, name?: string, status?: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (petId === null || petId === undefined) { throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); } + + let headers = this.defaultHeaders; // authentication (petstore_auth) required @@ -422,7 +432,7 @@ export class PetService { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; if (useForm) { @@ -462,10 +472,13 @@ export class PetService { public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'response', reportProgress?: boolean): Observable>; public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'events', reportProgress?: boolean): Observable>; public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (petId === null || petId === undefined) { throw new Error('Required parameter petId was null or undefined when calling uploadFile.'); } + + let headers = this.defaultHeaders; // authentication (petstore_auth) required @@ -492,7 +505,7 @@ export class PetService { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; // use FormData to transmit files using content-type "multipart/form-data" diff --git a/samples/client/petstore/typescript-angular-v5/npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v5/npm/api/store.service.ts index 03016b73c9d..22f13b6f1bb 100644 --- a/samples/client/petstore/typescript-angular-v5/npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v5/npm/api/store.service.ts @@ -67,6 +67,7 @@ export class StoreService { public deleteOrder(orderId: string, observe?: 'response', reportProgress?: boolean): Observable>; public deleteOrder(orderId: string, observe?: 'events', reportProgress?: boolean): Observable>; public deleteOrder(orderId: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (orderId === null || orderId === undefined) { throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); } @@ -149,6 +150,7 @@ export class StoreService { public getOrderById(orderId: number, observe?: 'response', reportProgress?: boolean): Observable>; public getOrderById(orderId: number, observe?: 'events', reportProgress?: boolean): Observable>; public getOrderById(orderId: number, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (orderId === null || orderId === undefined) { throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); } @@ -190,6 +192,7 @@ export class StoreService { public placeOrder(body: Order, observe?: 'response', reportProgress?: boolean): Observable>; public placeOrder(body: Order, observe?: 'events', reportProgress?: boolean): Observable>; public placeOrder(body: Order, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling placeOrder.'); } diff --git a/samples/client/petstore/typescript-angular-v5/npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v5/npm/api/user.service.ts index 7c7ccda2a79..e1323ce454b 100644 --- a/samples/client/petstore/typescript-angular-v5/npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v5/npm/api/user.service.ts @@ -67,6 +67,7 @@ export class UserService { public createUser(body: User, observe?: 'response', reportProgress?: boolean): Observable>; public createUser(body: User, observe?: 'events', reportProgress?: boolean): Observable>; public createUser(body: User, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling createUser.'); } @@ -113,6 +114,7 @@ export class UserService { public createUsersWithArrayInput(body: Array, observe?: 'response', reportProgress?: boolean): Observable>; public createUsersWithArrayInput(body: Array, observe?: 'events', reportProgress?: boolean): Observable>; public createUsersWithArrayInput(body: Array, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.'); } @@ -159,6 +161,7 @@ export class UserService { public createUsersWithListInput(body: Array, observe?: 'response', reportProgress?: boolean): Observable>; public createUsersWithListInput(body: Array, observe?: 'events', reportProgress?: boolean): Observable>; public createUsersWithListInput(body: Array, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.'); } @@ -205,6 +208,7 @@ export class UserService { public deleteUser(username: string, observe?: 'response', reportProgress?: boolean): Observable>; public deleteUser(username: string, observe?: 'events', reportProgress?: boolean): Observable>; public deleteUser(username: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling deleteUser.'); } @@ -246,6 +250,7 @@ export class UserService { public getUserByName(username: string, observe?: 'response', reportProgress?: boolean): Observable>; public getUserByName(username: string, observe?: 'events', reportProgress?: boolean): Observable>; public getUserByName(username: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling getUserByName.'); } @@ -288,9 +293,11 @@ export class UserService { public loginUser(username: string, password: string, observe?: 'response', reportProgress?: boolean): Observable>; public loginUser(username: string, password: string, observe?: 'events', reportProgress?: boolean): Observable>; public loginUser(username: string, password: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling loginUser.'); } + if (password === null || password === undefined) { throw new Error('Required parameter password was null or undefined when calling loginUser.'); } @@ -379,9 +386,11 @@ export class UserService { public updateUser(username: string, body: User, observe?: 'response', reportProgress?: boolean): Observable>; public updateUser(username: string, body: User, observe?: 'events', reportProgress?: boolean): Observable>; public updateUser(username: string, body: User, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling updateUser.'); } + if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling updateUser.'); } diff --git a/samples/client/petstore/typescript-angular-v5/npm/model/models.ts b/samples/client/petstore/typescript-angular-v5/npm/model/models.ts index 8607c5dabd0..f6aebdbf709 100644 --- a/samples/client/petstore/typescript-angular-v5/npm/model/models.ts +++ b/samples/client/petstore/typescript-angular-v5/npm/model/models.ts @@ -1,5 +1,7 @@ +export * from './amount'; export * from './apiResponse'; export * from './category'; +export * from './currency'; export * from './order'; export * from './pet'; export * from './tag'; diff --git a/samples/client/petstore/typescript-angular-v5/with-interfaces/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v5/with-interfaces/.swagger-codegen/VERSION index 855ff9501eb..53cf8b59ba4 100644 --- a/samples/client/petstore/typescript-angular-v5/with-interfaces/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v5/with-interfaces/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +2.4.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular-v5/with-interfaces/api/pet.service.ts b/samples/client/petstore/typescript-angular-v5/with-interfaces/api/pet.service.ts index a922b13249f..02f1039b98b 100644 --- a/samples/client/petstore/typescript-angular-v5/with-interfaces/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v5/with-interfaces/api/pet.service.ts @@ -433,7 +433,7 @@ export class PetService implements PetServiceInterface { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; if (useForm) { @@ -506,7 +506,7 @@ export class PetService implements PetServiceInterface { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; // use FormData to transmit files using content-type "multipart/form-data" diff --git a/samples/client/petstore/typescript-angular-v6/npm/.swagger-codegen/VERSION b/samples/client/petstore/typescript-angular-v6/npm/.swagger-codegen/VERSION index 855ff9501eb..53cf8b59ba4 100644 --- a/samples/client/petstore/typescript-angular-v6/npm/.swagger-codegen/VERSION +++ b/samples/client/petstore/typescript-angular-v6/npm/.swagger-codegen/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +2.4.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-angular-v6/npm/api/pet.service.ts b/samples/client/petstore/typescript-angular-v6/npm/api/pet.service.ts index d62314aefe5..dad3d40fabf 100644 --- a/samples/client/petstore/typescript-angular-v6/npm/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v6/npm/api/pet.service.ts @@ -68,6 +68,7 @@ export class PetService { public addPet(body: Pet, observe?: 'response', reportProgress?: boolean): Observable>; public addPet(body: Pet, observe?: 'events', reportProgress?: boolean): Observable>; public addPet(body: Pet, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling addPet.'); } @@ -125,10 +126,12 @@ export class PetService { public deletePet(petId: number, apiKey?: string, observe?: 'response', reportProgress?: boolean): Observable>; public deletePet(petId: number, apiKey?: string, observe?: 'events', reportProgress?: boolean): Observable>; public deletePet(petId: number, apiKey?: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (petId === null || petId === undefined) { throw new Error('Required parameter petId was null or undefined when calling deletePet.'); } + let headers = this.defaultHeaders; if (apiKey !== undefined && apiKey !== null) { headers = headers.set('api_key', String(apiKey)); @@ -177,6 +180,7 @@ export class PetService { public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'response', reportProgress?: boolean): Observable>>; public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'events', reportProgress?: boolean): Observable>>; public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (status === null || status === undefined) { throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.'); } @@ -232,6 +236,7 @@ export class PetService { public findPetsByTags(tags: Array, observe?: 'response', reportProgress?: boolean): Observable>>; public findPetsByTags(tags: Array, observe?: 'events', reportProgress?: boolean): Observable>>; public findPetsByTags(tags: Array, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (tags === null || tags === undefined) { throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.'); } @@ -287,6 +292,7 @@ export class PetService { public getPetById(petId: number, observe?: 'response', reportProgress?: boolean): Observable>; public getPetById(petId: number, observe?: 'events', reportProgress?: boolean): Observable>; public getPetById(petId: number, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (petId === null || petId === undefined) { throw new Error('Required parameter petId was null or undefined when calling getPetById.'); } @@ -333,6 +339,7 @@ export class PetService { public updatePet(body: Pet, observe?: 'response', reportProgress?: boolean): Observable>; public updatePet(body: Pet, observe?: 'events', reportProgress?: boolean): Observable>; public updatePet(body: Pet, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling updatePet.'); } @@ -391,10 +398,13 @@ export class PetService { public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'response', reportProgress?: boolean): Observable>; public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'events', reportProgress?: boolean): Observable>; public updatePetWithForm(petId: number, name?: string, status?: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (petId === null || petId === undefined) { throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); } + + let headers = this.defaultHeaders; // authentication (petstore_auth) required @@ -422,7 +432,7 @@ export class PetService { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; if (useForm) { @@ -462,10 +472,13 @@ export class PetService { public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'response', reportProgress?: boolean): Observable>; public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'events', reportProgress?: boolean): Observable>; public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (petId === null || petId === undefined) { throw new Error('Required parameter petId was null or undefined when calling uploadFile.'); } + + let headers = this.defaultHeaders; // authentication (petstore_auth) required @@ -492,7 +505,7 @@ export class PetService { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void; }; + let formParams: { append(param: string, value: any): void | HttpParams; }; let useForm = false; let convertFormParamsToString = false; // use FormData to transmit files using content-type "multipart/form-data" diff --git a/samples/client/petstore/typescript-angular-v6/npm/api/store.service.ts b/samples/client/petstore/typescript-angular-v6/npm/api/store.service.ts index c8e83fb6416..4646f5723d3 100644 --- a/samples/client/petstore/typescript-angular-v6/npm/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v6/npm/api/store.service.ts @@ -67,6 +67,7 @@ export class StoreService { public deleteOrder(orderId: string, observe?: 'response', reportProgress?: boolean): Observable>; public deleteOrder(orderId: string, observe?: 'events', reportProgress?: boolean): Observable>; public deleteOrder(orderId: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (orderId === null || orderId === undefined) { throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); } @@ -149,6 +150,7 @@ export class StoreService { public getOrderById(orderId: number, observe?: 'response', reportProgress?: boolean): Observable>; public getOrderById(orderId: number, observe?: 'events', reportProgress?: boolean): Observable>; public getOrderById(orderId: number, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (orderId === null || orderId === undefined) { throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); } @@ -190,6 +192,7 @@ export class StoreService { public placeOrder(body: Order, observe?: 'response', reportProgress?: boolean): Observable>; public placeOrder(body: Order, observe?: 'events', reportProgress?: boolean): Observable>; public placeOrder(body: Order, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling placeOrder.'); } diff --git a/samples/client/petstore/typescript-angular-v6/npm/api/user.service.ts b/samples/client/petstore/typescript-angular-v6/npm/api/user.service.ts index c6ea28aa921..f80c6132ef8 100644 --- a/samples/client/petstore/typescript-angular-v6/npm/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v6/npm/api/user.service.ts @@ -67,6 +67,7 @@ export class UserService { public createUser(body: User, observe?: 'response', reportProgress?: boolean): Observable>; public createUser(body: User, observe?: 'events', reportProgress?: boolean): Observable>; public createUser(body: User, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling createUser.'); } @@ -113,6 +114,7 @@ export class UserService { public createUsersWithArrayInput(body: Array, observe?: 'response', reportProgress?: boolean): Observable>; public createUsersWithArrayInput(body: Array, observe?: 'events', reportProgress?: boolean): Observable>; public createUsersWithArrayInput(body: Array, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling createUsersWithArrayInput.'); } @@ -159,6 +161,7 @@ export class UserService { public createUsersWithListInput(body: Array, observe?: 'response', reportProgress?: boolean): Observable>; public createUsersWithListInput(body: Array, observe?: 'events', reportProgress?: boolean): Observable>; public createUsersWithListInput(body: Array, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling createUsersWithListInput.'); } @@ -205,6 +208,7 @@ export class UserService { public deleteUser(username: string, observe?: 'response', reportProgress?: boolean): Observable>; public deleteUser(username: string, observe?: 'events', reportProgress?: boolean): Observable>; public deleteUser(username: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling deleteUser.'); } @@ -246,6 +250,7 @@ export class UserService { public getUserByName(username: string, observe?: 'response', reportProgress?: boolean): Observable>; public getUserByName(username: string, observe?: 'events', reportProgress?: boolean): Observable>; public getUserByName(username: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling getUserByName.'); } @@ -288,9 +293,11 @@ export class UserService { public loginUser(username: string, password: string, observe?: 'response', reportProgress?: boolean): Observable>; public loginUser(username: string, password: string, observe?: 'events', reportProgress?: boolean): Observable>; public loginUser(username: string, password: string, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling loginUser.'); } + if (password === null || password === undefined) { throw new Error('Required parameter password was null or undefined when calling loginUser.'); } @@ -379,9 +386,11 @@ export class UserService { public updateUser(username: string, body: User, observe?: 'response', reportProgress?: boolean): Observable>; public updateUser(username: string, body: User, observe?: 'events', reportProgress?: boolean): Observable>; public updateUser(username: string, body: User, observe: any = 'body', reportProgress: boolean = false ): Observable { + if (username === null || username === undefined) { throw new Error('Required parameter username was null or undefined when calling updateUser.'); } + if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling updateUser.'); } diff --git a/samples/client/petstore/typescript-angular-v6/npm/model/models.ts b/samples/client/petstore/typescript-angular-v6/npm/model/models.ts index 8607c5dabd0..f6aebdbf709 100644 --- a/samples/client/petstore/typescript-angular-v6/npm/model/models.ts +++ b/samples/client/petstore/typescript-angular-v6/npm/model/models.ts @@ -1,5 +1,7 @@ +export * from './amount'; export * from './apiResponse'; export * from './category'; +export * from './currency'; export * from './order'; export * from './pet'; export * from './tag'; From 530484f571d758003e09fd4210f5d03c4e769cb2 Mon Sep 17 00:00:00 2001 From: "m.buils" Date: Tue, 15 Jan 2019 11:38:43 +0100 Subject: [PATCH 2/2] [typescript-angular] error TS1345: An expression of type 'void' cannot be tested for truthiness - revert stub --- .../typescript-angular/api/fake.service.ts | 2 +- .../typescript-angular2/api/fake.service.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/client/petstore-security-test/typescript-angular/api/fake.service.ts b/samples/client/petstore-security-test/typescript-angular/api/fake.service.ts index 3126bb86e55..d0047d78bee 100644 --- a/samples/client/petstore-security-test/typescript-angular/api/fake.service.ts +++ b/samples/client/petstore-security-test/typescript-angular/api/fake.service.ts @@ -87,7 +87,7 @@ export class FakeService { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void | HttpParams; }; + let formParams: { append(param: string, value: any): void; }; let useForm = false; let convertFormParamsToString = false; if (useForm) { diff --git a/samples/client/petstore-security-test/typescript-angular2/api/fake.service.ts b/samples/client/petstore-security-test/typescript-angular2/api/fake.service.ts index 3126bb86e55..d0047d78bee 100644 --- a/samples/client/petstore-security-test/typescript-angular2/api/fake.service.ts +++ b/samples/client/petstore-security-test/typescript-angular2/api/fake.service.ts @@ -87,7 +87,7 @@ export class FakeService { const canConsumeForm = this.canConsumeForm(consumes); - let formParams: { append(param: string, value: any): void | HttpParams; }; + let formParams: { append(param: string, value: any): void; }; let useForm = false; let convertFormParamsToString = false; if (useForm) {