fix(http-client): serialize style:deepObject query params with bracket notation#150
Open
ToyVo wants to merge 2 commits intobasketry:mainfrom
Open
fix(http-client): serialize style:deepObject query params with bracket notation#150ToyVo wants to merge 2 commits intobasketry:mainfrom
ToyVo wants to merge 2 commits intobasketry:mainfrom
Conversation
…et notation Object-typed query parameters (ComplexValue with mapProperties or named properties) were emitting encodeURIComponent(object), which fails TypeScript strict checks and serializes to [object Object] at runtime. Fix: detect ComplexValue query params by looking up the type via getTypeByName. - Map types (mapProperties) → Object.entries loop → name[key]=value - Structured types (properties) → per-property checks → name[prop]=value - Enum refs and other ComplexValues (no matching type) → unchanged scalar path Adds getGizmosFilter (map) and getGizmosPage (object) to the snapshot IR and updates the http-client snapshot to cover both deepObject cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Object-typed query parameters (ComplexValue in the Basketry IR) were being passed directly to encodeURIComponent, which:
Fails TypeScript strict type checking — encodeURIComponent only accepts string | number | boolean
Produces [object:Object] at runtime, breaking the actual API call
This affects any OAS spec that uses style: deepObject for query parameters (e.g. filter: Record<string, string> or page: {number?, size?}).
Fix
In buildQuery(), the case undefined: branch now detects object-typed query params by looking up the type via getTypeByName:
Map types (mapProperties) → Object.entries(value).forEach(([key, v]) => query.push(name[key]=v))
Structured object types (properties) → one if (prop !== undefined) query.push(...) per property
Everything else (enum refs, primitives) → unchanged encodeURIComponent(value) path
No IR changes required — detection is purely based on the type structure already present in the service IR.
Tests
Added getGizmosFilter (map type) and getGizmosPage (structured object) to the snapshot IR fixture, covering both deepObject serialization paths. Updated snapshot files accordingly. All 42 test suites pass.