Skip to content

fix(openapi): omit null and undefined members in delimited-object query styles - #2076

Open
dinwwwh wants to merge 1 commit into
middleapi:mainfrom
dinwwwh:claude/openapi-link-codec-filter-fix-1de188
Open

dinwwwh wants to merge 1 commit into
middleapi:mainfrom
dinwwwh:claude/openapi-link-codec-filter-fix-1de188

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Sep 24, 2026

Copy link
Copy Markdown
Member

With the `comma-delimited-object`, `space-delimited-object`, or `pipe-delimited-object` query styles, `OpenAPILink` was sending null and undefined object members as the literal strings `"null"` and `"undefined"`. So `{ filters: { a: undefined, b: '1', c: null } }` reached the procedure as `{ a: 'undefined', b: '1', c: 'null' }` instead of `{ b: '1' }`. These members are now omitted, as the delimited-array styles and path params already did.

Fixes

  • Null and undefined members are left out of delimited-object query values
  • An object whose members are all null or undefined leaves the query parameter out entirely

Testing

  • New test covers null and undefined members across all six delimited query styles (array and object for each delimiter). It fails before the fix with `a,undefined,b,1,c,null`
  • All `@orpc/openapi` tests pass

…ry styles

encodeDelimitedObject's filter destructured the entry key instead of its
value, so it never dropped anything and null/undefined members were sent
as the literal strings "null" and "undefined".

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

The one-line fix corrects a destructuring typo in encodeDelimitedObject that let null/undefined object members reach the query string as the literal strings "null"/"undefined" for the comma-/space-/pipe-delimited-object styles.

  • encodeDelimitedObject filter fixed — packages/openapi/src/adapters/standard/openapi-link-codec.ts:511 now destructures the value (([, v])) instead of the key (([v])), matching the already-correct encodeDelimitedArray at :500.
  • New test across all six delimited styles — packages/openapi/src/adapters/standard/openapi-link-codec.test.ts:429 covers array and object variants for each delimiter, plus an all-null/undefined object asserting the parameter is omitted entirely.

I ran the test file on head (51 passed) and also reverted the fix locally to confirm the new test genuinely fails without it — it does, with expected 'a,undefined,b,1,c,null' to be 'b,1'. No other instances of the buggy filter(([v]) => pattern exist in the repo.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pkg-pr-new

pkg-pr-new Bot commented Sep 24, 2026

Copy link
Copy Markdown
More templates

@orpc/ai-sdk

npm i https://pkg.pr.new/@orpc/ai-sdk@2076

@orpc/arktype

npm i https://pkg.pr.new/@orpc/arktype@2076

@orpc/bun

npm i https://pkg.pr.new/@orpc/bun@2076

@orpc/client

npm i https://pkg.pr.new/@orpc/client@2076

@orpc/cloudflare

npm i https://pkg.pr.new/@orpc/cloudflare@2076

@orpc/contract

npm i https://pkg.pr.new/@orpc/contract@2076

@orpc/experimental-effect

npm i https://pkg.pr.new/@orpc/experimental-effect@2076

@orpc/evlog

npm i https://pkg.pr.new/@orpc/evlog@2076

@orpc/hibernation

npm i https://pkg.pr.new/@orpc/hibernation@2076

@orpc/json-schema

npm i https://pkg.pr.new/@orpc/json-schema@2076

@orpc/experimental-lock

npm i https://pkg.pr.new/@orpc/experimental-lock@2076

@orpc/experimental-msw

npm i https://pkg.pr.new/@orpc/experimental-msw@2076

@orpc/nest

npm i https://pkg.pr.new/@orpc/nest@2076

@orpc/next

npm i https://pkg.pr.new/@orpc/next@2076

@orpc/node

npm i https://pkg.pr.new/@orpc/node@2076

@orpc/openapi

npm i https://pkg.pr.new/@orpc/openapi@2076

@orpc/opentelemetry

npm i https://pkg.pr.new/@orpc/opentelemetry@2076

@orpc/pinia-colada

npm i https://pkg.pr.new/@orpc/pinia-colada@2076

@orpc/pino

npm i https://pkg.pr.new/@orpc/pino@2076

@orpc/publisher

npm i https://pkg.pr.new/@orpc/publisher@2076

@orpc/ratelimit

npm i https://pkg.pr.new/@orpc/ratelimit@2076

@orpc/server

npm i https://pkg.pr.new/@orpc/server@2076

@orpc/shared

npm i https://pkg.pr.new/@orpc/shared@2076

@orpc/swr

npm i https://pkg.pr.new/@orpc/swr@2076

@orpc/tanstack-query

npm i https://pkg.pr.new/@orpc/tanstack-query@2076

@orpc/trpc

npm i https://pkg.pr.new/@orpc/trpc@2076

@orpc/valibot

npm i https://pkg.pr.new/@orpc/valibot@2076

@orpc/zod

npm i https://pkg.pr.new/@orpc/zod@2076

commit: 573fced

@codecov

codecov Bot commented Sep 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will degrade performance by 12.65%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 29 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ octet stream 640.3 µs 733.1 µs -12.65%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing dinwwwh:claude/openapi-link-codec-filter-fix-1de188 (573fced) with main (a16c885)

Open in CodSpeed

This branch has not been deployed

No deployments
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.

1 participant