You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Request]: Structured JSON error body for request.body.schema 422 responses #320
ai-firstReduces friction for AI agents authoring URLCode projectsenhancementNew feature or requestimportantHigh-priority work selected for near-term focus
The maintainer decision asked for a structured 400/422 on body-schema failure. #306 answers 422 with a plain-text message. Add a JSON error body (for example the failing JSON pointer and keyword, never the offending value) when the client accepts JSON, keeping the plain-text form otherwise, and document it in docs/SPECIFICATION.md.
Also unverified in #306: behavior on a real Cloudflare Worker (workerd/wrangler); parity was tested by running the built Worker code in Node.
Progress: PR #333 opened: 422 body-schema failures return a structured JSON body ({error, message, issues[]} with a schema-derived pointer, keyword and expected constraint, never a value) when the client explicitly accepts application/json; plain text otherwise.
Shipped in #333: body-schema 422 responses return {error, message, issues[]} JSON when the client explicitly accepts application/json (pointer built only from schema-declared names, keyword, expected constraint; never a value; at most 8 issues and 4096 bytes), plain text otherwise. Worker parity is tested by running the built handler in Node, not on workerd or wrangler, so real-Worker behavior is still unverified; keeping this open for that.
Progress: PR #381 opened: the Cloudflare build of examples/body-validation was run on real workerd (Wrangler 4.136.0, local, nothing deployed) and returned byte-identical responses to the Node server for 16 requests, including the structured 422 body; recorded in docs/CLOUDFLARE.md with npm run test:workerd to repeat it.
Verified and documented in #381: the Cloudflare build of examples/body-validation ran on real workerd (Wrangler 4.136.0 with workerd 2026-09-21, local, nothing deployed) and returned byte-identical status, headers and bodies to the Node server for 16 requests (structured 422 JSON, plain-text fallbacks, 400/413/415, format: uuid, and the 128-character worst-case pattern at about 2 ms), with no eval or new Function in the generated Worker. Excluded from the comparison: the per-request X-Request-Id and workerd's gzip of the response when the client sends Accept-Encoding (decoded body identical). npm run test:workerd repeats it (needs the network, installs Wrangler into a temp directory, skips when workerd cannot start). Not covered: Cloudflare's network, CPU limits, real request-size limits and edge compression, so behavior on a real deployment is still unverified; the docs say so.
ai-firstReduces friction for AI agents authoring URLCode projectsenhancementNew feature or requestimportantHigh-priority work selected for near-term focus
Activity
jimhoyd commentedon Sep 20, 2026
Progress: an agent has started on this; a PR will be linked here when it opens.
jimhoyd commentedon Sep 20, 2026
Progress: PR #333 opened: 422 body-schema failures return a structured JSON body ({error, message, issues[]} with a schema-derived pointer, keyword and expected constraint, never a value) when the client explicitly accepts application/json; plain text otherwise.
Answer body-schema 422 with a structured JSON body when JSON is expli…
jimhoyd commentedon Sep 20, 2026
Shipped in #333: body-schema 422 responses return {error, message, issues[]} JSON when the client explicitly accepts application/json (pointer built only from schema-declared names, keyword, expected constraint; never a value; at most 8 issues and 4096 bytes), plain text otherwise. Worker parity is tested by running the built handler in Node, not on workerd or wrangler, so real-Worker behavior is still unverified; keeping this open for that.
jimhoyd commentedon Sep 21, 2026
Progress: an agent has started on this; a PR will be linked here when it opens.
jimhoyd commentedon Sep 21, 2026
Progress: PR #381 opened: the Cloudflare build of examples/body-validation was run on real workerd (Wrangler 4.136.0, local, nothing deployed) and returned byte-identical responses to the Node server for 16 requests, including the structured 422 body; recorded in docs/CLOUDFLARE.md with npm run test:workerd to repeat it.
docs: record body-schema 422 parity on a real workerd (refs #320)
docs: record body-schema 422 parity on a real workerd (refs #320) (#381)
jimhoyd commentedon Sep 21, 2026
Verified and documented in #381: the Cloudflare build of examples/body-validation ran on real workerd (Wrangler 4.136.0 with workerd 2026-09-21, local, nothing deployed) and returned byte-identical status, headers and bodies to the Node server for 16 requests (structured 422 JSON, plain-text fallbacks, 400/413/415, format: uuid, and the 128-character worst-case pattern at about 2 ms), with no eval or new Function in the generated Worker. Excluded from the comparison: the per-request X-Request-Id and workerd's gzip of the response when the client sends Accept-Encoding (decoded body identical). npm run test:workerd repeats it (needs the network, installs Wrangler into a temp directory, skips when workerd cannot start). Not covered: Cloudflare's network, CPU limits, real request-size limits and edge compression, so behavior on a real deployment is still unverified; the docs say so.