Skip to content

docs(downgrader): oapi-codegen servers drop a nullable enum parameter - #393

Merged
dinwwwh merged 1 commit into
mainfrom
claude/project-thread-a8h0xv
Nov 8, 2026
Merged

dinwwwh merged 1 commit into
mainfrom
claude/project-thread-a8h0xv

Conversation

@dinwwwh

@dinwwwh dinwwwh commented Nov 8, 2026

Copy link
Copy Markdown
Member

Docs only. This adds a sentence to the oapi-codegen bullet in packages/downgrader/README.md.

In 3.0, a nullable $ref or enum parameter becomes oneOf [X, null branch]. oapi-codegen v2.8.2 (-generate types,std-http-server) types that parameter as *struct{ union json.RawMessage }, an anonymous struct with no methods, so code cannot read it. Binding at runtime then either loses the value or rejects it.

I tested this on the real oRPC beta.49 GET doc (g49/gq.mjs, Zod Prio.nullable() with an id and z.enum(['x', 'y']).nullable()), driving the generated handler through httptest:

request 3.0.4 output 3.1.1 input
?prio=5 200, params.Prio == nil 200, prio: 5
?e=x 200, params.E unset 200, e: "x"
header X-E: x 400 "property/values need to be pairs" 200, X-E: "x"
?n=2.5 ({type: number, nullable}) 200, n: 2.5 200, n: 2.5

The 3.1 reading types anyOf [$ref, null] as *Prio and anyOf [enum, null] as *AParamsE string. A union of literals with an id (Level) gets dropped in both versions, so it's left out of the table.

I'm not proposing a code change. A nullable enum stays a oneOf with the null branch on purpose, because putting null in the enum breaks other generators, and the allOf + nullable form broke oapi-codegen in an earlier round. Request bodies are fine, since the union unmarshals from JSON.


Generated by Claude Code

@coderabbitai

coderabbitai Bot commented Nov 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 14 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 816235f9-8242-4459-827d-f25460de77de
Commits

Reviewing files that changed from the base of the PR and between 84f2c48 and 678eacc.

Files selected for processing: 1

  • packages/downgrader/README.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@pkg-pr-new

pkg-pr-new Bot commented Nov 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@openapi-spec/downgrader@393
npm i https://pkg.pr.new/@openapi-spec/router@393
npm i https://pkg.pr.new/@openapi-spec/types@393

commit: 678eacc

@codecov

codecov Bot commented Nov 8, 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 Nov 8, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 31 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing claude/project-thread-a8h0xv (678eacc) with main (84f2c48)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

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

  • oapi-codegen limitation entry — Adds one sentence to the existing 2.8 bullet in packages/downgrader/README.md, recording that its generated server types a 3.0 oneOf parameter (the shape a nullable $ref or enum becomes) as a union with no accessor, leaving a query parameter unset and rejecting a header parameter with a 400, while its 3.1 reading binds the anyOf to the underlying type.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@dinwwwh
dinwwwh merged commit c446f55 into main Nov 8, 2026
12 checks passed
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.

2 participants