Skip to content

docs(downgrader): oapi-codegen stops on an inline nullable number enum - #392

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.

Since #380, an enum that has null but no type gets typed as { type: "integer", nullable: true, enum: [1, 2, null] }. Zod 4.6.7 writes exactly that for z.literal([1, 2, null]), and so does oRPC beta.49 (with downgrader 0.7.1). oapi-codegen v2.8.2 (-generate types,std-http-server) then stops with:

error generating code for type enums: enum value "<nil>" of AParamsLit is not a number or boolean literal, which its Go type int requires
schema where 3.0 3.1
{type: integer|number|boolean, nullable: true, enum: [.., null]} query parameter, body property, inline response property, nested inline property ERR —
same component schema, its property, array items, whole response body OK —
{type: string, nullable: true, enum: [.., null]} anywhere OK —
{enum: [1, 2, null]} (the input) query parameter, body property — OK
type: ["integer", "null"], enum: [1, 2, null] query parameter, body property ERR (same) ERR

The real oRPC beta.49 3.0.4 output of gq.mjs (lit: z.literal([1, 2, null]) as a GET query parameter) fails with the error above.

I'm not proposing a code change. Going back to the untyped enum would bring back the kin-openapi VisitJSON(nil) rejection that #380 fixed. The other shape, a oneOf with the "null" branch last, would hit kin-openapi's request decoding of the last branch (#389) for a query ?lit=1. The typed form passes both of those, and only oapi-codegen's inline enum generation trips on it.


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 21 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: 3ea48db5-fcce-4bfa-b562-ae702c1af683
Commits

Reviewing files that changed from the base of the PR and between 7f7aaa4 and 205d21f.

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@392
npm i https://pkg.pr.new/@openapi-spec/router@392
npm i https://pkg.pr.new/@openapi-spec/types@392

commit: 205d21f

@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 (205d21f) with main (7f7aaa4)

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

  • Documented an oapi-codegen limitation in packages/downgrader/README.md: the oapi-codegen 2.8 bullet now records that it stops on a numeric or boolean nullable enum in a parameter or an inline object property, and that 3.1's untyped enum is read fine.

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

@dinwwwh
dinwwwh merged commit 84f2c48 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