From 1d634a8783c8910fb06d00626cc8a4d0601c1cf0 Mon Sep 17 00:00:00 2001 From: aanno2 Date: Wed, 13 Nov 2019 16:16:40 +0100 Subject: [PATCH 01/10] https://github.com/OpenAPITools/openapi-generator/pull/4407 squashed from original, and better author (I failed to refer the right PR the first time) --- .../typescript-angular/api.service.mustache | 47 ++++++++++++++++++- .../default/api/pet.service.ts | 47 ++++++++++++++++++- .../default/api/store.service.ts | 41 ++++++++++++++++ .../default/api/user.service.ts | 47 ++++++++++++++++++- .../npm/api/pet.service.ts | 47 ++++++++++++++++++- .../npm/api/store.service.ts | 41 ++++++++++++++++ .../npm/api/user.service.ts | 47 ++++++++++++++++++- .../with-interfaces/api/pet.service.ts | 47 ++++++++++++++++++- .../with-interfaces/api/store.service.ts | 41 ++++++++++++++++ .../with-interfaces/api/user.service.ts | 47 ++++++++++++++++++- .../npm/api/pet.service.ts | 47 ++++++++++++++++++- .../npm/api/store.service.ts | 41 ++++++++++++++++ .../npm/api/user.service.ts | 47 ++++++++++++++++++- .../npm/api/pet.service.ts | 47 ++++++++++++++++++- .../npm/api/store.service.ts | 41 ++++++++++++++++ .../npm/api/user.service.ts | 47 ++++++++++++++++++- .../builds/default/api/pet.service.ts | 47 ++++++++++++++++++- .../builds/default/api/store.service.ts | 41 ++++++++++++++++ .../builds/default/api/user.service.ts | 47 ++++++++++++++++++- .../builds/with-npm/api/pet.service.ts | 47 ++++++++++++++++++- .../builds/with-npm/api/store.service.ts | 41 ++++++++++++++++ .../builds/with-npm/api/user.service.ts | 47 ++++++++++++++++++- .../builds/default/api/pet.service.ts | 47 ++++++++++++++++++- .../builds/default/api/store.service.ts | 41 ++++++++++++++++ .../builds/default/api/user.service.ts | 47 ++++++++++++++++++- .../builds/with-npm/api/pet.service.ts | 47 ++++++++++++++++++- .../builds/with-npm/api/store.service.ts | 41 ++++++++++++++++ .../builds/with-npm/api/user.service.ts | 47 ++++++++++++++++++- .../builds/default/api/pet.service.ts | 47 ++++++++++++++++++- .../builds/default/api/store.service.ts | 41 ++++++++++++++++ .../builds/default/api/user.service.ts | 47 ++++++++++++++++++- .../builds/with-npm/api/pet.service.ts | 47 ++++++++++++++++++- .../builds/with-npm/api/store.service.ts | 41 ++++++++++++++++ .../builds/with-npm/api/user.service.ts | 47 ++++++++++++++++++- .../builds/default/api/pet.service.ts | 47 ++++++++++++++++++- .../builds/default/api/store.service.ts | 41 ++++++++++++++++ .../builds/default/api/user.service.ts | 47 ++++++++++++++++++- .../builds/with-npm/api/pet.service.ts | 47 ++++++++++++++++++- .../builds/with-npm/api/store.service.ts | 41 ++++++++++++++++ .../builds/with-npm/api/user.service.ts | 47 ++++++++++++++++++- .../builds/with-npm/api/pet.service.ts | 47 ++++++++++++++++++- .../builds/with-npm/api/store.service.ts | 41 ++++++++++++++++ .../builds/with-npm/api/user.service.ts | 47 ++++++++++++++++++- .../api/pet.service.ts | 47 ++++++++++++++++++- .../api/store.service.ts | 41 ++++++++++++++++ .../api/user.service.ts | 47 ++++++++++++++++++- 46 files changed, 2010 insertions(+), 62 deletions(-) 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 912ecf6e5aca..0218c1463c16 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 @@ -151,6 +151,47 @@ export class {{classname}} { {{/operation}} {{/useHttpClient}} + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + {{#useHttpClient}}httpParams = {{/useHttpClient}}this.addToHttpParamsRecursive(httpParams, value); + } else { + {{#useHttpClient}}httpParams = {{/useHttpClient}}this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + {{#useHttpClient}}httpParams = {{/useHttpClient}}httpParams.append(key, + (value as Date).toISOString(){{^isDateTime}}.substr(0, 10)){{/isDateTime}}; + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => {{#useHttpClient}}httpParams = {{/useHttpClient}}this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + {{#useHttpClient}}httpParams = {{/useHttpClient}}httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + {{#operation}} /** {{#summary}} @@ -206,11 +247,13 @@ export class {{classname}} { if ({{paramName}}) { {{#isCollectionFormatMulti}} {{paramName}}.forEach((element) => { - {{#useHttpClient}}queryParameters = {{/useHttpClient}}queryParameters.append('{{baseName}}', element); + {{#useHttpClient}}queryParameters = {{/useHttpClient}}this.addToHttpParams(queryParameters, + element, '{{baseName}}'); }) {{/isCollectionFormatMulti}} {{^isCollectionFormatMulti}} - {{#useHttpClient}}queryParameters = {{/useHttpClient}}queryParameters.set('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}'])); + {{#useHttpClient}}queryParameters = {{/useHttpClient}}this.addToHttpParams(queryParameters, + {{paramName}}, '{{baseName}}'); {{/isCollectionFormatMulti}} } {{/isListContainer}} 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 1e305aa26e26..fb1315ff63a1 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 @@ -204,6 +204,47 @@ export class PetService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + this.addToHttpParamsRecursive(httpParams, value); + } else { + this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Add a new pet to the store * @param body Pet object that needs to be added to the store @@ -321,7 +362,8 @@ export class PetService { let queryParameters = new URLSearchParams('', this.encoder); if (status) { - queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); + this.addToHttpParams(queryParameters, + status, 'status'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 @@ -375,7 +417,8 @@ export class PetService { let queryParameters = new URLSearchParams('', this.encoder); if (tags) { - queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); + this.addToHttpParams(queryParameters, + tags, 'tags'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 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 dd89404c1b8c..b6b31aefabde 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 @@ -116,6 +116,47 @@ export class StoreService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + this.addToHttpParamsRecursive(httpParams, value); + } else { + this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 e7f2aed548aa..3b2050415a9d 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 @@ -186,6 +186,47 @@ export class UserService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + this.addToHttpParamsRecursive(httpParams, value); + } else { + this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Create user * This can only be done by the logged in user. @@ -417,10 +458,12 @@ export class UserService { let queryParameters = new URLSearchParams('', this.encoder); if (username !== undefined && username !== null) { - queryParameters.set('username', username); + this.addToHttpParams(queryParameters, + username, 'username'); } if (password !== undefined && password !== null) { - queryParameters.set('password', password); + this.addToHttpParams(queryParameters, + password, 'password'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 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 1e305aa26e26..fb1315ff63a1 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 @@ -204,6 +204,47 @@ export class PetService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + this.addToHttpParamsRecursive(httpParams, value); + } else { + this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Add a new pet to the store * @param body Pet object that needs to be added to the store @@ -321,7 +362,8 @@ export class PetService { let queryParameters = new URLSearchParams('', this.encoder); if (status) { - queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); + this.addToHttpParams(queryParameters, + status, 'status'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 @@ -375,7 +417,8 @@ export class PetService { let queryParameters = new URLSearchParams('', this.encoder); if (tags) { - queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); + this.addToHttpParams(queryParameters, + tags, 'tags'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 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 dd89404c1b8c..b6b31aefabde 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 @@ -116,6 +116,47 @@ export class StoreService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + this.addToHttpParamsRecursive(httpParams, value); + } else { + this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 e7f2aed548aa..3b2050415a9d 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 @@ -186,6 +186,47 @@ export class UserService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + this.addToHttpParamsRecursive(httpParams, value); + } else { + this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Create user * This can only be done by the logged in user. @@ -417,10 +458,12 @@ export class UserService { let queryParameters = new URLSearchParams('', this.encoder); if (username !== undefined && username !== null) { - queryParameters.set('username', username); + this.addToHttpParams(queryParameters, + username, 'username'); } if (password !== undefined && password !== null) { - queryParameters.set('password', password); + this.addToHttpParams(queryParameters, + password, 'password'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 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 5225e2ceddc7..7af10bea9810 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 @@ -207,6 +207,47 @@ export class PetService implements PetServiceInterface { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + this.addToHttpParamsRecursive(httpParams, value); + } else { + this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Add a new pet to the store * @param body Pet object that needs to be added to the store @@ -324,7 +365,8 @@ export class PetService implements PetServiceInterface { let queryParameters = new URLSearchParams('', this.encoder); if (status) { - queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); + this.addToHttpParams(queryParameters, + status, 'status'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 @@ -378,7 +420,8 @@ export class PetService implements PetServiceInterface { let queryParameters = new URLSearchParams('', this.encoder); if (tags) { - queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); + this.addToHttpParams(queryParameters, + tags, 'tags'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 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 b2b11558a35b..66e410c50a81 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 @@ -119,6 +119,47 @@ export class StoreService implements StoreServiceInterface { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + this.addToHttpParamsRecursive(httpParams, value); + } else { + this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 3b7effa5d28e..265b9894e933 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 @@ -189,6 +189,47 @@ export class UserService implements UserServiceInterface { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + this.addToHttpParamsRecursive(httpParams, value); + } else { + this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Create user * This can only be done by the logged in user. @@ -420,10 +461,12 @@ export class UserService implements UserServiceInterface { let queryParameters = new URLSearchParams('', this.encoder); if (username !== undefined && username !== null) { - queryParameters.set('username', username); + this.addToHttpParams(queryParameters, + username, 'username'); } if (password !== undefined && password !== null) { - queryParameters.set('password', password); + this.addToHttpParams(queryParameters, + password, 'password'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 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 575d13d46896..e4c64bb82f5b 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 @@ -61,6 +61,47 @@ export class PetService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Add a new pet to the store * @param body Pet object that needs to be added to the store @@ -197,7 +238,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { - queryParameters = queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + status, 'status'); } let headers = this.defaultHeaders; @@ -258,7 +300,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { - queryParameters = queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + tags, 'tags'); } let headers = this.defaultHeaders; 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 e275f1bb4e34..7dfa9709e240 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 @@ -47,6 +47,47 @@ export class StoreService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 79bb71eab44a..12aa72444843 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 @@ -47,6 +47,47 @@ export class UserService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Create user * This can only be done by the logged in user. @@ -318,10 +359,12 @@ export class UserService { let queryParameters = new HttpParams({encoder: this.encoder}); if (username !== undefined && username !== null) { - queryParameters = queryParameters.set('username', username); + queryParameters = this.addToHttpParams(queryParameters, + username, 'username'); } if (password !== undefined && password !== null) { - queryParameters = queryParameters.set('password', password); + queryParameters = this.addToHttpParams(queryParameters, + password, 'password'); } let headers = this.defaultHeaders; 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 1e305aa26e26..fb1315ff63a1 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 @@ -204,6 +204,47 @@ export class PetService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + this.addToHttpParamsRecursive(httpParams, value); + } else { + this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Add a new pet to the store * @param body Pet object that needs to be added to the store @@ -321,7 +362,8 @@ export class PetService { let queryParameters = new URLSearchParams('', this.encoder); if (status) { - queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); + this.addToHttpParams(queryParameters, + status, 'status'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 @@ -375,7 +417,8 @@ export class PetService { let queryParameters = new URLSearchParams('', this.encoder); if (tags) { - queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); + this.addToHttpParams(queryParameters, + tags, 'tags'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 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 dd89404c1b8c..b6b31aefabde 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 @@ -116,6 +116,47 @@ export class StoreService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + this.addToHttpParamsRecursive(httpParams, value); + } else { + this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 e7f2aed548aa..3b2050415a9d 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 @@ -186,6 +186,47 @@ export class UserService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + this.addToHttpParamsRecursive(httpParams, value); + } else { + this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Create user * This can only be done by the logged in user. @@ -417,10 +458,12 @@ export class UserService { let queryParameters = new URLSearchParams('', this.encoder); if (username !== undefined && username !== null) { - queryParameters.set('username', username); + this.addToHttpParams(queryParameters, + username, 'username'); } if (password !== undefined && password !== null) { - queryParameters.set('password', password); + this.addToHttpParams(queryParameters, + password, 'password'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 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 3baa93b09d48..c6922a2b6664 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 @@ -61,6 +61,47 @@ export class PetService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Add a new pet to the store * @param body Pet object that needs to be added to the store @@ -197,7 +238,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { - queryParameters = queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + status, 'status'); } let headers = this.defaultHeaders; @@ -258,7 +300,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { - queryParameters = queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + tags, 'tags'); } let headers = this.defaultHeaders; 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 9423bd8b423e..2547c8bdc6bf 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 @@ -47,6 +47,47 @@ export class StoreService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 0cefb7e9a47d..7399d04a80a2 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 @@ -47,6 +47,47 @@ export class UserService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Create user * This can only be done by the logged in user. @@ -318,10 +359,12 @@ export class UserService { let queryParameters = new HttpParams({encoder: this.encoder}); if (username !== undefined && username !== null) { - queryParameters = queryParameters.set('username', username); + queryParameters = this.addToHttpParams(queryParameters, + username, 'username'); } if (password !== undefined && password !== null) { - queryParameters = queryParameters.set('password', password); + queryParameters = this.addToHttpParams(queryParameters, + password, 'password'); } let headers = this.defaultHeaders; 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 3baa93b09d48..c6922a2b6664 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 @@ -61,6 +61,47 @@ export class PetService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Add a new pet to the store * @param body Pet object that needs to be added to the store @@ -197,7 +238,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { - queryParameters = queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + status, 'status'); } let headers = this.defaultHeaders; @@ -258,7 +300,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { - queryParameters = queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + tags, 'tags'); } let headers = this.defaultHeaders; 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 9423bd8b423e..2547c8bdc6bf 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 @@ -47,6 +47,47 @@ export class StoreService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 0cefb7e9a47d..7399d04a80a2 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 @@ -47,6 +47,47 @@ export class UserService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Create user * This can only be done by the logged in user. @@ -318,10 +359,12 @@ export class UserService { let queryParameters = new HttpParams({encoder: this.encoder}); if (username !== undefined && username !== null) { - queryParameters = queryParameters.set('username', username); + queryParameters = this.addToHttpParams(queryParameters, + username, 'username'); } if (password !== undefined && password !== null) { - queryParameters = queryParameters.set('password', password); + queryParameters = this.addToHttpParams(queryParameters, + password, 'password'); } let headers = this.defaultHeaders; 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 752adbf45c78..1cb5d935d115 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 @@ -63,6 +63,47 @@ export class PetService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Add a new pet to the store * @param body Pet object that needs to be added to the store @@ -199,7 +240,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { - queryParameters = queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + status, 'status'); } let headers = this.defaultHeaders; @@ -260,7 +302,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { - queryParameters = queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + tags, 'tags'); } let headers = this.defaultHeaders; 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 478959481a98..5b5b3ecbd986 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 @@ -49,6 +49,47 @@ export class StoreService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 6240c41d44a2..213c05ab4d3a 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 @@ -49,6 +49,47 @@ export class UserService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Create user * This can only be done by the logged in user. @@ -320,10 +361,12 @@ export class UserService { let queryParameters = new HttpParams({encoder: this.encoder}); if (username !== undefined && username !== null) { - queryParameters = queryParameters.set('username', username); + queryParameters = this.addToHttpParams(queryParameters, + username, 'username'); } if (password !== undefined && password !== null) { - queryParameters = queryParameters.set('password', password); + queryParameters = this.addToHttpParams(queryParameters, + password, 'password'); } let headers = this.defaultHeaders; 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 752adbf45c78..1cb5d935d115 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 @@ -63,6 +63,47 @@ export class PetService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Add a new pet to the store * @param body Pet object that needs to be added to the store @@ -199,7 +240,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { - queryParameters = queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + status, 'status'); } let headers = this.defaultHeaders; @@ -260,7 +302,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { - queryParameters = queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + tags, 'tags'); } let headers = this.defaultHeaders; 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 478959481a98..5b5b3ecbd986 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 @@ -49,6 +49,47 @@ export class StoreService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 6240c41d44a2..213c05ab4d3a 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 @@ -49,6 +49,47 @@ export class UserService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Create user * This can only be done by the logged in user. @@ -320,10 +361,12 @@ export class UserService { let queryParameters = new HttpParams({encoder: this.encoder}); if (username !== undefined && username !== null) { - queryParameters = queryParameters.set('username', username); + queryParameters = this.addToHttpParams(queryParameters, + username, 'username'); } if (password !== undefined && password !== null) { - queryParameters = queryParameters.set('password', password); + queryParameters = this.addToHttpParams(queryParameters, + password, 'password'); } let headers = this.defaultHeaders; 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 3baa93b09d48..c6922a2b6664 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 @@ -61,6 +61,47 @@ export class PetService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Add a new pet to the store * @param body Pet object that needs to be added to the store @@ -197,7 +238,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { - queryParameters = queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + status, 'status'); } let headers = this.defaultHeaders; @@ -258,7 +300,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { - queryParameters = queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + tags, 'tags'); } let headers = this.defaultHeaders; 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 9423bd8b423e..2547c8bdc6bf 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 @@ -47,6 +47,47 @@ export class StoreService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 0cefb7e9a47d..7399d04a80a2 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 @@ -47,6 +47,47 @@ export class UserService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Create user * This can only be done by the logged in user. @@ -318,10 +359,12 @@ export class UserService { let queryParameters = new HttpParams({encoder: this.encoder}); if (username !== undefined && username !== null) { - queryParameters = queryParameters.set('username', username); + queryParameters = this.addToHttpParams(queryParameters, + username, 'username'); } if (password !== undefined && password !== null) { - queryParameters = queryParameters.set('password', password); + queryParameters = this.addToHttpParams(queryParameters, + password, 'password'); } let headers = this.defaultHeaders; 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 3baa93b09d48..c6922a2b6664 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 @@ -61,6 +61,47 @@ export class PetService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Add a new pet to the store * @param body Pet object that needs to be added to the store @@ -197,7 +238,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { - queryParameters = queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + status, 'status'); } let headers = this.defaultHeaders; @@ -258,7 +300,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { - queryParameters = queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + tags, 'tags'); } let headers = this.defaultHeaders; 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 9423bd8b423e..2547c8bdc6bf 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 @@ -47,6 +47,47 @@ export class StoreService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 0cefb7e9a47d..7399d04a80a2 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 @@ -47,6 +47,47 @@ export class UserService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Create user * This can only be done by the logged in user. @@ -318,10 +359,12 @@ export class UserService { let queryParameters = new HttpParams({encoder: this.encoder}); if (username !== undefined && username !== null) { - queryParameters = queryParameters.set('username', username); + queryParameters = this.addToHttpParams(queryParameters, + username, 'username'); } if (password !== undefined && password !== null) { - queryParameters = queryParameters.set('password', password); + queryParameters = this.addToHttpParams(queryParameters, + password, 'password'); } let headers = this.defaultHeaders; 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 752adbf45c78..1cb5d935d115 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 @@ -63,6 +63,47 @@ export class PetService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Add a new pet to the store * @param body Pet object that needs to be added to the store @@ -199,7 +240,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { - queryParameters = queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + status, 'status'); } let headers = this.defaultHeaders; @@ -260,7 +302,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { - queryParameters = queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + tags, 'tags'); } let headers = this.defaultHeaders; 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 478959481a98..5b5b3ecbd986 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 @@ -49,6 +49,47 @@ export class StoreService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 6240c41d44a2..213c05ab4d3a 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 @@ -49,6 +49,47 @@ export class UserService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Create user * This can only be done by the logged in user. @@ -320,10 +361,12 @@ export class UserService { let queryParameters = new HttpParams({encoder: this.encoder}); if (username !== undefined && username !== null) { - queryParameters = queryParameters.set('username', username); + queryParameters = this.addToHttpParams(queryParameters, + username, 'username'); } if (password !== undefined && password !== null) { - queryParameters = queryParameters.set('password', password); + queryParameters = this.addToHttpParams(queryParameters, + password, 'password'); } let headers = this.defaultHeaders; 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 752adbf45c78..1cb5d935d115 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 @@ -63,6 +63,47 @@ export class PetService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Add a new pet to the store * @param body Pet object that needs to be added to the store @@ -199,7 +240,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { - queryParameters = queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + status, 'status'); } let headers = this.defaultHeaders; @@ -260,7 +302,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { - queryParameters = queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + tags, 'tags'); } let headers = this.defaultHeaders; 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 478959481a98..5b5b3ecbd986 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 @@ -49,6 +49,47 @@ export class StoreService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 6240c41d44a2..213c05ab4d3a 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 @@ -49,6 +49,47 @@ export class UserService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Create user * This can only be done by the logged in user. @@ -320,10 +361,12 @@ export class UserService { let queryParameters = new HttpParams({encoder: this.encoder}); if (username !== undefined && username !== null) { - queryParameters = queryParameters.set('username', username); + queryParameters = this.addToHttpParams(queryParameters, + username, 'username'); } if (password !== undefined && password !== null) { - queryParameters = queryParameters.set('password', password); + queryParameters = this.addToHttpParams(queryParameters, + password, 'password'); } let headers = this.defaultHeaders; 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 752adbf45c78..1cb5d935d115 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 @@ -63,6 +63,47 @@ export class PetService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Add a new pet to the store * @param body Pet object that needs to be added to the store @@ -199,7 +240,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { - queryParameters = queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + status, 'status'); } let headers = this.defaultHeaders; @@ -260,7 +302,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { - queryParameters = queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + tags, 'tags'); } let headers = this.defaultHeaders; 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 478959481a98..5b5b3ecbd986 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 @@ -49,6 +49,47 @@ export class StoreService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 6240c41d44a2..213c05ab4d3a 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 @@ -49,6 +49,47 @@ export class UserService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Create user * This can only be done by the logged in user. @@ -320,10 +361,12 @@ export class UserService { let queryParameters = new HttpParams({encoder: this.encoder}); if (username !== undefined && username !== null) { - queryParameters = queryParameters.set('username', username); + queryParameters = this.addToHttpParams(queryParameters, + username, 'username'); } if (password !== undefined && password !== null) { - queryParameters = queryParameters.set('password', password); + queryParameters = this.addToHttpParams(queryParameters, + password, 'password'); } let headers = this.defaultHeaders; diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts index 752adbf45c78..1cb5d935d115 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts @@ -63,6 +63,47 @@ export class PetService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Add a new pet to the store * @param body Pet object that needs to be added to the store @@ -199,7 +240,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { - queryParameters = queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + status, 'status'); } let headers = this.defaultHeaders; @@ -260,7 +302,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { - queryParameters = queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + tags, 'tags'); } let headers = this.defaultHeaders; diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts index 478959481a98..5b5b3ecbd986 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts @@ -49,6 +49,47 @@ export class StoreService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts index 6240c41d44a2..213c05ab4d3a 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts @@ -49,6 +49,47 @@ export class UserService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (this.isArrayLike(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + + private isArrayLike(obj: any): boolean { + return (Array.isArray(obj) || + typeof obj === "object" && + typeof (obj.length) === "number" && + (obj.length === 0 || + (obj.length > 0 && (obj.length - 1) in obj)) + ); + } + /** * Create user * This can only be done by the logged in user. @@ -320,10 +361,12 @@ export class UserService { let queryParameters = new HttpParams({encoder: this.encoder}); if (username !== undefined && username !== null) { - queryParameters = queryParameters.set('username', username); + queryParameters = this.addToHttpParams(queryParameters, + username, 'username'); } if (password !== undefined && password !== null) { - queryParameters = queryParameters.set('password', password); + queryParameters = this.addToHttpParams(queryParameters, + password, 'password'); } let headers = this.defaultHeaders; From 66bf7b71d82c708c9ffebdbfb9133601e75166c7 Mon Sep 17 00:00:00 2001 From: aanno2 Date: Thu, 14 Nov 2019 09:54:42 +0100 Subject: [PATCH 02/10] removed isArrayLike in favour of Array.isArray --- .../resources/typescript-angular/api.service.mustache | 11 +---------- .../typescript-angular-v2/default/api/pet.service.ts | 11 +---------- .../default/api/store.service.ts | 11 +---------- .../typescript-angular-v2/default/api/user.service.ts | 11 +---------- .../typescript-angular-v2/npm/api/pet.service.ts | 11 +---------- .../typescript-angular-v2/npm/api/store.service.ts | 11 +---------- .../typescript-angular-v2/npm/api/user.service.ts | 11 +---------- .../with-interfaces/api/pet.service.ts | 11 +---------- .../with-interfaces/api/store.service.ts | 11 +---------- .../with-interfaces/api/user.service.ts | 11 +---------- .../typescript-angular-v4.3/npm/api/pet.service.ts | 11 +---------- .../typescript-angular-v4.3/npm/api/store.service.ts | 11 +---------- .../typescript-angular-v4.3/npm/api/user.service.ts | 11 +---------- .../typescript-angular-v4/npm/api/pet.service.ts | 11 +---------- .../typescript-angular-v4/npm/api/store.service.ts | 11 +---------- .../typescript-angular-v4/npm/api/user.service.ts | 11 +---------- .../builds/default/api/pet.service.ts | 11 +---------- .../builds/default/api/store.service.ts | 11 +---------- .../builds/default/api/user.service.ts | 11 +---------- .../builds/with-npm/api/pet.service.ts | 11 +---------- .../builds/with-npm/api/store.service.ts | 11 +---------- .../builds/with-npm/api/user.service.ts | 11 +---------- .../builds/default/api/pet.service.ts | 11 +---------- .../builds/default/api/store.service.ts | 11 +---------- .../builds/default/api/user.service.ts | 11 +---------- .../builds/with-npm/api/pet.service.ts | 11 +---------- .../builds/with-npm/api/store.service.ts | 11 +---------- .../builds/with-npm/api/user.service.ts | 11 +---------- .../builds/default/api/pet.service.ts | 11 +---------- .../builds/default/api/store.service.ts | 11 +---------- .../builds/default/api/user.service.ts | 11 +---------- .../builds/with-npm/api/pet.service.ts | 11 +---------- .../builds/with-npm/api/store.service.ts | 11 +---------- .../builds/with-npm/api/user.service.ts | 11 +---------- .../builds/default/api/pet.service.ts | 11 +---------- .../builds/default/api/store.service.ts | 11 +---------- .../builds/default/api/user.service.ts | 11 +---------- .../builds/with-npm/api/pet.service.ts | 11 +---------- .../builds/with-npm/api/store.service.ts | 11 +---------- .../builds/with-npm/api/user.service.ts | 11 +---------- .../builds/with-npm/api/pet.service.ts | 11 +---------- .../builds/with-npm/api/store.service.ts | 11 +---------- .../builds/with-npm/api/user.service.ts | 11 +---------- .../with-prefixed-module-name/api/pet.service.ts | 11 +---------- .../with-prefixed-module-name/api/store.service.ts | 11 +---------- .../with-prefixed-module-name/api/user.service.ts | 11 +---------- 46 files changed, 46 insertions(+), 460 deletions(-) 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 0218c1463c16..e4fe2c740f59 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 @@ -162,7 +162,7 @@ export class {{classname}} { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -183,15 +183,6 @@ export class {{classname}} { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - {{#operation}} /** {{#summary}} 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 fb1315ff63a1..8a6d751d82f2 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 @@ -215,7 +215,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -236,15 +236,6 @@ export class PetService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Add a new pet to the store * @param body Pet object that needs to be added to the store 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 b6b31aefabde..8a0fb5ce8c43 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 @@ -127,7 +127,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -148,15 +148,6 @@ export class StoreService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 3b2050415a9d..3165c96bd357 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 @@ -197,7 +197,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -218,15 +218,6 @@ export class UserService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Create user * This can only be done by the logged in user. 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 fb1315ff63a1..8a6d751d82f2 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 @@ -215,7 +215,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -236,15 +236,6 @@ export class PetService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Add a new pet to the store * @param body Pet object that needs to be added to the store 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 b6b31aefabde..8a0fb5ce8c43 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 @@ -127,7 +127,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -148,15 +148,6 @@ export class StoreService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 3b2050415a9d..3165c96bd357 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 @@ -197,7 +197,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -218,15 +218,6 @@ export class UserService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Create user * This can only be done by the logged in user. 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 7af10bea9810..c350ea6f3458 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 @@ -218,7 +218,7 @@ export class PetService implements PetServiceInterface { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -239,15 +239,6 @@ export class PetService implements PetServiceInterface { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Add a new pet to the store * @param body Pet object that needs to be added to the store 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 66e410c50a81..1726a78c0974 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 @@ -130,7 +130,7 @@ export class StoreService implements StoreServiceInterface { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -151,15 +151,6 @@ export class StoreService implements StoreServiceInterface { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 265b9894e933..f9962706a264 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 @@ -200,7 +200,7 @@ export class UserService implements UserServiceInterface { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -221,15 +221,6 @@ export class UserService implements UserServiceInterface { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Create user * This can only be done by the logged in user. 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 e4c64bb82f5b..f97af6f1992d 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 @@ -72,7 +72,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -93,15 +93,6 @@ export class PetService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Add a new pet to the store * @param body Pet object that needs to be added to the store 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 7dfa9709e240..9282be1ef71b 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 @@ -58,7 +58,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -79,15 +79,6 @@ export class StoreService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 12aa72444843..8983b6ac58b9 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 @@ -58,7 +58,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -79,15 +79,6 @@ export class UserService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Create user * This can only be done by the logged in user. 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 fb1315ff63a1..8a6d751d82f2 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 @@ -215,7 +215,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -236,15 +236,6 @@ export class PetService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Add a new pet to the store * @param body Pet object that needs to be added to the store 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 b6b31aefabde..8a0fb5ce8c43 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 @@ -127,7 +127,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -148,15 +148,6 @@ export class StoreService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 3b2050415a9d..3165c96bd357 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 @@ -197,7 +197,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -218,15 +218,6 @@ export class UserService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Create user * This can only be done by the logged in user. 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 c6922a2b6664..bd124babae79 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 @@ -72,7 +72,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -93,15 +93,6 @@ export class PetService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Add a new pet to the store * @param body Pet object that needs to be added to the store 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 2547c8bdc6bf..61f75196572e 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 @@ -58,7 +58,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -79,15 +79,6 @@ export class StoreService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 7399d04a80a2..23a249c9ad4e 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 @@ -58,7 +58,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -79,15 +79,6 @@ export class UserService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Create user * This can only be done by the logged in user. 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 c6922a2b6664..bd124babae79 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 @@ -72,7 +72,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -93,15 +93,6 @@ export class PetService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Add a new pet to the store * @param body Pet object that needs to be added to the store 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 2547c8bdc6bf..61f75196572e 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 @@ -58,7 +58,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -79,15 +79,6 @@ export class StoreService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 7399d04a80a2..23a249c9ad4e 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 @@ -58,7 +58,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -79,15 +79,6 @@ export class UserService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Create user * This can only be done by the logged in user. 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 1cb5d935d115..1e657858bef4 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 @@ -74,7 +74,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -95,15 +95,6 @@ export class PetService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Add a new pet to the store * @param body Pet object that needs to be added to the store 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 5b5b3ecbd986..7b653ccaf04c 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 @@ -60,7 +60,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -81,15 +81,6 @@ export class StoreService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 213c05ab4d3a..c379a35dd604 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 @@ -60,7 +60,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -81,15 +81,6 @@ export class UserService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Create user * This can only be done by the logged in user. 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 1cb5d935d115..1e657858bef4 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 @@ -74,7 +74,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -95,15 +95,6 @@ export class PetService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Add a new pet to the store * @param body Pet object that needs to be added to the store 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 5b5b3ecbd986..7b653ccaf04c 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 @@ -60,7 +60,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -81,15 +81,6 @@ export class StoreService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 213c05ab4d3a..c379a35dd604 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 @@ -60,7 +60,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -81,15 +81,6 @@ export class UserService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Create user * This can only be done by the logged in user. 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 c6922a2b6664..bd124babae79 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 @@ -72,7 +72,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -93,15 +93,6 @@ export class PetService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Add a new pet to the store * @param body Pet object that needs to be added to the store 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 2547c8bdc6bf..61f75196572e 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 @@ -58,7 +58,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -79,15 +79,6 @@ export class StoreService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 7399d04a80a2..23a249c9ad4e 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 @@ -58,7 +58,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -79,15 +79,6 @@ export class UserService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Create user * This can only be done by the logged in user. 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 c6922a2b6664..bd124babae79 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 @@ -72,7 +72,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -93,15 +93,6 @@ export class PetService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Add a new pet to the store * @param body Pet object that needs to be added to the store 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 2547c8bdc6bf..61f75196572e 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 @@ -58,7 +58,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -79,15 +79,6 @@ export class StoreService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 7399d04a80a2..23a249c9ad4e 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 @@ -58,7 +58,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -79,15 +79,6 @@ export class UserService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Create user * This can only be done by the logged in user. 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 1cb5d935d115..1e657858bef4 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 @@ -74,7 +74,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -95,15 +95,6 @@ export class PetService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Add a new pet to the store * @param body Pet object that needs to be added to the store 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 5b5b3ecbd986..7b653ccaf04c 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 @@ -60,7 +60,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -81,15 +81,6 @@ export class StoreService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 213c05ab4d3a..c379a35dd604 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 @@ -60,7 +60,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -81,15 +81,6 @@ export class UserService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Create user * This can only be done by the logged in user. 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 1cb5d935d115..1e657858bef4 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 @@ -74,7 +74,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -95,15 +95,6 @@ export class PetService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Add a new pet to the store * @param body Pet object that needs to be added to the store 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 5b5b3ecbd986..7b653ccaf04c 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 @@ -60,7 +60,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -81,15 +81,6 @@ export class StoreService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 213c05ab4d3a..c379a35dd604 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 @@ -60,7 +60,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -81,15 +81,6 @@ export class UserService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Create user * This can only be done by the logged in user. 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 1cb5d935d115..1e657858bef4 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 @@ -74,7 +74,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -95,15 +95,6 @@ export class PetService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Add a new pet to the store * @param body Pet object that needs to be added to the store 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 5b5b3ecbd986..7b653ccaf04c 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 @@ -60,7 +60,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -81,15 +81,6 @@ export class StoreService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors 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 213c05ab4d3a..c379a35dd604 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 @@ -60,7 +60,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -81,15 +81,6 @@ export class UserService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Create user * This can only be done by the logged in user. diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts index 1cb5d935d115..1e657858bef4 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts @@ -74,7 +74,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -95,15 +95,6 @@ export class PetService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Add a new pet to the store * @param body Pet object that needs to be added to the store diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts index 5b5b3ecbd986..7b653ccaf04c 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts @@ -60,7 +60,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -81,15 +81,6 @@ export class StoreService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts index 213c05ab4d3a..c379a35dd604 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts @@ -60,7 +60,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { - if (this.isArrayLike(value)) { + if (Array.isArray(value)) { (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { @@ -81,15 +81,6 @@ export class UserService { return httpParams; } - private isArrayLike(obj: any): boolean { - return (Array.isArray(obj) || - typeof obj === "object" && - typeof (obj.length) === "number" && - (obj.length === 0 || - (obj.length > 0 && (obj.length - 1) in obj)) - ); - } - /** * Create user * This can only be done by the logged in user. From 1ffc33d74dd9dc2672ab896f4b2e7a79f1f35976 Mon Sep 17 00:00:00 2001 From: aanno2 Date: Thu, 14 Nov 2019 16:26:26 +0100 Subject: [PATCH 03/10] support collectionFormat the old way --- .../src/main/resources/typescript-angular/api.service.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e4fe2c740f59..bd8a04b2358b 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 @@ -244,7 +244,7 @@ export class {{classname}} { {{/isCollectionFormatMulti}} {{^isCollectionFormatMulti}} {{#useHttpClient}}queryParameters = {{/useHttpClient}}this.addToHttpParams(queryParameters, - {{paramName}}, '{{baseName}}'); + {{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}'])), '{{baseName}}'); {{/isCollectionFormatMulti}} } {{/isListContainer}} From 03bba347cb75b7050b693138356c4235c9494248 Mon Sep 17 00:00:00 2001 From: Thomas Pasch Date: Fri, 15 Nov 2019 10:13:46 +0100 Subject: [PATCH 04/10] fixed type and rebuild samples --- .../typescript-angular/api.service.mustache | 2 +- .../default/api/pet.service.ts | 4 +- .../npm/api/pet.service.ts | 4 +- .../with-interfaces/api/pet.service.ts | 4 +- .../npm/api/pet.service.ts | 4 +- .../npm/api/pet.service.ts | 4 +- .../builds/default/api/pet.service.ts | 4 +- .../builds/with-npm/api/pet.service.ts | 4 +- .../builds/default/api/pet.service.ts | 4 +- .../builds/with-npm/api/pet.service.ts | 4 +- .../builds/default/api/pet.service.ts | 4 +- .../builds/with-npm/api/pet.service.ts | 4 +- .../builds/default/api/pet.service.ts | 4 +- .../builds/with-npm/api/pet.service.ts | 4 +- .../builds/with-npm/api/pet.service.ts | 4 +- .../builds/with-npm/package.json | 43 +++------ .../builds/with-npm/tsconfig.json | 90 +++++++++++++------ .../api/pet.service.ts | 4 +- 18 files changed, 108 insertions(+), 87 deletions(-) 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 bd8a04b2358b..95713f159de7 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 @@ -244,7 +244,7 @@ export class {{classname}} { {{/isCollectionFormatMulti}} {{^isCollectionFormatMulti}} {{#useHttpClient}}queryParameters = {{/useHttpClient}}this.addToHttpParams(queryParameters, - {{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}'])), '{{baseName}}'); + {{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}']), '{{baseName}}'); {{/isCollectionFormatMulti}} } {{/isListContainer}} 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 8a6d751d82f2..762a4517cd02 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 @@ -354,7 +354,7 @@ export class PetService { let queryParameters = new URLSearchParams('', this.encoder); if (status) { this.addToHttpParams(queryParameters, - status, 'status'); + status.join(COLLECTION_FORMATS['csv']), 'status'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 @@ -409,7 +409,7 @@ export class PetService { let queryParameters = new URLSearchParams('', this.encoder); if (tags) { this.addToHttpParams(queryParameters, - tags, 'tags'); + tags.join(COLLECTION_FORMATS['csv']), 'tags'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 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 8a6d751d82f2..762a4517cd02 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 @@ -354,7 +354,7 @@ export class PetService { let queryParameters = new URLSearchParams('', this.encoder); if (status) { this.addToHttpParams(queryParameters, - status, 'status'); + status.join(COLLECTION_FORMATS['csv']), 'status'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 @@ -409,7 +409,7 @@ export class PetService { let queryParameters = new URLSearchParams('', this.encoder); if (tags) { this.addToHttpParams(queryParameters, - tags, 'tags'); + tags.join(COLLECTION_FORMATS['csv']), 'tags'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 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 c350ea6f3458..8952ab497171 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 @@ -357,7 +357,7 @@ export class PetService implements PetServiceInterface { let queryParameters = new URLSearchParams('', this.encoder); if (status) { this.addToHttpParams(queryParameters, - status, 'status'); + status.join(COLLECTION_FORMATS['csv']), 'status'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 @@ -412,7 +412,7 @@ export class PetService implements PetServiceInterface { let queryParameters = new URLSearchParams('', this.encoder); if (tags) { this.addToHttpParams(queryParameters, - tags, 'tags'); + tags.join(COLLECTION_FORMATS['csv']), 'tags'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 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 f97af6f1992d..25d866e1b82d 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 @@ -230,7 +230,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { queryParameters = this.addToHttpParams(queryParameters, - status, 'status'); + status.join(COLLECTION_FORMATS['csv']), 'status'); } let headers = this.defaultHeaders; @@ -292,7 +292,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { queryParameters = this.addToHttpParams(queryParameters, - tags, 'tags'); + tags.join(COLLECTION_FORMATS['csv']), 'tags'); } let headers = this.defaultHeaders; 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 8a6d751d82f2..762a4517cd02 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 @@ -354,7 +354,7 @@ export class PetService { let queryParameters = new URLSearchParams('', this.encoder); if (status) { this.addToHttpParams(queryParameters, - status, 'status'); + status.join(COLLECTION_FORMATS['csv']), 'status'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 @@ -409,7 +409,7 @@ export class PetService { let queryParameters = new URLSearchParams('', this.encoder); if (tags) { this.addToHttpParams(queryParameters, - tags, 'tags'); + tags.join(COLLECTION_FORMATS['csv']), 'tags'); } let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 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 bd124babae79..6db1d6cc5014 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 @@ -230,7 +230,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { queryParameters = this.addToHttpParams(queryParameters, - status, 'status'); + status.join(COLLECTION_FORMATS['csv']), 'status'); } let headers = this.defaultHeaders; @@ -292,7 +292,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { queryParameters = this.addToHttpParams(queryParameters, - tags, 'tags'); + tags.join(COLLECTION_FORMATS['csv']), 'tags'); } let headers = this.defaultHeaders; 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 bd124babae79..6db1d6cc5014 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 @@ -230,7 +230,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { queryParameters = this.addToHttpParams(queryParameters, - status, 'status'); + status.join(COLLECTION_FORMATS['csv']), 'status'); } let headers = this.defaultHeaders; @@ -292,7 +292,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { queryParameters = this.addToHttpParams(queryParameters, - tags, 'tags'); + tags.join(COLLECTION_FORMATS['csv']), 'tags'); } let headers = this.defaultHeaders; 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 1e657858bef4..748ce453c043 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 @@ -232,7 +232,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { queryParameters = this.addToHttpParams(queryParameters, - status, 'status'); + status.join(COLLECTION_FORMATS['csv']), 'status'); } let headers = this.defaultHeaders; @@ -294,7 +294,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { queryParameters = this.addToHttpParams(queryParameters, - tags, 'tags'); + tags.join(COLLECTION_FORMATS['csv']), 'tags'); } let headers = this.defaultHeaders; 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 1e657858bef4..748ce453c043 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 @@ -232,7 +232,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { queryParameters = this.addToHttpParams(queryParameters, - status, 'status'); + status.join(COLLECTION_FORMATS['csv']), 'status'); } let headers = this.defaultHeaders; @@ -294,7 +294,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { queryParameters = this.addToHttpParams(queryParameters, - tags, 'tags'); + tags.join(COLLECTION_FORMATS['csv']), 'tags'); } let headers = this.defaultHeaders; 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 bd124babae79..6db1d6cc5014 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 @@ -230,7 +230,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { queryParameters = this.addToHttpParams(queryParameters, - status, 'status'); + status.join(COLLECTION_FORMATS['csv']), 'status'); } let headers = this.defaultHeaders; @@ -292,7 +292,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { queryParameters = this.addToHttpParams(queryParameters, - tags, 'tags'); + tags.join(COLLECTION_FORMATS['csv']), 'tags'); } let headers = this.defaultHeaders; 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 bd124babae79..6db1d6cc5014 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 @@ -230,7 +230,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { queryParameters = this.addToHttpParams(queryParameters, - status, 'status'); + status.join(COLLECTION_FORMATS['csv']), 'status'); } let headers = this.defaultHeaders; @@ -292,7 +292,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { queryParameters = this.addToHttpParams(queryParameters, - tags, 'tags'); + tags.join(COLLECTION_FORMATS['csv']), 'tags'); } let headers = this.defaultHeaders; 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 1e657858bef4..748ce453c043 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 @@ -232,7 +232,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { queryParameters = this.addToHttpParams(queryParameters, - status, 'status'); + status.join(COLLECTION_FORMATS['csv']), 'status'); } let headers = this.defaultHeaders; @@ -294,7 +294,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { queryParameters = this.addToHttpParams(queryParameters, - tags, 'tags'); + tags.join(COLLECTION_FORMATS['csv']), 'tags'); } let headers = this.defaultHeaders; 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 1e657858bef4..748ce453c043 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 @@ -232,7 +232,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { queryParameters = this.addToHttpParams(queryParameters, - status, 'status'); + status.join(COLLECTION_FORMATS['csv']), 'status'); } let headers = this.defaultHeaders; @@ -294,7 +294,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { queryParameters = this.addToHttpParams(queryParameters, - tags, 'tags'); + tags.join(COLLECTION_FORMATS['csv']), 'tags'); } let headers = this.defaultHeaders; 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 1e657858bef4..748ce453c043 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 @@ -232,7 +232,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { queryParameters = this.addToHttpParams(queryParameters, - status, 'status'); + status.join(COLLECTION_FORMATS['csv']), 'status'); } let headers = this.defaultHeaders; @@ -294,7 +294,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { queryParameters = this.addToHttpParams(queryParameters, - tags, 'tags'); + tags.join(COLLECTION_FORMATS['csv']), 'tags'); } let headers = this.defaultHeaders; diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/package.json b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/package.json index 4704f50abdce..10228c2c0110 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/package.json +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/package.json @@ -1,38 +1,21 @@ { - "name": "@openapitools/typescript-angular-petstore", + "name": "default", "version": "1.0.0", - "description": "OpenAPI client for @openapitools/typescript-angular-petstore", - "author": "OpenAPI-Generator Contributors", - "keywords": [ - "openapi-client", - "openapi-generator" - ], - "license": "Unlicense", + "description": "### Building", + "main": "index.js", "scripts": { - "build": "ng-packagr -p ng-package.json" - }, - "peerDependencies": { - "@angular/core": "^8.0.0", - "@angular/common": "^8.0.0", - "@angular/compiler": "^8.0.0", - "core-js": "^2.4.0", - "reflect-metadata": "^0.1.3", - "rxjs": "^6.5.0" + "test": "echo \"Error: no test specified\" && exit 1" }, + "author": "", + "license": "ISC", "devDependencies": { - "@angular/common": "^8.0.0", - "@angular/compiler": "^8.0.0", - "@angular/compiler-cli": "^8.0.0", - "@angular/core": "^8.0.0", - "@angular/platform-browser": "^8.0.0", - "ng-packagr": "^5.4.0", - "reflect-metadata": "^0.1.3", - "rxjs": "^6.5.0", - "tsickle": "^0.35.0", - "typescript": ">=3.4.0 <3.6.0", - "zone.js": "^0.9.1" + "typescript": "^3.7.2" }, - "publishConfig": { - "registry": "https://skimdb.npmjs.com/registry" + "dependencies": { + "@angular/common": "^8.2.14", + "@angular/core": "^8.2.14", + "@angular/http": "^7.2.15", + "rxjs": "^6.5.3", + "rxjs-compat": "^6.5.3" } } diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/tsconfig.json b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/tsconfig.json index c01ebe255d4c..bd0747c46438 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/tsconfig.json +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/tsconfig.json @@ -1,28 +1,66 @@ { - "compilerOptions": { - "emitDecoratorMetadata": true, - "experimentalDecorators": true, - "noImplicitAny": false, - "suppressImplicitAnyIndexErrors": true, - "target": "es5", - "module": "commonjs", - "moduleResolution": "node", - "removeComments": true, - "sourceMap": true, - "outDir": "./dist", - "noLib": false, - "declaration": true, - "lib": [ "es6", "dom" ], - "typeRoots": [ - "node_modules/@types" - ] - }, - "exclude": [ - "node_modules", - "dist" - ], - "filesGlob": [ - "./model/*.ts", - "./api/*.ts" - ] + "compilerOptions": { + /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ + "target": "es2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ + "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + "lib": ["es2015", "dom"], /* Specify library files to be included in the compilation. */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + + /* Source Map Options */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + + /* Advanced Options */ + "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + } } diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts index 1e657858bef4..748ce453c043 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts @@ -232,7 +232,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { queryParameters = this.addToHttpParams(queryParameters, - status, 'status'); + status.join(COLLECTION_FORMATS['csv']), 'status'); } let headers = this.defaultHeaders; @@ -294,7 +294,7 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { queryParameters = this.addToHttpParams(queryParameters, - tags, 'tags'); + tags.join(COLLECTION_FORMATS['csv']), 'tags'); } let headers = this.defaultHeaders; From 0e8db2e2f440adc2570882ae8c04057ec2ec747f Mon Sep 17 00:00:00 2001 From: Thomas Pasch Date: Fri, 15 Nov 2019 11:36:55 +0100 Subject: [PATCH 05/10] revert samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/package.json --- .../builds/with-npm/package.json | 43 +++++++++++++------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/package.json b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/package.json index 10228c2c0110..4704f50abdce 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/package.json +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/package.json @@ -1,21 +1,38 @@ { - "name": "default", + "name": "@openapitools/typescript-angular-petstore", "version": "1.0.0", - "description": "### Building", - "main": "index.js", + "description": "OpenAPI client for @openapitools/typescript-angular-petstore", + "author": "OpenAPI-Generator Contributors", + "keywords": [ + "openapi-client", + "openapi-generator" + ], + "license": "Unlicense", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "build": "ng-packagr -p ng-package.json" + }, + "peerDependencies": { + "@angular/core": "^8.0.0", + "@angular/common": "^8.0.0", + "@angular/compiler": "^8.0.0", + "core-js": "^2.4.0", + "reflect-metadata": "^0.1.3", + "rxjs": "^6.5.0" }, - "author": "", - "license": "ISC", "devDependencies": { - "typescript": "^3.7.2" + "@angular/common": "^8.0.0", + "@angular/compiler": "^8.0.0", + "@angular/compiler-cli": "^8.0.0", + "@angular/core": "^8.0.0", + "@angular/platform-browser": "^8.0.0", + "ng-packagr": "^5.4.0", + "reflect-metadata": "^0.1.3", + "rxjs": "^6.5.0", + "tsickle": "^0.35.0", + "typescript": ">=3.4.0 <3.6.0", + "zone.js": "^0.9.1" }, - "dependencies": { - "@angular/common": "^8.2.14", - "@angular/core": "^8.2.14", - "@angular/http": "^7.2.15", - "rxjs": "^6.5.3", - "rxjs-compat": "^6.5.3" + "publishConfig": { + "registry": "https://skimdb.npmjs.com/registry" } } From 59d2f4adbb647be5feb0387c73ab1f7eba63cb02 Mon Sep 17 00:00:00 2001 From: Thomas Pasch Date: Fri, 15 Nov 2019 11:41:23 +0100 Subject: [PATCH 06/10] reverted samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/tsconfig.json --- .../builds/with-npm/tsconfig.json | 90 ++++++------------- 1 file changed, 26 insertions(+), 64 deletions(-) diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/tsconfig.json b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/tsconfig.json index bd0747c46438..c01ebe255d4c 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/tsconfig.json +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-npm/tsconfig.json @@ -1,66 +1,28 @@ { - "compilerOptions": { - /* Basic Options */ - // "incremental": true, /* Enable incremental compilation */ - "target": "es2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "lib": ["es2015", "dom"], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - - /* Source Map Options */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - - /* Advanced Options */ - "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ - } + "compilerOptions": { + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "noImplicitAny": false, + "suppressImplicitAnyIndexErrors": true, + "target": "es5", + "module": "commonjs", + "moduleResolution": "node", + "removeComments": true, + "sourceMap": true, + "outDir": "./dist", + "noLib": false, + "declaration": true, + "lib": [ "es6", "dom" ], + "typeRoots": [ + "node_modules/@types" + ] + }, + "exclude": [ + "node_modules", + "dist" + ], + "filesGlob": [ + "./model/*.ts", + "./api/*.ts" + ] } From 7cbec6bf364bf4de03a92037cabde7c3b5f31eca Mon Sep 17 00:00:00 2001 From: aanno2 Date: Wed, 22 Jan 2020 15:26:21 +0100 Subject: [PATCH 07/10] rebase-to-master-fix: isDateTime stuff is now handled within this.addToHttpParams --- .../resources/typescript-angular/api.service.mustache | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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 95713f159de7..96ceed57ce0c 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 @@ -250,12 +250,8 @@ export class {{classname}} { {{/isListContainer}} {{^isListContainer}} if ({{paramName}} !== undefined && {{paramName}} !== null) { - {{#isDateTime}} - {{#useHttpClient}}queryParameters = {{/useHttpClient}}queryParameters.set('{{baseName}}', ({{paramName}} as any instanceof Date) ? ({{paramName}} as any).toISOString(): {{paramName}}); - {{/isDateTime}} - {{^isDateTime}} - {{#useHttpClient}}queryParameters = {{/useHttpClient}}queryParameters.set('{{baseName}}', {{paramName}}); - {{/isDateTime}} + {{#useHttpClient}}queryParameters = {{/useHttpClient}}this.addToHttpParams(queryParameters, + {{paramName}}, '{{baseName}}'); } {{/isListContainer}} {{/queryParams}} From e4613192ea5fb8f6d3ad82075a43a70819761a23 Mon Sep 17 00:00:00 2001 From: aanno2 Date: Wed, 22 Jan 2020 15:35:19 +0100 Subject: [PATCH 08/10] run bin/typescript-angular-petstore-all.sh on the rebased PR --- .../api/pet.service.ts | 38 ++++++++++++++++++- .../api/store.service.ts | 32 ++++++++++++++++ .../api/user.service.ts | 38 ++++++++++++++++++- 3 files changed, 104 insertions(+), 4 deletions(-) diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts index beae55938b5f..ca9e0f28c913 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts @@ -100,6 +100,38 @@ export class PetService { } + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (Array.isArray(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + /** * Add a new pet to the store * @param requestParameters @@ -239,7 +271,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (status) { - queryParameters = queryParameters.set('status', status.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + status.join(COLLECTION_FORMATS['csv']), 'status'); } let headers = this.defaultHeaders; @@ -301,7 +334,8 @@ export class PetService { let queryParameters = new HttpParams({encoder: this.encoder}); if (tags) { - queryParameters = queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv'])); + queryParameters = this.addToHttpParams(queryParameters, + tags.join(COLLECTION_FORMATS['csv']), 'tags'); } let headers = this.defaultHeaders; diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts index fd0cff4bc09b..87a797f9357f 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts @@ -61,6 +61,38 @@ export class StoreService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (Array.isArray(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts index 44e12277eb70..09dae7e519b3 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts @@ -79,6 +79,38 @@ export class UserService { + private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + httpParams = this.addToHttpParamsRecursive(httpParams, value); + } else { + httpParams = this.addToHttpParamsRecursive(httpParams, value, key); + } + return httpParams; + } + + private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { + if (typeof value === "object") { + if (Array.isArray(value)) { + (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + } else if (value instanceof Date) { + if (key != null) { + httpParams = httpParams.append(key, + (value as Date).toISOString().substr(0, 10)); + } else { + throw Error("key may not be null if value is Date"); + } + } else { + Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( + httpParams, value[k], key != null ? `${key}.${k}` : k)); + } + } else if (key != null) { + httpParams = httpParams.append(key, value); + } else { + throw Error("key may not be null if value is not object or array"); + } + return httpParams; + } + /** * Create user * This can only be done by the logged in user. @@ -356,10 +388,12 @@ export class UserService { let queryParameters = new HttpParams({encoder: this.encoder}); if (username !== undefined && username !== null) { - queryParameters = queryParameters.set('username', username); + queryParameters = this.addToHttpParams(queryParameters, + username, 'username'); } if (password !== undefined && password !== null) { - queryParameters = queryParameters.set('password', password); + queryParameters = this.addToHttpParams(queryParameters, + password, 'password'); } let headers = this.defaultHeaders; From 16606813a5ca8c8274a1a36901a46a04c739e569 Mon Sep 17 00:00:00 2001 From: aanno2 Date: Wed, 22 Jan 2020 16:02:21 +0100 Subject: [PATCH 09/10] applying proposed fix of @macjohnny --- .../src/main/resources/typescript-angular/api.service.mustache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 96ceed57ce0c..af76accd188a 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 @@ -163,7 +163,7 @@ export class {{classname}} { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { {{#useHttpClient}}httpParams = {{/useHttpClient}}httpParams.append(key, From 22ced5ee80a875daca88ccb30c928fb9a4630fd8 Mon Sep 17 00:00:00 2001 From: aanno2 Date: Thu, 23 Jan 2020 08:21:56 +0100 Subject: [PATCH 10/10] run bin/typescript-angular-petstore-all.sh to regenerate samples --- .../petstore/typescript-angular-v2/default/api/pet.service.ts | 2 +- .../petstore/typescript-angular-v2/default/api/store.service.ts | 2 +- .../petstore/typescript-angular-v2/default/api/user.service.ts | 2 +- .../petstore/typescript-angular-v2/npm/api/pet.service.ts | 2 +- .../petstore/typescript-angular-v2/npm/api/store.service.ts | 2 +- .../petstore/typescript-angular-v2/npm/api/user.service.ts | 2 +- .../typescript-angular-v2/with-interfaces/api/pet.service.ts | 2 +- .../typescript-angular-v2/with-interfaces/api/store.service.ts | 2 +- .../typescript-angular-v2/with-interfaces/api/user.service.ts | 2 +- .../petstore/typescript-angular-v4.3/npm/api/pet.service.ts | 2 +- .../petstore/typescript-angular-v4.3/npm/api/store.service.ts | 2 +- .../petstore/typescript-angular-v4.3/npm/api/user.service.ts | 2 +- .../petstore/typescript-angular-v4/npm/api/pet.service.ts | 2 +- .../petstore/typescript-angular-v4/npm/api/store.service.ts | 2 +- .../petstore/typescript-angular-v4/npm/api/user.service.ts | 2 +- .../builds/default/api/pet.service.ts | 2 +- .../builds/default/api/store.service.ts | 2 +- .../builds/default/api/user.service.ts | 2 +- .../builds/with-npm/api/pet.service.ts | 2 +- .../builds/with-npm/api/store.service.ts | 2 +- .../builds/with-npm/api/user.service.ts | 2 +- .../builds/default/api/pet.service.ts | 2 +- .../builds/default/api/store.service.ts | 2 +- .../builds/default/api/user.service.ts | 2 +- .../builds/with-npm/api/pet.service.ts | 2 +- .../builds/with-npm/api/store.service.ts | 2 +- .../builds/with-npm/api/user.service.ts | 2 +- .../builds/default/api/pet.service.ts | 2 +- .../builds/default/api/store.service.ts | 2 +- .../builds/default/api/user.service.ts | 2 +- .../builds/with-npm/api/pet.service.ts | 2 +- .../builds/with-npm/api/store.service.ts | 2 +- .../builds/with-npm/api/user.service.ts | 2 +- .../builds/default/api/pet.service.ts | 2 +- .../builds/default/api/store.service.ts | 2 +- .../builds/default/api/user.service.ts | 2 +- .../builds/with-npm/api/pet.service.ts | 2 +- .../builds/with-npm/api/store.service.ts | 2 +- .../builds/with-npm/api/user.service.ts | 2 +- .../builds/single-request-parameter/api/pet.service.ts | 2 +- .../builds/single-request-parameter/api/store.service.ts | 2 +- .../builds/single-request-parameter/api/user.service.ts | 2 +- .../builds/with-npm/api/pet.service.ts | 2 +- .../builds/with-npm/api/store.service.ts | 2 +- .../builds/with-npm/api/user.service.ts | 2 +- .../builds/with-prefixed-module-name/api/pet.service.ts | 2 +- .../builds/with-prefixed-module-name/api/store.service.ts | 2 +- .../builds/with-prefixed-module-name/api/user.service.ts | 2 +- 48 files changed, 48 insertions(+), 48 deletions(-) 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 762a4517cd02..6c550afa6c75 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 @@ -216,7 +216,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams.append(key, 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 8a0fb5ce8c43..6168be9b6e4e 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 @@ -128,7 +128,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams.append(key, 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 3165c96bd357..526147a13610 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 @@ -198,7 +198,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams.append(key, 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 762a4517cd02..6c550afa6c75 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 @@ -216,7 +216,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams.append(key, 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 8a0fb5ce8c43..6168be9b6e4e 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 @@ -128,7 +128,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams.append(key, 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 3165c96bd357..526147a13610 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 @@ -198,7 +198,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams.append(key, 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 8952ab497171..76fa49373707 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 @@ -219,7 +219,7 @@ export class PetService implements PetServiceInterface { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams.append(key, 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 1726a78c0974..ab60c271c7db 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 @@ -131,7 +131,7 @@ export class StoreService implements StoreServiceInterface { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams.append(key, 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 f9962706a264..20909bc6a518 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 @@ -201,7 +201,7 @@ export class UserService implements UserServiceInterface { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams.append(key, 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 25d866e1b82d..1b73575c4bd0 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 @@ -73,7 +73,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 9282be1ef71b..5265ec4464a9 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 @@ -59,7 +59,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 8983b6ac58b9..24ba9cb94cf6 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 @@ -59,7 +59,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 762a4517cd02..6c550afa6c75 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 @@ -216,7 +216,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams.append(key, 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 8a0fb5ce8c43..6168be9b6e4e 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 @@ -128,7 +128,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams.append(key, 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 3165c96bd357..526147a13610 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 @@ -198,7 +198,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams.append(key, 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 6db1d6cc5014..49865a3d3709 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 @@ -73,7 +73,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 61f75196572e..594b4e9df35c 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 @@ -59,7 +59,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 23a249c9ad4e..00cb3a603128 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 @@ -59,7 +59,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 6db1d6cc5014..49865a3d3709 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 @@ -73,7 +73,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 61f75196572e..594b4e9df35c 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 @@ -59,7 +59,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 23a249c9ad4e..00cb3a603128 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 @@ -59,7 +59,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 748ce453c043..f11d19b64df4 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 @@ -75,7 +75,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 7b653ccaf04c..e5cca603af8a 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 @@ -61,7 +61,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 c379a35dd604..e4a83db33b13 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 @@ -61,7 +61,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 748ce453c043..f11d19b64df4 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 @@ -75,7 +75,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 7b653ccaf04c..e5cca603af8a 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 @@ -61,7 +61,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 c379a35dd604..e4a83db33b13 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 @@ -61,7 +61,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 6db1d6cc5014..49865a3d3709 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 @@ -73,7 +73,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 61f75196572e..594b4e9df35c 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 @@ -59,7 +59,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 23a249c9ad4e..00cb3a603128 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 @@ -59,7 +59,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 6db1d6cc5014..49865a3d3709 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 @@ -73,7 +73,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 61f75196572e..594b4e9df35c 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 @@ -59,7 +59,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 23a249c9ad4e..00cb3a603128 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 @@ -59,7 +59,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 748ce453c043..f11d19b64df4 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 @@ -75,7 +75,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 7b653ccaf04c..e5cca603af8a 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 @@ -61,7 +61,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 c379a35dd604..e4a83db33b13 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 @@ -61,7 +61,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 748ce453c043..f11d19b64df4 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 @@ -75,7 +75,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 7b653ccaf04c..e5cca603af8a 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 @@ -61,7 +61,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 c379a35dd604..e4a83db33b13 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 @@ -61,7 +61,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts index ca9e0f28c913..f3722d434cc6 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/pet.service.ts @@ -112,7 +112,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts index 87a797f9357f..47658366d4e7 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/store.service.ts @@ -73,7 +73,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts index 09dae7e519b3..10c542265254 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/single-request-parameter/api/user.service.ts @@ -91,7 +91,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 748ce453c043..f11d19b64df4 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 @@ -75,7 +75,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 7b653ccaf04c..e5cca603af8a 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 @@ -61,7 +61,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, 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 c379a35dd604..e4a83db33b13 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 @@ -61,7 +61,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts index 748ce453c043..f11d19b64df4 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/pet.service.ts @@ -75,7 +75,7 @@ export class PetService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts index 7b653ccaf04c..e5cca603af8a 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/store.service.ts @@ -61,7 +61,7 @@ export class StoreService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key, diff --git a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts index c379a35dd604..e4a83db33b13 100644 --- a/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts +++ b/samples/client/petstore/typescript-angular-v8-provided-in-root/builds/with-prefixed-module-name/api/user.service.ts @@ -61,7 +61,7 @@ export class UserService { private addToHttpParamsRecursive(httpParams: HttpParams, value: any, key?: string): HttpParams { if (typeof value === "object") { if (Array.isArray(value)) { - (value as []).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); + (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); } else if (value instanceof Date) { if (key != null) { httpParams = httpParams.append(key,