[typescript-angular] Fix recursive Query-Param Object name#23896
[typescript-angular] Fix recursive Query-Param Object name#23896angelaki wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
1 issue found across 20 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
thanks for the PR cc @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) @davidgamero (2022/03) @mkusaka (2022/04) @joscha (2024/10) @dennisameling (2026/02) |
|
@angelaki please update the failing tests |
|
@macjohnny could you please check the discussion here: #23895. Guess the final solution still needs to be clearified. And sorry but I'm not quite sure how to check those tests. Even don't get why it should break Angular 20 but no other tests? |
|
I've added a fix for DeepObject now. Sorry but don't have a Java Environment set up. Would be super great if someone could support me here / verify this fix. It's actually not tested, just "assumed"! |
There was a problem hiding this comment.
2 issues found across 21 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="samples/client/petstore/typescript-angular-v19/builds/default/api.base.service.ts">
<violation number="1" location="samples/client/petstore/typescript-angular-v19/builds/default/api.base.service.ts:97">
P2: DeepObject recursion lacks cycle handling, causing stack overflow on cyclic input objects</violation>
</file>
<file name="modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache:103">
P1: `Object.entries` is not available under the generator’s current TypeScript lib setup, so this change breaks generated Angular builds/type-checking.</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
| }); | ||
| return httpParams; | ||
| } else { | ||
| return Object.entries(value).reduce( |
There was a problem hiding this comment.
P1: Object.entries is not available under the generator’s current TypeScript lib setup, so this change breaks generated Angular builds/type-checking.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/resources/typescript-angular/api.base.service.mustache, line 103:
<comment>`Object.entries` is not available under the generator’s current TypeScript lib setup, so this change breaks generated Angular builds/type-checking.</comment>
<file context>
@@ -85,4 +85,25 @@ export class BaseService {
+ });
+ return httpParams;
+ } else {
+ return Object.entries(value).reduce(
+ (hp, [k, v]) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, v),
+ httpParams,
</file context>
| return Object.entries(value).reduce( | |
| return Object.keys(value).reduce( | |
| (hp, k) => this.addToHttpParamsDeepObject(hp, `${key}[${k}]`, value[k]), | |
| httpParams, | |
| ); |
| } | ||
| } | ||
|
|
||
| private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams { |
There was a problem hiding this comment.
P2: DeepObject recursion lacks cycle handling, causing stack overflow on cyclic input objects
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/typescript-angular-v19/builds/default/api.base.service.ts, line 97:
<comment>DeepObject recursion lacks cycle handling, causing stack overflow on cyclic input objects</comment>
<file context>
@@ -93,4 +93,25 @@ export class BaseService {
}
}
+
+ private addToHttpParamsDeepObject(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined): OpenApiHttpParams {
+ if (value == null) {
+ return httpParams;
</file context>
Fixes #23895
Summary by cubic
Fixes nested query param naming and serialization in the
typescript-angulargenerator. Form+explode now prefixes child keys with dot notation (e.g., user.name), and DeepObject recurses with bracket notation (e.g., options[foo][0]) to preserve structure and avoid collisions (fixes #23895).${key}.${k}inapi.base.service.mustache.addToHttpParamsDeepObjectto serialize nested objects/arrays/sets with${key}[...]; updated tests and sample outputs.Written for commit 66bad2b. Summary will update on new commits.