docs(zod-validator, standard-validator): document default error response format - #2060
docs(zod-validator, standard-validator): document default error response format#2060arsalanghogari wants to merge 2 commits into
Conversation
|
…se format Documents the exact JSON body each validator returns on validation failure when no hook is provided, and adds a hook example producing an RFC 9457 Problem Details response. Refs honojs#2049
2e07621 to
8f9cfa9
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2060 +/- ##
=======================================
Coverage 92.14% 92.14%
=======================================
Files 115 115
Lines 4113 4113
Branches 1072 1072
=======================================
Hits 3790 3790
Misses 287 287
Partials 36 36
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Part 1 of the plan proposed in #2049 (docs first, opt-in RFC 9457 formatter as a possible follow-up).
What this adds
For both
@hono/zod-validatorand@hono/standard-validatorREADMEs:zod-validatorreturns Zod's serializedsafeParseresult, whereerror.messageis a JSON string of the issue arraystandard-validatorechoes the raw request input back indata, which may be undesirable for sensitive valuesapplication/problem+json, so the standard format is one copy-paste awayBoth example hooks were run against the current packages to confirm they work as shown. Docs only, no behavior changes, so no changeset included.