test(relative-json-pointer): add multi-digit prefix with interior zero#942
Open
vtushar06 wants to merge 1 commit into
Open
test(relative-json-pointer): add multi-digit prefix with interior zero#942vtushar06 wants to merge 1 commit into
vtushar06 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a new conformance test case for the relative-json-pointer format to ensure multi-digit integer prefixes that include 0 are treated as valid across multiple test suites.
Changes:
- Added a new “valid” test case for a multi-digit integer prefix containing
0 - Applied the same test addition across v1 and draft7/draft2019-09/draft2020-12 optional format suites
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/v1/format/relative-json-pointer.json | Adds a new valid-case example for a multi-digit prefix containing 0 |
| tests/draft7/optional/format/relative-json-pointer.json | Mirrors the new valid-case example in the draft7 optional suite |
| tests/draft2020-12/optional/format/relative-json-pointer.json | Mirrors the new valid-case example in the draft2020-12 optional suite |
| tests/draft2019-09/optional/format/relative-json-pointer.json | Mirrors the new valid-case example in the draft2019-09 optional suite |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+100
to
+102
| "description": "multi-digit prefix with a zero followed by another digit", | ||
| "data": "100", | ||
| "valid": true |
jviotti
approved these changes
Jun 16, 2026
jviotti
left a comment
Member
There was a problem hiding this comment.
I doubled-checked and it looks correct!
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.
Following the methodology I used for ipv4 and uuid, I read draft-handrews-relative-json-pointer-01 section 3 and found the suite has no test for a multi-digit prefix with an interior zero - the spot where a hand-rolled integer scanner can go wrong.
The prefix grammar is
non-negative-integer = %x30 / %x31-39 *( %x30-39 ), so after the first digit any digits are allowed, zeros included.100is valid (it is1then00); only a leading zero is barred. The suite already has120/foo/baras a valid multi-digit prefix, but there the zero is the last digit, so it does not exercise a zero that is followed by another digit.Changes
100- a valid non-negative integer with a zero before another digit - valid.Ecosystem Impact
is_relative_json_pointerwalks the string and runsif i > 0 and int(instance[i - 1]) == 0: return False. That guard is meant to catch a leading zero, but it fires on any zero followed by another digit, so100,1000,205are wrongly rejected while120(zero last) passes.RFC References
Reproduction commands and the relative-json-pointer cross-implementation matrix are in my evidence repo: https://github.com/vtushar06/JSON-Schema-format-test-Evidence/blob/main/relative-json-pointer.md
Related: #965