Skip to content

Structured JSON error body for body-schema 422 (refs #320) - #333

Merged
jimhoyd merged 1 commit into
mainfrom
feat/body-schema-json-422
Sep 20, 2026
Merged

jimhoyd merged 1 commit into
mainfrom
feat/body-schema-json-422

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

Refs #320 (does not close it: real workerd/wrangler behavior is still unverified).

  • request.body.schema failures answer JSON (error, message, issues[] with RFC 6901 pointer, keyword, message, expected/property) when Accept names application/json explicitly (q>0, not below an explicit text/plain). Otherwise the plain text is unchanged. Never includes the offending value; max 8 issues, 4096 bytes, truncated flag.
  • One code path (checkRequest renders, errorResponse emits), so server, Worker, AWS and Vercel agree. No schema change, so YAML reference is unchanged; no new package files (428 files packed, budget 440 not touched).
  • Tests: negotiation, secret never echoed, trusted vs sandbox, built-Worker parity, size bound. Docs: HTTP.md, SPECIFICATION.md, example README and fixtures, llms-full.txt.

Open decisions: array positions are /[] (not indexes) to match the text form; enum values are listed when <=16 and short; JSON needs an explicit Accept (wildcards stay text).

🤖 Generated with Claude Code

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