From 339c354d3abfa4f40e19ce6d11af824897eac7af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Spr=C3=B6=C3=9Fer?= Date: Thu, 28 May 2026 12:23:54 +0200 Subject: [PATCH 1/3] Fix recursive Query-Param Object name --- .../main/resources/typescript-angular/api.base.service.mustache | 2 +- .../additional-properties-expected/api.base.service.ts | 2 +- .../typescript/array-and-object-expected/api.base.service.ts | 2 +- .../typescript/custom-path-params-expected/api.base.service.ts | 2 +- .../typescript/petstore-expected/api.base.service.ts | 2 +- .../builds/query-param-deep-object/api.base.service.ts | 2 +- .../builds/query-param-form/api.base.service.ts | 2 +- .../builds/query-param-json/api.base.service.ts | 2 +- .../builds/composed-schemas-tagged-unions/api.base.service.ts | 2 +- .../builds/composed-schemas/api.base.service.ts | 2 +- .../builds/default/api.base.service.ts | 2 +- .../builds/default/api.base.service.ts | 2 +- .../builds/default/api.base.service.ts | 2 +- .../builds/default/api.base.service.ts | 2 +- .../builds/default/api.base.service.ts | 2 +- .../typescript-angular-v19/builds/default/api.base.service.ts | 2 +- .../builds/default/api.base.service.ts | 2 +- .../typescript-angular-v20/builds/default/api.base.service.ts | 2 +- .../builds/default/api.base.service.ts | 2 +- .../typescript-angular-v21/builds/default/api.base.service.ts | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache index ed7a92be8bd2..63fd456f8cb8 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache @@ -70,7 +70,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { diff --git a/modules/openapi-generator/src/test/resources/integrationtests/typescript/additional-properties-expected/api.base.service.ts b/modules/openapi-generator/src/test/resources/integrationtests/typescript/additional-properties-expected/api.base.service.ts index 7e447ce347e4..e8cbf16906df 100644 --- a/modules/openapi-generator/src/test/resources/integrationtests/typescript/additional-properties-expected/api.base.service.ts +++ b/modules/openapi-generator/src/test/resources/integrationtests/typescript/additional-properties-expected/api.base.service.ts @@ -77,7 +77,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { diff --git a/modules/openapi-generator/src/test/resources/integrationtests/typescript/array-and-object-expected/api.base.service.ts b/modules/openapi-generator/src/test/resources/integrationtests/typescript/array-and-object-expected/api.base.service.ts index 8868df446b43..b91714996cf3 100644 --- a/modules/openapi-generator/src/test/resources/integrationtests/typescript/array-and-object-expected/api.base.service.ts +++ b/modules/openapi-generator/src/test/resources/integrationtests/typescript/array-and-object-expected/api.base.service.ts @@ -77,7 +77,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { diff --git a/modules/openapi-generator/src/test/resources/integrationtests/typescript/custom-path-params-expected/api.base.service.ts b/modules/openapi-generator/src/test/resources/integrationtests/typescript/custom-path-params-expected/api.base.service.ts index 7d64e8080b4b..5532bb0a5460 100644 --- a/modules/openapi-generator/src/test/resources/integrationtests/typescript/custom-path-params-expected/api.base.service.ts +++ b/modules/openapi-generator/src/test/resources/integrationtests/typescript/custom-path-params-expected/api.base.service.ts @@ -77,7 +77,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { diff --git a/modules/openapi-generator/src/test/resources/integrationtests/typescript/petstore-expected/api.base.service.ts b/modules/openapi-generator/src/test/resources/integrationtests/typescript/petstore-expected/api.base.service.ts index 225e5863dcf2..4f98b6283f46 100644 --- a/modules/openapi-generator/src/test/resources/integrationtests/typescript/petstore-expected/api.base.service.ts +++ b/modules/openapi-generator/src/test/resources/integrationtests/typescript/petstore-expected/api.base.service.ts @@ -77,7 +77,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { diff --git a/samples/client/others/typescript-angular-v20/builds/query-param-deep-object/api.base.service.ts b/samples/client/others/typescript-angular-v20/builds/query-param-deep-object/api.base.service.ts index 1b63f4457d9c..01aeccae77d8 100644 --- a/samples/client/others/typescript-angular-v20/builds/query-param-deep-object/api.base.service.ts +++ b/samples/client/others/typescript-angular-v20/builds/query-param-deep-object/api.base.service.ts @@ -78,7 +78,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { diff --git a/samples/client/others/typescript-angular-v20/builds/query-param-form/api.base.service.ts b/samples/client/others/typescript-angular-v20/builds/query-param-form/api.base.service.ts index 7801405134b7..d3a014917d12 100644 --- a/samples/client/others/typescript-angular-v20/builds/query-param-form/api.base.service.ts +++ b/samples/client/others/typescript-angular-v20/builds/query-param-form/api.base.service.ts @@ -78,7 +78,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { diff --git a/samples/client/others/typescript-angular-v20/builds/query-param-json/api.base.service.ts b/samples/client/others/typescript-angular-v20/builds/query-param-json/api.base.service.ts index 56df5e8f84b6..56d3f0df1f9f 100644 --- a/samples/client/others/typescript-angular-v20/builds/query-param-json/api.base.service.ts +++ b/samples/client/others/typescript-angular-v20/builds/query-param-json/api.base.service.ts @@ -78,7 +78,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { 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 da9512f79726..aa94df815e76 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 @@ -78,7 +78,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { 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 da9512f79726..aa94df815e76 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 @@ -78,7 +78,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { 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 8a8b8bc6b6f5..e033914ed7e8 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 @@ -78,7 +78,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { 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 8a8b8bc6b6f5..e033914ed7e8 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 @@ -78,7 +78,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { 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 8a8b8bc6b6f5..e033914ed7e8 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 @@ -78,7 +78,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { diff --git a/samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default/api.base.service.ts index 8a8b8bc6b6f5..e033914ed7e8 100644 --- a/samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default/api.base.service.ts @@ -78,7 +78,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { 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 8a8b8bc6b6f5..e033914ed7e8 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 @@ -78,7 +78,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { 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 8a8b8bc6b6f5..e033914ed7e8 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 @@ -78,7 +78,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { diff --git a/samples/client/petstore/typescript-angular-v20-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v20-provided-in-root/builds/default/api.base.service.ts index 8a8b8bc6b6f5..e033914ed7e8 100644 --- a/samples/client/petstore/typescript-angular-v20-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v20-provided-in-root/builds/default/api.base.service.ts @@ -78,7 +78,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { diff --git a/samples/client/petstore/typescript-angular-v20/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v20/builds/default/api.base.service.ts index 8a8b8bc6b6f5..e033914ed7e8 100644 --- a/samples/client/petstore/typescript-angular-v20/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v20/builds/default/api.base.service.ts @@ -78,7 +78,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { diff --git a/samples/client/petstore/typescript-angular-v21-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v21-provided-in-root/builds/default/api.base.service.ts index 8a8b8bc6b6f5..e033914ed7e8 100644 --- a/samples/client/petstore/typescript-angular-v21-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v21-provided-in-root/builds/default/api.base.service.ts @@ -78,7 +78,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { diff --git a/samples/client/petstore/typescript-angular-v21/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v21/builds/default/api.base.service.ts index 8a8b8bc6b6f5..e033914ed7e8 100644 --- a/samples/client/petstore/typescript-angular-v21/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v21/builds/default/api.base.service.ts @@ -78,7 +78,7 @@ export class BaseService { if (paramStyle === QueryParamStyle.Form) { if (explode) { Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode); + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); }); return httpParams; } else { From 8e17470295ad4528acf5ec176846cc03ae7ba0c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Spr=C3=B6=C3=9Fer?= Date: Tue, 2 Jun 2026 12:55:57 +0200 Subject: [PATCH 2/3] Added `addToHttpParamsDeepObject` --- .../api.base.service.mustache | 23 ++++++++++++++++++- .../TypeScriptAngularClientCodegenTest.java | 4 ++++ .../api.base.service.ts | 23 ++++++++++++++++++- .../api.base.service.ts | 23 ++++++++++++++++++- .../api.base.service.ts | 23 ++++++++++++++++++- .../petstore-expected/api.base.service.ts | 23 ++++++++++++++++++- .../api.base.service.ts | 23 ++++++++++++++++++- .../query-param-form/api.base.service.ts | 23 ++++++++++++++++++- .../query-param-json/api.base.service.ts | 23 ++++++++++++++++++- .../api.base.service.ts | 23 ++++++++++++++++++- .../composed-schemas/api.base.service.ts | 23 ++++++++++++++++++- .../builds/default/api.base.service.ts | 23 ++++++++++++++++++- .../builds/default/api.base.service.ts | 23 ++++++++++++++++++- .../builds/default/api.base.service.ts | 23 ++++++++++++++++++- .../builds/default/api.base.service.ts | 23 ++++++++++++++++++- .../builds/default/api.base.service.ts | 23 ++++++++++++++++++- .../builds/default/api.base.service.ts | 23 ++++++++++++++++++- .../builds/default/api.base.service.ts | 23 ++++++++++++++++++- .../builds/default/api.base.service.ts | 23 ++++++++++++++++++- .../builds/default/api.base.service.ts | 23 ++++++++++++++++++- .../builds/default/api.base.service.ts | 23 ++++++++++++++++++- 21 files changed, 444 insertions(+), 20 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache index 63fd456f8cb8..5e3b237a153d 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache @@ -41,7 +41,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -85,4 +85,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientCodegenTest.java index e3acfc556211..1d1aaeb6dd35 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/typescript/typescriptangular/TypeScriptAngularClientCodegenTest.java @@ -488,6 +488,10 @@ public void testDeepObject() throws IOException { final String fileContents = Files.readString(Paths.get(output + "/api/default.service.ts")); assertThat(fileContents).containsSubsequence("'options',\n", "options,\n", "QueryParamStyle.DeepObject,\n", "true,\n"); assertThat(fileContents).containsSubsequence("'inputOptions',\n", "inputOptions,\n", "QueryParamStyle.DeepObject,\n", "true,\n"); + + final String baseServiceContents = Files.readString(Paths.get(output + "/api.base.service.ts")); + assertThat(baseServiceContents).contains("this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k])"); + assertThat(baseServiceContents).contains("this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item)"); } @Test diff --git a/modules/openapi-generator/src/test/resources/integrationtests/typescript/additional-properties-expected/api.base.service.ts b/modules/openapi-generator/src/test/resources/integrationtests/typescript/additional-properties-expected/api.base.service.ts index e8cbf16906df..51bdd9f576d2 100644 --- a/modules/openapi-generator/src/test/resources/integrationtests/typescript/additional-properties-expected/api.base.service.ts +++ b/modules/openapi-generator/src/test/resources/integrationtests/typescript/additional-properties-expected/api.base.service.ts @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -92,4 +92,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } diff --git a/modules/openapi-generator/src/test/resources/integrationtests/typescript/array-and-object-expected/api.base.service.ts b/modules/openapi-generator/src/test/resources/integrationtests/typescript/array-and-object-expected/api.base.service.ts index b91714996cf3..a3d6efadfb4e 100644 --- a/modules/openapi-generator/src/test/resources/integrationtests/typescript/array-and-object-expected/api.base.service.ts +++ b/modules/openapi-generator/src/test/resources/integrationtests/typescript/array-and-object-expected/api.base.service.ts @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -92,4 +92,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } diff --git a/modules/openapi-generator/src/test/resources/integrationtests/typescript/custom-path-params-expected/api.base.service.ts b/modules/openapi-generator/src/test/resources/integrationtests/typescript/custom-path-params-expected/api.base.service.ts index 5532bb0a5460..7d1093bad764 100644 --- a/modules/openapi-generator/src/test/resources/integrationtests/typescript/custom-path-params-expected/api.base.service.ts +++ b/modules/openapi-generator/src/test/resources/integrationtests/typescript/custom-path-params-expected/api.base.service.ts @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -92,4 +92,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } diff --git a/modules/openapi-generator/src/test/resources/integrationtests/typescript/petstore-expected/api.base.service.ts b/modules/openapi-generator/src/test/resources/integrationtests/typescript/petstore-expected/api.base.service.ts index 4f98b6283f46..9288491a66a7 100644 --- a/modules/openapi-generator/src/test/resources/integrationtests/typescript/petstore-expected/api.base.service.ts +++ b/modules/openapi-generator/src/test/resources/integrationtests/typescript/petstore-expected/api.base.service.ts @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -92,4 +92,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } diff --git a/samples/client/others/typescript-angular-v20/builds/query-param-deep-object/api.base.service.ts b/samples/client/others/typescript-angular-v20/builds/query-param-deep-object/api.base.service.ts index 01aeccae77d8..5c18c191492b 100644 --- a/samples/client/others/typescript-angular-v20/builds/query-param-deep-object/api.base.service.ts +++ b/samples/client/others/typescript-angular-v20/builds/query-param-deep-object/api.base.service.ts @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -93,4 +93,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } diff --git a/samples/client/others/typescript-angular-v20/builds/query-param-form/api.base.service.ts b/samples/client/others/typescript-angular-v20/builds/query-param-form/api.base.service.ts index d3a014917d12..07d8ddddc20b 100644 --- a/samples/client/others/typescript-angular-v20/builds/query-param-form/api.base.service.ts +++ b/samples/client/others/typescript-angular-v20/builds/query-param-form/api.base.service.ts @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -93,4 +93,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } diff --git a/samples/client/others/typescript-angular-v20/builds/query-param-json/api.base.service.ts b/samples/client/others/typescript-angular-v20/builds/query-param-json/api.base.service.ts index 56d3f0df1f9f..58e17a59275d 100644 --- a/samples/client/others/typescript-angular-v20/builds/query-param-json/api.base.service.ts +++ b/samples/client/others/typescript-angular-v20/builds/query-param-json/api.base.service.ts @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -93,4 +93,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } 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 aa94df815e76..508a47e8b541 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 @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -93,4 +93,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } 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 aa94df815e76..508a47e8b541 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 @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -93,4 +93,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } 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 e033914ed7e8..c68bef04a771 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 @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -93,4 +93,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } 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 e033914ed7e8..c68bef04a771 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 @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -93,4 +93,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } 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 e033914ed7e8..c68bef04a771 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 @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -93,4 +93,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } diff --git a/samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default/api.base.service.ts index e033914ed7e8..c68bef04a771 100644 --- a/samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default/api.base.service.ts @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -93,4 +93,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } 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 e033914ed7e8..c68bef04a771 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 @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -93,4 +93,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } 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 e033914ed7e8..c68bef04a771 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 @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -93,4 +93,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } diff --git a/samples/client/petstore/typescript-angular-v20-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v20-provided-in-root/builds/default/api.base.service.ts index e033914ed7e8..c68bef04a771 100644 --- a/samples/client/petstore/typescript-angular-v20-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v20-provided-in-root/builds/default/api.base.service.ts @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -93,4 +93,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } diff --git a/samples/client/petstore/typescript-angular-v20/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v20/builds/default/api.base.service.ts index e033914ed7e8..c68bef04a771 100644 --- a/samples/client/petstore/typescript-angular-v20/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v20/builds/default/api.base.service.ts @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -93,4 +93,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } diff --git a/samples/client/petstore/typescript-angular-v21-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v21-provided-in-root/builds/default/api.base.service.ts index e033914ed7e8..c68bef04a771 100644 --- a/samples/client/petstore/typescript-angular-v21-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v21-provided-in-root/builds/default/api.base.service.ts @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -93,4 +93,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } diff --git a/samples/client/petstore/typescript-angular-v21/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v21/builds/default/api.base.service.ts index e033914ed7e8..c68bef04a771 100644 --- a/samples/client/petstore/typescript-angular-v21/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v21/builds/default/api.base.service.ts @@ -49,7 +49,7 @@ export class BaseService { } return Object.keys(value as Record).reduce( - (hp, k) => hp.append(`${key}[${k}]`, value[k]), + (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), httpParams, ); } else if (paramStyle === QueryParamStyle.Json) { @@ -93,4 +93,25 @@ export class BaseService { } } } + + private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { + if (value == null) { + return httpParams; + } else if (value instanceof Date) { + return httpParams.append(key, value.toISOString()); + } else if (Object(value) !== value) { + return httpParams.append(key, value.toString()); + } else if (Array.isArray(value) || value instanceof Set) { + const array = Array.isArray(value) ? value : Array.from(value); + array.forEach((item, index) => { + httpParams = this.addToHttpParamsDeepObject(httpParams, `${key}[${index}]`, item); + }); + return httpParams; + } else { + return Object.entries(value).reduce( + (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v), + httpParams, + ); + } + } } From 66bad2b44a328375e8ee727f6d1660664b6152fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Spr=C3=B6=C3=9Fer?= Date: Tue, 2 Jun 2026 13:22:31 +0200 Subject: [PATCH 3/3] Refactoring --- .../resources/typescript-angular/api.base.service.mustache | 4 ++-- .../additional-properties-expected/api.base.service.ts | 4 ++-- .../typescript/array-and-object-expected/api.base.service.ts | 4 ++-- .../custom-path-params-expected/api.base.service.ts | 4 ++-- .../typescript/petstore-expected/api.base.service.ts | 4 ++-- .../builds/query-param-deep-object/api.base.service.ts | 4 ++-- .../builds/query-param-form/api.base.service.ts | 4 ++-- .../builds/query-param-json/api.base.service.ts | 4 ++-- .../builds/composed-schemas-tagged-unions/api.base.service.ts | 4 ++-- .../builds/composed-schemas/api.base.service.ts | 4 ++-- .../builds/default/api.base.service.ts | 4 ++-- .../builds/default/api.base.service.ts | 4 ++-- .../builds/default/api.base.service.ts | 4 ++-- .../builds/default/api.base.service.ts | 4 ++-- .../typescript-angular-v19/builds/default/api.base.service.ts | 4 ++-- .../builds/default/api.base.service.ts | 4 ++-- .../typescript-angular-v20/builds/default/api.base.service.ts | 4 ++-- .../builds/default/api.base.service.ts | 4 ++-- .../typescript-angular-v21/builds/default/api.base.service.ts | 4 ++-- 19 files changed, 38 insertions(+), 38 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache index 5e3b237a153d..1e47467264a8 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache @@ -69,8 +69,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else { diff --git a/modules/openapi-generator/src/test/resources/integrationtests/typescript/additional-properties-expected/api.base.service.ts b/modules/openapi-generator/src/test/resources/integrationtests/typescript/additional-properties-expected/api.base.service.ts index 51bdd9f576d2..5c7a2d2f3fd8 100644 --- a/modules/openapi-generator/src/test/resources/integrationtests/typescript/additional-properties-expected/api.base.service.ts +++ b/modules/openapi-generator/src/test/resources/integrationtests/typescript/additional-properties-expected/api.base.service.ts @@ -76,8 +76,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else { diff --git a/modules/openapi-generator/src/test/resources/integrationtests/typescript/array-and-object-expected/api.base.service.ts b/modules/openapi-generator/src/test/resources/integrationtests/typescript/array-and-object-expected/api.base.service.ts index a3d6efadfb4e..d23e57dd76ad 100644 --- a/modules/openapi-generator/src/test/resources/integrationtests/typescript/array-and-object-expected/api.base.service.ts +++ b/modules/openapi-generator/src/test/resources/integrationtests/typescript/array-and-object-expected/api.base.service.ts @@ -76,8 +76,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else { diff --git a/modules/openapi-generator/src/test/resources/integrationtests/typescript/custom-path-params-expected/api.base.service.ts b/modules/openapi-generator/src/test/resources/integrationtests/typescript/custom-path-params-expected/api.base.service.ts index 7d1093bad764..0254fc849265 100644 --- a/modules/openapi-generator/src/test/resources/integrationtests/typescript/custom-path-params-expected/api.base.service.ts +++ b/modules/openapi-generator/src/test/resources/integrationtests/typescript/custom-path-params-expected/api.base.service.ts @@ -76,8 +76,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else { diff --git a/modules/openapi-generator/src/test/resources/integrationtests/typescript/petstore-expected/api.base.service.ts b/modules/openapi-generator/src/test/resources/integrationtests/typescript/petstore-expected/api.base.service.ts index 9288491a66a7..197732757638 100644 --- a/modules/openapi-generator/src/test/resources/integrationtests/typescript/petstore-expected/api.base.service.ts +++ b/modules/openapi-generator/src/test/resources/integrationtests/typescript/petstore-expected/api.base.service.ts @@ -76,8 +76,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else { diff --git a/samples/client/others/typescript-angular-v20/builds/query-param-deep-object/api.base.service.ts b/samples/client/others/typescript-angular-v20/builds/query-param-deep-object/api.base.service.ts index 5c18c191492b..80dad923cfd0 100644 --- a/samples/client/others/typescript-angular-v20/builds/query-param-deep-object/api.base.service.ts +++ b/samples/client/others/typescript-angular-v20/builds/query-param-deep-object/api.base.service.ts @@ -77,8 +77,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else { diff --git a/samples/client/others/typescript-angular-v20/builds/query-param-form/api.base.service.ts b/samples/client/others/typescript-angular-v20/builds/query-param-form/api.base.service.ts index 07d8ddddc20b..2112168a125a 100644 --- a/samples/client/others/typescript-angular-v20/builds/query-param-form/api.base.service.ts +++ b/samples/client/others/typescript-angular-v20/builds/query-param-form/api.base.service.ts @@ -77,8 +77,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else { diff --git a/samples/client/others/typescript-angular-v20/builds/query-param-json/api.base.service.ts b/samples/client/others/typescript-angular-v20/builds/query-param-json/api.base.service.ts index 58e17a59275d..f50a0881a0fa 100644 --- a/samples/client/others/typescript-angular-v20/builds/query-param-json/api.base.service.ts +++ b/samples/client/others/typescript-angular-v20/builds/query-param-json/api.base.service.ts @@ -77,8 +77,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else { 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 508a47e8b541..5f25c2a67f46 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 @@ -77,8 +77,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else { 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 508a47e8b541..5f25c2a67f46 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 @@ -77,8 +77,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else { 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 c68bef04a771..d0eadc84ae8e 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 @@ -77,8 +77,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else { 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 c68bef04a771..d0eadc84ae8e 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 @@ -77,8 +77,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else { diff --git a/samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default/api.base.service.ts index c68bef04a771..d0eadc84ae8e 100644 --- a/samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v19-provided-in-root/builds/default/api.base.service.ts @@ -77,8 +77,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else { 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 c68bef04a771..d0eadc84ae8e 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 @@ -77,8 +77,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else { 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 c68bef04a771..d0eadc84ae8e 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 @@ -77,8 +77,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else { diff --git a/samples/client/petstore/typescript-angular-v20-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v20-provided-in-root/builds/default/api.base.service.ts index c68bef04a771..d0eadc84ae8e 100644 --- a/samples/client/petstore/typescript-angular-v20-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v20-provided-in-root/builds/default/api.base.service.ts @@ -77,8 +77,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else { diff --git a/samples/client/petstore/typescript-angular-v20/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v20/builds/default/api.base.service.ts index c68bef04a771..d0eadc84ae8e 100644 --- a/samples/client/petstore/typescript-angular-v20/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v20/builds/default/api.base.service.ts @@ -77,8 +77,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else { diff --git a/samples/client/petstore/typescript-angular-v21-provided-in-root/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v21-provided-in-root/builds/default/api.base.service.ts index c68bef04a771..d0eadc84ae8e 100644 --- a/samples/client/petstore/typescript-angular-v21-provided-in-root/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v21-provided-in-root/builds/default/api.base.service.ts @@ -77,8 +77,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else { diff --git a/samples/client/petstore/typescript-angular-v21/builds/default/api.base.service.ts b/samples/client/petstore/typescript-angular-v21/builds/default/api.base.service.ts index c68bef04a771..d0eadc84ae8e 100644 --- a/samples/client/petstore/typescript-angular-v21/builds/default/api.base.service.ts +++ b/samples/client/petstore/typescript-angular-v21/builds/default/api.base.service.ts @@ -77,8 +77,8 @@ export class BaseService { // Otherwise, if it's an object, add each field. if (paramStyle === QueryParamStyle.Form) { if (explode) { - Object.keys(value).forEach(k => { - httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, value[k], paramStyle, explode); + Object.entries(value).forEach(([k, v]) => { + httpParams = this.addToHttpParams(httpParams, `${key}.${k}`, v, paramStyle, explode); }); return httpParams; } else {