Skip to content

fix(generator): type nullable array query params as arrays (#303)#304

Merged
benjamineckstein merged 1 commit into
mainfrom
fix/303-nullable-array-query-param
Jun 15, 2026
Merged

fix(generator): type nullable array query params as arrays (#303)#304
benjamineckstein merged 1 commit into
mainfrom
fix/303-nullable-array-query-param

Conversation

@benjamineckstein

Copy link
Copy Markdown
Contributor

Summary

OAS 3.1 nullable array query params (type: ["array","null"]) were typed as unknown and serialized with set(). Fixed to type as number[]/string[] and serialize with the append() loop, matching expected behavior. Regression tests added.

Changes

  • Corrected type inference for nullable array query parameters in code generator
  • Updated serialization logic to use append loop instead of set for array types
  • Added regression tests in client.test.ts

Closes #303

When a query param uses the OAS 3.1 null-union form type: ["array","null"],
queryParamType now returns number[] (integer/number items) or string[] instead
of falling through to primitiveToTs("array") which returned "unknown". This
also fixes the serialization path: the generated client now uses the append
loop instead of set for nullable array params.
@github-actions

Copy link
Copy Markdown
Contributor

Fallow audit report

Found 4 findings.

Dependencies (2)
Severity Rule Location Description
minor fallow/unused-dev-dependency examples/package.json:15 Package '@tanstack/react-query' is in devDependencies but never imported; imported in other workspaces: packages/integration
minor fallow/unused-dev-dependency examples/package.json:17 Package 'react' is in devDependencies but never imported; imported in other workspaces: packages/integration
Duplication (2)
Severity Rule Location Description
minor fallow/code-duplication packages/openapi-zod-ts/src/\_\_tests\_\_/client.test.ts:1007 Code clone group 1 (13 lines, 2 instances)
minor fallow/code-duplication packages/openapi-zod-ts/src/\_\_tests\_\_/client.test.ts:1038 Code clone group 1 (13 lines, 2 instances)

Generated by fallow.

@github-actions github-actions Bot left a comment

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.

Fallow audit report

2 inline findings selected for GitHub review.

Comment thread packages/openapi-zod-ts/src/__tests__/client.test.ts
Comment thread packages/openapi-zod-ts/src/__tests__/client.test.ts
@benjamineckstein benjamineckstein merged commit 751d25b into main Jun 15, 2026
7 checks passed
@benjamineckstein benjamineckstein deleted the fix/303-nullable-array-query-param branch June 15, 2026 16:17
@github-actions github-actions Bot mentioned this pull request Jun 15, 2026
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.

queryParamType returns unknown for OAS 3.1 nullable array union type ["array", "null"]

1 participant