Fix recursive Query-Param Object name#23896
Conversation
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
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.
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.
api.base.service.mustache, pass${key}.${k}when recursing object params instead of justk.Written for commit 339c354. Summary will update on new commits.
Review in cubic