Repository navigation
fix: Report Draft-06/07 sub-schema errors at the property and item path - #967
Merged
DannyvdSluijs merged 1 commit intoOct 16, 2026
Merged
Conversation
Contributor
|
🎉 You're making a difference! We appreciate your effort and dedication. A reviewer will check it out soon, but in the meantime, give yourself a pat on the back. Keep up the great work! 💪🚀 ⭐ Enjoying contributing? Star the project! ⭐ Your contributions help this project grow, and we'd love your support in another way too! If you find this repo helpful, consider leaving a star 🌟 on GitHub. |
Roman3349
force-pushed
the
fix/draft06-07-error-paths
branch
2 times, most recently
from
October 14, 2026 13:45
fcdbaad to
94a96c5
Compare
The properties, patternProperties, items and additionalItems constraints of Draft-06 and Draft-07 passed the parent path to sub-schema checks unchanged, so nested errors were reported at the root. Errors that then differed only by location were also collapsed by the Validator's de-duplication, dropping them from the result. Append the property name or item index to the path, as Draft 2019-09 already does. Signed-off-by: Roman Ondráček <mail@romanondracek.cz>
DannyvdSluijs
force-pushed
the
fix/draft06-07-error-paths
branch
from
October 16, 2026 19:55
94a96c5 to
f8da9d2
Compare
DannyvdSluijs
approved these changes
Oct 16, 2026
Collaborator
|
Thanks @Roman3349 for all the contributions. |
Roman3349
added a commit
to Roman3349/json-schema
that referenced
this pull request
Oct 17, 2026
Bring Draft 2020-12 in line with the changes merged into main since the branch was created: - Support unevaluatedProperties (jsonrainbow#931). $dynamicRef is not followed, the same way $recursiveRef is not in Draft 2019-09. - Use EcmaPatternConverter for pattern, patternProperties, additionalProperties and unevaluatedProperties (jsonrainbow#943). - Add error path and ECMA pattern tests (jsonrainbow#967, jsonrainbow#943). - Drop skip list entries that now pass, including the bignum float comparisons fixed by jsonrainbow#982. Signed-off-by: Roman Ondráček <mail@romanondracek.cz>
Roman3349
added a commit
to Roman3349/json-schema
that referenced
this pull request
Oct 24, 2026
Bring Draft 2020-12 in line with the changes merged into main since the branch was created: - Support unevaluatedProperties (jsonrainbow#931). $dynamicRef is not followed, the same way $recursiveRef is not in Draft 2019-09. - Use EcmaPatternConverter for pattern, patternProperties, additionalProperties and unevaluatedProperties (jsonrainbow#943). - Add error path and ECMA pattern tests (jsonrainbow#967, jsonrainbow#943). - Drop skip list entries that now pass, including the bignum float comparisons fixed by jsonrainbow#982. Signed-off-by: Roman Ondráček <mail@romanondracek.cz>
Roman3349
added a commit
to Roman3349/json-schema
that referenced
this pull request
Oct 24, 2026
Bring Draft 2020-12 in line with the changes merged into main since the branch was created: - Support unevaluatedProperties (jsonrainbow#931). $dynamicRef is not followed, the same way $recursiveRef is not in Draft 2019-09. - Use EcmaPatternConverter for pattern, patternProperties, additionalProperties and unevaluatedProperties (jsonrainbow#943). - Add error path and ECMA pattern tests (jsonrainbow#967, jsonrainbow#943). - Reject a trailing newline in idn-hostname (jsonrainbow#990). - Drop skip list entries that now pass, including the bignum float comparisons fixed by jsonrainbow#982. Signed-off-by: Roman Ondráček <mail@romanondracek.cz>
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.
Description
With a Draft-06 or Draft-07 schema, errors from nested properties and array items were reported at the root (
pointer: "",property: ""). Theproperties,patternProperties,itemsandadditionalItemsconstraints passed the parent's$pathto the sub-schema check unchanged instead of appending the property name or item index.This also made errors disappear:
Validator::validate()de-duplicates witharray_unique($errors, SORT_REGULAR), so errors that differed only by location were merged into one.Example schema:
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": ["bar"], "properties": { "foo": {"type": "integer"}, "n": {"type": "object", "properties": {"x": {"type": "integer"}}} } }Validated against
{"foo": "bar", "n": {"x": "y"}}:/barThe property bar is required/barThe property bar is required""String value found, but integer is required/fooString value found, but integer is required/n/xString value found, but integer is requiredChanges:
additionalItemserrors are now reported at the item's index instead of at the array.additionalPropertiesalready reported the correct path (Report additional property errors at the property path #942) and is unchanged.Validatoris unchanged. With correct paths, distinct errors no longer collapse.Related Issue
Type of Change
Checklist
Additional Notes
ErrorPathTestfor Draft-06, Draft-07 and Draft 2019-09. Each covers nested properties,items/additionalItemsandpatternProperties. The Draft-06 and Draft-07 tests fail without this change. The Draft 2019-09 test guards the existing behaviour.pointerandpropertyinstead of empty strings, and previously merged errors are reported separately. This is a bug fix, but code that relied on the old empty paths or the error count will see different output.