fix(sdk): ignore deepObject style for array query parameters#3818
fix(sdk): ignore deepObject style for array query parameters#3818Eddie344 wants to merge 2 commits intohey-api:mainfrom
Conversation
When a query parameter is typed as `array` but has `style: deepObject`
in the OpenAPI spec, the generator was emitting
`{ array: { style: 'deepObject' } }` in sdk.gen.ts. This caused a
TypeScript compile error because `ArrayStyle` is
`'form' | 'spaceDelimited' | 'pipeDelimited'` — `deepObject` is
only valid for object parameters.
The fix normalises the style to the default `'form'` for array/tuple
parameters that carry a `deepObject` style annotation, so no serialiser
override is emitted for those parameters.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
|
Someone is attempting to deploy a commit to the Hey API Team on Vercel. A member of the Team first needs to authorize it. |
|
|
TL;DR — When an OpenAPI spec declares Key changes
Summary | 20 files | 2 commits | base:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3818 +/- ##
==========================================
+ Coverage 39.84% 39.99% +0.15%
==========================================
Files 530 530
Lines 19475 19476 +1
Branches 5808 5803 -5
==========================================
+ Hits 7759 7789 +30
+ Misses 9485 9463 -22
+ Partials 2231 2224 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Reviewed — no issues found.
The fix correctly normalizes deepObject to form for array/tuple query parameters before evaluating whether a serializer override is needed. This matches the OpenAPI spec (deepObject is only defined for object-typed parameters) and avoids emitting style: 'deepObject' which is not assignable to the client SDK's ArrayStyle type. The arrayStyle local variable is cleanly threaded through both the guard condition and the style emission, so both explode: true (skip override entirely) and explode: false (emit only { explode: false }) cases are handled correctly.
Task list (6/6 completed)
- Read the PR description and diff overview
- Review the core logic change in operation.ts
- Review the test spec and test registration
- Review generated snapshot files for correctness
- Verify against OpenAPI 3.1 spec behavior for deepObject + arrays
- Self-critique and submit review
@hey-api/codegen-core
@hey-api/json-schema-ref-parser
@hey-api/nuxt
@hey-api/openapi-ts
@hey-api/shared
@hey-api/spec-types
@hey-api/types
@hey-api/vite-plugin
commit: |
Adds a createClient unit test that exercises the deepObject→form normalisation path in operation.ts, providing coverage for the codecov/patch check. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@mrlubos I really need this fix, could you check it? |

Summary
packages/openapi-ts/src/plugins/@hey-api/sdk/shared/operation.ts, when generatingquerySerializeroverrides for query parameters of typearray/tuple, the generator blindly forwarded whateverstylewas set on the parameter — includingdeepObject. HoweverdeepObjectis only valid for object parameters per the OpenAPI spec, and the client SDK'sArrayStyletype is'form' | 'spaceDelimited' | 'pipeDelimited'.arrayquery parameter carryingstyle: deepObjectproduced generated code like{ array: { style: 'deepObject' } }that failed TypeScript compilation withType '"deepObject"' is not assignable to type 'ArrayStyle | undefined'.'form'(the default for arrays) when adeepObjectstyle is encountered on anarray/tupleparameter. This suppresses the serialiser override entirely for that parameter, which is the correct behaviour — the defaultformserialiser is used.Changes
packages/openapi-ts/src/plugins/@hey-api/sdk/shared/operation.tsarrayStyle = deepObject ? 'form' : parameter.stylebefore generating serialiser configspecs/3.1.x/parameter-array-deep-object.jsonGET /foowithproductsarray query param +style: deepObjectpackages/openapi-ts-tests/main/test/3.1.x.test.tsdeepObjecton array param falls back toformpackages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-array-deep-object/sdk.gen.tshas noquerySerializeroverride (correct)Test plan
'handles array query parameter with deepObject style (falls back to form)'passes@test/openapi-tstests still passpnpm typecheckexits clean across all 35 packagessdk.gen.tscontains noquerySerializer(deepObject was silently normalised to the defaultform)🤖 Generated with Claude Code