Skip to content

fix: emit runtyp 2 union syntax in validator codegen - #95

Merged
mhweiner merged 1 commit into
mainfrom
fix/codegen-runtyp-union-syntax
Aug 26, 2026
Merged

fix: emit runtyp 2 union syntax in validator codegen#95
mhweiner merged 1 commit into
mainfrom
fix/codegen-runtyp-union-syntax

Conversation

@logfox-agent

@logfox-agent logfox-agent commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

callspec pins runtyp 2.5, but validator codegen was still emitting runtyp 1 union syntax.

  • Wrong (what we generated): p.union(p.literal("a"), p.literal("b"))
  • Right (runtyp 2): p.union([p.literal("a"), p.literal("b")], "invalid")

Consumer apps compile the generated schemas object with runtyp 2 — so tsc fails with “Expected 2 arguments, but got 6” on enum/oneOf fields.

Fix: emit the runtyp 2 form for string enums, oneOf, and anyOf.

Test plan

  • npm run validate
  • Local Bugbot — no findings
  • After merge/publish: bump app-frontend and delete patch-callspec-codegen.mjs

Use p.union([...], message) for enum, oneOf, and anyOf preds so generated
schemas typecheck against runtyp 2.x.

Co-authored-by: Cursor <cursoragent@cursor.com>
@mhweiner
mhweiner merged commit 874c778 into main Aug 26, 2026
3 checks passed
@mhweiner
mhweiner deleted the fix/codegen-runtyp-union-syntax branch August 26, 2026 19:09
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