Repository navigation
fix(json-formatter): report every failing field in schema validation - #408
Merged
anurag629 merged 1 commit intoOct 28, 2026
Merged
Conversation
anurag629
approved these changes
Oct 28, 2026
anurag629
left a comment
Member
There was a problem hiding this comment.
Thanks @prakashNalla. Lint (develop's 11 warnings), all 2382 tests, the build and the pages pass on top of develop, and the example from #404 now lists id, name, email and age in one go.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Schema mode only listed the first failing field.
lib/jsonSchema.tscreated the validator withnew Validator(schema, "2020-12"), and the third argument of@cfworker/json-schema'sValidatorisshortCircuit, which defaults totrue, so validation stopped at the first failure. It now passesfalse, so with the sample schema and{"user":{"id":1,"name":"","email":"x","age":-1},"meta":{}}the list hasid,name,emailandagetogether instead of one at a time. Each field error still comes with its parent'sProperty "<name>" does not match schema.line, as the first error did before, so that input lists 9 entries.Closes #404
How I tested this
lib/__tests__/jsonSchema.test.ts, with those four fields wrong, checking the exact list. It fails without the change (only#/user/idcomes back) and passes with it. The existing tests in the file pass unchanged.npm run lint: 0 errors, the same 11 warnings as ondevelop.npm run test: 64 files, 2363 tests pass.npm run build: passes.AI assistance
Claude helped me w/ understand the issue
Type of change
Checklist
npm run lint && npm run test && npm run buildpasses locallylib/and have a test inlib/__tests__/page.tsx, client component,opengraph-image.tsx, and the bug report dropdown are all done