From 696442c6787e01f54852300aad306b8ecdbe5b61 Mon Sep 17 00:00:00 2001 From: Phil Thomas <2487390+filiptc@users.noreply.github.com> Date: Thu, 17 Apr 2025 21:58:50 +0200 Subject: [PATCH] chore: regenerate samples. --- .../api.base.service.ts | 13 +++++++++++-- .../builds/composed-schemas/api.base.service.ts | 13 +++++++++++-- .../builds/default/api.base.service.ts | 13 +++++++++++-- .../builds/default/api.base.service.ts | 13 +++++++++++-- .../builds/default/api.base.service.ts | 13 +++++++++++-- .../builds/with-npm/api.base.service.ts | 13 +++++++++++-- .../builds/default/api.base.service.ts | 13 +++++++++++-- .../builds/default/api.base.service.ts | 13 +++++++++++-- .../builds/default/api.base.service.ts | 13 +++++++++++-- .../builds/with-npm/api.base.service.ts | 13 +++++++++++-- .../builds/default/api.base.service.ts | 13 +++++++++++-- .../api.base.service.ts | 13 +++++++++++-- .../builds/default/api.base.service.ts | 13 +++++++++++-- .../builds/default/api.base.service.ts | 13 +++++++++++-- .../builds/default/api.base.service.ts | 13 +++++++++++-- .../builds/default/api.base.service.ts | 13 +++++++++++-- .../builds/default/api.base.service.ts | 13 +++++++++++-- .../builds/default/api.base.service.ts | 13 +++++++++++-- 18 files changed, 198 insertions(+), 36 deletions(-) diff --git a/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/api.base.service.ts b/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/api.base.service.ts index 8184ceb97294..2eef83787982 100644 --- a/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/api.base.service.ts +++ b/samples/client/others/typescript-angular/builds/composed-schemas-tagged-unions/api.base.service.ts @@ -28,21 +28,30 @@ export class BaseService { return consumes.indexOf('multipart/form-data') !== -1; } - protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep?: boolean): HttpParams { // If the value is an object (but not a Date), recursively add its keys. if (typeof value === 'object' && !(value instanceof Date)) { + if (isDeep) { + return this.addToHttpParamsRecursive(httpParams, value, key, isDeep); + } return this.addToHttpParamsRecursive(httpParams, value); } return this.addToHttpParamsRecursive(httpParams, value, key); } - protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep?: boolean): HttpParams { if (value === null || value === undefined) { return httpParams; } if (typeof value === 'object') { // If JSON format is preferred, key must be provided. if (key != null) { + if (isDeep) { + return Object.entries(value as Record).reduce( + (hp, [k, v]) => hp.append(`${key}[${k}]`, v), + httpParams, + ); + } return httpParams.append(key, JSON.stringify(value)); } // Otherwise, if it's an array, add each element. diff --git a/samples/client/others/typescript-angular/builds/composed-schemas/api.base.service.ts b/samples/client/others/typescript-angular/builds/composed-schemas/api.base.service.ts index 8184ceb97294..2eef83787982 100644 --- a/samples/client/others/typescript-angular/builds/composed-schemas/api.base.service.ts +++ b/samples/client/others/typescript-angular/builds/composed-schemas/api.base.service.ts @@ -28,21 +28,30 @@ export class BaseService { return consumes.indexOf('multipart/form-data') !== -1; } - protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep?: boolean): HttpParams { // If the value is an object (but not a Date), recursively add its keys. if (typeof value === 'object' && !(value instanceof Date)) { + if (isDeep) { + return this.addToHttpParamsRecursive(httpParams, value, key, isDeep); + } return this.addToHttpParamsRecursive(httpParams, value); } return this.addToHttpParamsRecursive(httpParams, value, key); } - protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep?: boolean): HttpParams { if (value === null || value === undefined) { return httpParams; } if (typeof value === 'object') { // If JSON format is preferred, key must be provided. if (key != null) { + if (isDeep) { + return Object.entries(value as Record).reduce( + (hp, [k, v]) => hp.append(`${key}[${k}]`, v), + httpParams, + ); + } return httpParams.append(key, JSON.stringify(value)); } // Otherwise, if it's an array, add each element. diff --git a/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/api.base.service.ts index 82eaead92fe9..526f07d5edcb 100644 --- a/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v12-oneOf/builds/default/api.base.service.ts @@ -28,21 +28,30 @@ export class BaseService { return consumes.indexOf('multipart/form-data') !== -1; } - protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep?: boolean): HttpParams { // If the value is an object (but not a Date), recursively add its keys. if (typeof value === 'object' && !(value instanceof Date)) { + if (isDeep) { + return this.addToHttpParamsRecursive(httpParams, value, key, isDeep); + } return this.addToHttpParamsRecursive(httpParams, value); } return this.addToHttpParamsRecursive(httpParams, value, key); } - protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep?: boolean): HttpParams { if (value === null || value === undefined) { return httpParams; } if (typeof value === 'object') { // If JSON format is preferred, key must be provided. if (key != null) { + if (isDeep) { + return Object.entries(value as Record).reduce( + (hp, [k, v]) => hp.append(`${key}[${k}]`, v), + httpParams, + ); + } return httpParams.append(key, JSON.stringify(value)); } // Otherwise, if it's an array, add each element. diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api.base.service.ts index 0743145a27c2..c26642c0591f 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-any/builds/default/api.base.service.ts @@ -28,21 +28,30 @@ export class BaseService { return consumes.indexOf('multipart/form-data') !== -1; } - protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep?: boolean): HttpParams { // If the value is an object (but not a Date), recursively add its keys. if (typeof value === 'object' && !(value instanceof Date)) { + if (isDeep) { + return this.addToHttpParamsRecursive(httpParams, value, key, isDeep); + } return this.addToHttpParamsRecursive(httpParams, value); } return this.addToHttpParamsRecursive(httpParams, value, key); } - protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep?: boolean): HttpParams { if (value === null || value === undefined) { return httpParams; } if (typeof value === 'object') { // If JSON format is preferred, key must be provided. if (key != null) { + if (isDeep) { + return Object.entries(value as Record).reduce( + (hp, [k, v]) => hp.append(`${key}[${k}]`, v), + httpParams, + ); + } return httpParams.append(key, JSON.stringify(value)); } // Otherwise, if it's an array, add each element. diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api.base.service.ts index 0743145a27c2..c26642c0591f 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/default/api.base.service.ts @@ -28,21 +28,30 @@ export class BaseService { return consumes.indexOf('multipart/form-data') !== -1; } - protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep?: boolean): HttpParams { // If the value is an object (but not a Date), recursively add its keys. if (typeof value === 'object' && !(value instanceof Date)) { + if (isDeep) { + return this.addToHttpParamsRecursive(httpParams, value, key, isDeep); + } return this.addToHttpParamsRecursive(httpParams, value); } return this.addToHttpParamsRecursive(httpParams, value, key); } - protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep?: boolean): HttpParams { if (value === null || value === undefined) { return httpParams; } if (typeof value === 'object') { // If JSON format is preferred, key must be provided. if (key != null) { + if (isDeep) { + return Object.entries(value as Record).reduce( + (hp, [k, v]) => hp.append(`${key}[${k}]`, v), + httpParams, + ); + } return httpParams.append(key, JSON.stringify(value)); } // Otherwise, if it's an array, add each element. diff --git a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api.base.service.ts b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api.base.service.ts index 0743145a27c2..c26642c0591f 100644 --- a/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v12-provided-in-root/builds/with-npm/api.base.service.ts @@ -28,21 +28,30 @@ export class BaseService { return consumes.indexOf('multipart/form-data') !== -1; } - protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep?: boolean): HttpParams { // If the value is an object (but not a Date), recursively add its keys. if (typeof value === 'object' && !(value instanceof Date)) { + if (isDeep) { + return this.addToHttpParamsRecursive(httpParams, value, key, isDeep); + } return this.addToHttpParamsRecursive(httpParams, value); } return this.addToHttpParamsRecursive(httpParams, value, key); } - protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep?: boolean): HttpParams { if (value === null || value === undefined) { return httpParams; } if (typeof value === 'object') { // If JSON format is preferred, key must be provided. if (key != null) { + if (isDeep) { + return Object.entries(value as Record).reduce( + (hp, [k, v]) => hp.append(`${key}[${k}]`, v), + httpParams, + ); + } return httpParams.append(key, JSON.stringify(value)); } // Otherwise, if it's an array, add each element. diff --git a/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/api.base.service.ts index 82eaead92fe9..526f07d5edcb 100644 --- a/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v13-oneOf/builds/default/api.base.service.ts @@ -28,21 +28,30 @@ export class BaseService { return consumes.indexOf('multipart/form-data') !== -1; } - protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep?: boolean): HttpParams { // If the value is an object (but not a Date), recursively add its keys. if (typeof value === 'object' && !(value instanceof Date)) { + if (isDeep) { + return this.addToHttpParamsRecursive(httpParams, value, key, isDeep); + } return this.addToHttpParamsRecursive(httpParams, value); } return this.addToHttpParamsRecursive(httpParams, value, key); } - protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep?: boolean): HttpParams { if (value === null || value === undefined) { return httpParams; } if (typeof value === 'object') { // If JSON format is preferred, key must be provided. if (key != null) { + if (isDeep) { + return Object.entries(value as Record).reduce( + (hp, [k, v]) => hp.append(`${key}[${k}]`, v), + httpParams, + ); + } return httpParams.append(key, JSON.stringify(value)); } // Otherwise, if it's an array, add each element. diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api.base.service.ts index 0743145a27c2..c26642c0591f 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-any/builds/default/api.base.service.ts @@ -28,21 +28,30 @@ export class BaseService { return consumes.indexOf('multipart/form-data') !== -1; } - protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep?: boolean): HttpParams { // If the value is an object (but not a Date), recursively add its keys. if (typeof value === 'object' && !(value instanceof Date)) { + if (isDeep) { + return this.addToHttpParamsRecursive(httpParams, value, key, isDeep); + } return this.addToHttpParamsRecursive(httpParams, value); } return this.addToHttpParamsRecursive(httpParams, value, key); } - protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep?: boolean): HttpParams { if (value === null || value === undefined) { return httpParams; } if (typeof value === 'object') { // If JSON format is preferred, key must be provided. if (key != null) { + if (isDeep) { + return Object.entries(value as Record).reduce( + (hp, [k, v]) => hp.append(`${key}[${k}]`, v), + httpParams, + ); + } return httpParams.append(key, JSON.stringify(value)); } // Otherwise, if it's an array, add each element. diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api.base.service.ts index 0743145a27c2..c26642c0591f 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/default/api.base.service.ts @@ -28,21 +28,30 @@ export class BaseService { return consumes.indexOf('multipart/form-data') !== -1; } - protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep?: boolean): HttpParams { // If the value is an object (but not a Date), recursively add its keys. if (typeof value === 'object' && !(value instanceof Date)) { + if (isDeep) { + return this.addToHttpParamsRecursive(httpParams, value, key, isDeep); + } return this.addToHttpParamsRecursive(httpParams, value); } return this.addToHttpParamsRecursive(httpParams, value, key); } - protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep?: boolean): HttpParams { if (value === null || value === undefined) { return httpParams; } if (typeof value === 'object') { // If JSON format is preferred, key must be provided. if (key != null) { + if (isDeep) { + return Object.entries(value as Record).reduce( + (hp, [k, v]) => hp.append(`${key}[${k}]`, v), + httpParams, + ); + } return httpParams.append(key, JSON.stringify(value)); } // Otherwise, if it's an array, add each element. diff --git a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api.base.service.ts b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api.base.service.ts index 0743145a27c2..c26642c0591f 100644 --- a/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v13-provided-in-root/builds/with-npm/api.base.service.ts @@ -28,21 +28,30 @@ export class BaseService { return consumes.indexOf('multipart/form-data') !== -1; } - protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep?: boolean): HttpParams { // If the value is an object (but not a Date), recursively add its keys. if (typeof value === 'object' && !(value instanceof Date)) { + if (isDeep) { + return this.addToHttpParamsRecursive(httpParams, value, key, isDeep); + } return this.addToHttpParamsRecursive(httpParams, value); } return this.addToHttpParamsRecursive(httpParams, value, key); } - protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep?: boolean): HttpParams { if (value === null || value === undefined) { return httpParams; } if (typeof value === 'object') { // If JSON format is preferred, key must be provided. if (key != null) { + if (isDeep) { + return Object.entries(value as Record).reduce( + (hp, [k, v]) => hp.append(`${key}[${k}]`, v), + httpParams, + ); + } return httpParams.append(key, JSON.stringify(value)); } // Otherwise, if it's an array, add each element. diff --git a/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api.base.service.ts index 0743145a27c2..c26642c0591f 100644 --- a/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v14-provided-in-root/builds/default/api.base.service.ts @@ -28,21 +28,30 @@ export class BaseService { return consumes.indexOf('multipart/form-data') !== -1; } - protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep?: boolean): HttpParams { // If the value is an object (but not a Date), recursively add its keys. if (typeof value === 'object' && !(value instanceof Date)) { + if (isDeep) { + return this.addToHttpParamsRecursive(httpParams, value, key, isDeep); + } return this.addToHttpParamsRecursive(httpParams, value); } return this.addToHttpParamsRecursive(httpParams, value, key); } - protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep?: boolean): HttpParams { if (value === null || value === undefined) { return httpParams; } if (typeof value === 'object') { // If JSON format is preferred, key must be provided. if (key != null) { + if (isDeep) { + return Object.entries(value as Record).reduce( + (hp, [k, v]) => hp.append(`${key}[${k}]`, v), + httpParams, + ); + } return httpParams.append(key, JSON.stringify(value)); } // Otherwise, if it's an array, add each element. diff --git a/samples/client/petstore/typescript-angular-v14-query-param-object-format/api.base.service.ts b/samples/client/petstore/typescript-angular-v14-query-param-object-format/api.base.service.ts index 0743145a27c2..c26642c0591f 100644 --- a/samples/client/petstore/typescript-angular-v14-query-param-object-format/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v14-query-param-object-format/api.base.service.ts @@ -28,21 +28,30 @@ export class BaseService { return consumes.indexOf('multipart/form-data') !== -1; } - protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep?: boolean): HttpParams { // If the value is an object (but not a Date), recursively add its keys. if (typeof value === 'object' && !(value instanceof Date)) { + if (isDeep) { + return this.addToHttpParamsRecursive(httpParams, value, key, isDeep); + } return this.addToHttpParamsRecursive(httpParams, value); } return this.addToHttpParamsRecursive(httpParams, value, key); } - protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep?: boolean): HttpParams { if (value === null || value === undefined) { return httpParams; } if (typeof value === 'object') { // If JSON format is preferred, key must be provided. if (key != null) { + if (isDeep) { + return Object.entries(value as Record).reduce( + (hp, [k, v]) => hp.append(`${key}[${k}]`, v), + httpParams, + ); + } return httpParams.append(key, JSON.stringify(value)); } // Otherwise, if it's an array, add each element. diff --git a/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api.base.service.ts index 0743145a27c2..c26642c0591f 100644 --- a/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v15-provided-in-root/builds/default/api.base.service.ts @@ -28,21 +28,30 @@ export class BaseService { return consumes.indexOf('multipart/form-data') !== -1; } - protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep?: boolean): HttpParams { // If the value is an object (but not a Date), recursively add its keys. if (typeof value === 'object' && !(value instanceof Date)) { + if (isDeep) { + return this.addToHttpParamsRecursive(httpParams, value, key, isDeep); + } return this.addToHttpParamsRecursive(httpParams, value); } return this.addToHttpParamsRecursive(httpParams, value, key); } - protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep?: boolean): HttpParams { if (value === null || value === undefined) { return httpParams; } if (typeof value === 'object') { // If JSON format is preferred, key must be provided. if (key != null) { + if (isDeep) { + return Object.entries(value as Record).reduce( + (hp, [k, v]) => hp.append(`${key}[${k}]`, v), + httpParams, + ); + } return httpParams.append(key, JSON.stringify(value)); } // Otherwise, if it's an array, add each element. diff --git a/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api.base.service.ts index 0743145a27c2..c26642c0591f 100644 --- a/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v16-provided-in-root/builds/default/api.base.service.ts @@ -28,21 +28,30 @@ export class BaseService { return consumes.indexOf('multipart/form-data') !== -1; } - protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep?: boolean): HttpParams { // If the value is an object (but not a Date), recursively add its keys. if (typeof value === 'object' && !(value instanceof Date)) { + if (isDeep) { + return this.addToHttpParamsRecursive(httpParams, value, key, isDeep); + } return this.addToHttpParamsRecursive(httpParams, value); } return this.addToHttpParamsRecursive(httpParams, value, key); } - protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep?: boolean): HttpParams { if (value === null || value === undefined) { return httpParams; } if (typeof value === 'object') { // If JSON format is preferred, key must be provided. if (key != null) { + if (isDeep) { + return Object.entries(value as Record).reduce( + (hp, [k, v]) => hp.append(`${key}[${k}]`, v), + httpParams, + ); + } return httpParams.append(key, JSON.stringify(value)); } // Otherwise, if it's an array, add each element. diff --git a/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api.base.service.ts index 0743145a27c2..c26642c0591f 100644 --- a/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v17-provided-in-root/builds/default/api.base.service.ts @@ -28,21 +28,30 @@ export class BaseService { return consumes.indexOf('multipart/form-data') !== -1; } - protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep?: boolean): HttpParams { // If the value is an object (but not a Date), recursively add its keys. if (typeof value === 'object' && !(value instanceof Date)) { + if (isDeep) { + return this.addToHttpParamsRecursive(httpParams, value, key, isDeep); + } return this.addToHttpParamsRecursive(httpParams, value); } return this.addToHttpParamsRecursive(httpParams, value, key); } - protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep?: boolean): HttpParams { if (value === null || value === undefined) { return httpParams; } if (typeof value === 'object') { // If JSON format is preferred, key must be provided. if (key != null) { + if (isDeep) { + return Object.entries(value as Record).reduce( + (hp, [k, v]) => hp.append(`${key}[${k}]`, v), + httpParams, + ); + } return httpParams.append(key, JSON.stringify(value)); } // Otherwise, if it's an array, add each element. diff --git a/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api.base.service.ts index 0743145a27c2..c26642c0591f 100644 --- a/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v18-provided-in-root/builds/default/api.base.service.ts @@ -28,21 +28,30 @@ export class BaseService { return consumes.indexOf('multipart/form-data') !== -1; } - protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep?: boolean): HttpParams { // If the value is an object (but not a Date), recursively add its keys. if (typeof value === 'object' && !(value instanceof Date)) { + if (isDeep) { + return this.addToHttpParamsRecursive(httpParams, value, key, isDeep); + } return this.addToHttpParamsRecursive(httpParams, value); } return this.addToHttpParamsRecursive(httpParams, value, key); } - protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep?: boolean): HttpParams { if (value === null || value === undefined) { return httpParams; } if (typeof value === 'object') { // If JSON format is preferred, key must be provided. if (key != null) { + if (isDeep) { + return Object.entries(value as Record).reduce( + (hp, [k, v]) => hp.append(`${key}[${k}]`, v), + httpParams, + ); + } return httpParams.append(key, JSON.stringify(value)); } // Otherwise, if it's an array, add each element. diff --git a/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api.base.service.ts index 0743145a27c2..c26642c0591f 100644 --- a/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v19-with-angular-dependency-params/builds/default/api.base.service.ts @@ -28,21 +28,30 @@ export class BaseService { return consumes.indexOf('multipart/form-data') !== -1; } - protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep?: boolean): HttpParams { // If the value is an object (but not a Date), recursively add its keys. if (typeof value === 'object' && !(value instanceof Date)) { + if (isDeep) { + return this.addToHttpParamsRecursive(httpParams, value, key, isDeep); + } return this.addToHttpParamsRecursive(httpParams, value); } return this.addToHttpParamsRecursive(httpParams, value, key); } - protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep?: boolean): HttpParams { if (value === null || value === undefined) { return httpParams; } if (typeof value === 'object') { // If JSON format is preferred, key must be provided. if (key != null) { + if (isDeep) { + return Object.entries(value as Record).reduce( + (hp, [k, v]) => hp.append(`${key}[${k}]`, v), + httpParams, + ); + } return httpParams.append(key, JSON.stringify(value)); } // Otherwise, if it's an array, add each element. diff --git a/samples/client/petstore/typescript-angular-v19/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v19/builds/default/api.base.service.ts index 0743145a27c2..c26642c0591f 100644 --- a/samples/client/petstore/typescript-angular-v19/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v19/builds/default/api.base.service.ts @@ -28,21 +28,30 @@ export class BaseService { return consumes.indexOf('multipart/form-data') !== -1; } - protected addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { + protected addToHttpParams(httpParams: HttpParams, value: any, key?: string, isDeep?: boolean): HttpParams { // If the value is an object (but not a Date), recursively add its keys. if (typeof value === 'object' && !(value instanceof Date)) { + if (isDeep) { + return this.addToHttpParamsRecursive(httpParams, value, key, isDeep); + } return this.addToHttpParamsRecursive(httpParams, value); } return this.addToHttpParamsRecursive(httpParams, value, key); } - protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { + protected addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string, isDeep?: boolean): HttpParams { if (value === null || value === undefined) { return httpParams; } if (typeof value === 'object') { // If JSON format is preferred, key must be provided. if (key != null) { + if (isDeep) { + return Object.entries(value as Record).reduce( + (hp, [k, v]) => hp.append(`${key}[${k}]`, v), + httpParams, + ); + } return httpParams.append(key, JSON.stringify(value)); } // Otherwise, if it's an array, add each element.