Skip to content

Fix recursive Query-Param Object name#23896

Open
angelaki wants to merge 1 commit into
OpenAPITools:masterfrom
angelaki:recursive-query-params
Open

Fix recursive Query-Param Object name#23896
angelaki wants to merge 1 commit into
OpenAPITools:masterfrom
angelaki:recursive-query-params

Conversation

@angelaki
Copy link
Copy Markdown
Contributor

@angelaki angelaki commented May 28, 2026

Fixes #23895


Summary by cubic

Fixes incorrect query param names for nested objects in the TypeScript Angular generator (form + explode). Child keys now include the parent key using dot notation (e.g., user.name) to preserve nesting and prevent collisions. Fixes #23895.

  • Bug Fixes
    • In api.base.service.mustache, pass ${key}.${k} when recursing object params instead of just k.
    • Updated TypeScript integration tests and sample outputs to match the new param naming.

Written for commit 339c354. Summary will update on new commits.

Review in cubic

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 20 files

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/others/typescript-angular-v20/builds/query-param-form/api.base.service.ts">

<violation number="1" location="samples/client/others/typescript-angular-v20/builds/query-param-form/api.base.service.ts:81">
P1: Form+explode object serialization now always prefixes keys with parent path (`${key}.${k}`), which breaks top-level object query parameter encoding and existing test expectations. The fix for recursive name loss (issue #23895) is applied unconditionally at every recursion level, including the first/top level where the old bare property name (`k`) was correct.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

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);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Form+explode object serialization now always prefixes keys with parent path (${key}.${k}), which breaks top-level object query parameter encoding and existing test expectations. The fix for recursive name loss (issue #23895) is applied unconditionally at every recursion level, including the first/top level where the old bare property name (k) was correct.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/others/typescript-angular-v20/builds/query-param-form/api.base.service.ts, line 81:

<comment>Form+explode object serialization now always prefixes keys with parent path (`${key}.${k}`), which breaks top-level object query parameter encoding and existing test expectations. The fix for recursive name loss (issue #23895) is applied unconditionally at every recursion level, including the first/top level where the old bare property name (`k`) was correct.</comment>

<file context>
@@ -78,7 +78,7 @@ export class BaseService {
                     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;
</file context>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But was it correct? The current implementation serializes the property prop with value {a:{x:1}} as query parameter x=1 what definitiv is wrong.

Not applying the first level key would result in a.x=1 but the property name is not respected. Imho prop.a.x=1 is totally valid / correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] [Angular] Form-Query-Params for recursive objects don't include property path

1 participant