Repository navigation
docs(downgrader): oapi-codegen servers drop a nullable enum parameter - #393
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VVaw7RH2JEkf9zKoSXLUbC
|
Warning Review limit reachedYou'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. View limit details
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. |
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
oapi-codegenlimitation entry — Adds one sentence to the existing 2.8 bullet inpackages/downgrader/README.md, recording that its generated server types a 3.0oneOfparameter (the shape a nullable$refor 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 theanyOfto the underlying type.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Docs only. This adds a sentence to the oapi-codegen bullet in
packages/downgrader/README.md.In 3.0, a nullable
$refor enum parameter becomesoneOf [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, ZodPrio.nullable()with an id andz.enum(['x', 'y']).nullable()), driving the generated handler throughhttptest:?prio=5params.Prio == nilprio: 5?e=xparams.Eunsete: "x"X-E: xX-E: "x"?n=2.5({type: number, nullable})n: 2.5n: 2.5The 3.1 reading types
anyOf [$ref, null]as*PrioandanyOf [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
oneOfwith the null branch on purpose, because putting null in theenumbreaks other generators, and theallOf+nullableform broke oapi-codegen in an earlier round. Request bodies are fine, since the union unmarshals from JSON.Generated by Claude Code