Repository navigation
Conversation
The ipv6 regex alternative for "up to two groups before '::', three
groups plus a final pair (or IPv4) after" was written as
`(?:h:h)?::`, which allows exactly two groups or none, never one. So
`1::2:3:4:5:6` and `1::2:3:4:1.2.3.4` were rejected although they are
valid (RFC 4291 2.2). Every other alternative uses `(?:(?:h:){,n}h)?`;
use the same form here.
The new JSON-Schema-Test-Suite has a case for this in
optional/format/ipv6.json ("one group before '::' and five groups after
is valid").
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
The
ipv6format rejects valid addresses that have exactly one group before::and six groups after it (counting an IPv4 tail as two):In
draft04.py, the regex alternative for "up to two groups before::" is(?:h:h)?::(?:h:){3}..., which allows exactly two groups or none. The other alternatives use(?:(?:h:){,n}h)?. This PR uses the same form here ({,1}).The current JSON-Schema-Test-Suite has a case for this:
optional/format/ipv6.json, "one group before '::' and five groups after is valid". The suite pinned in this repo (Test-JSON-Schema-Acceptance-1.026) is older and doesn't include it.Tests
tests/test_format.py::test_ipv6: added1::2:3:4:5:6and1::2:3:4:1.2.3.4(valid), plus1::2:3:4:5:6:7:8(invalid, too many groups). The two valid cases fail on master and pass with this change.ipaddress.IPv6Address: 0–8 groups before and after::, with and without an IPv4 tail, plus the fully written-out forms.1::10:11:12:13:14and1::10:11:12:1.2.3.4).pytest testswith the pinned suite: 4512 passed, 449 xfailed, 936 xpassed. The 12 errors are intests/benchmarks, which needpytest-benchmark(not installed in that run).pylint fastjsonschema: no new warnings.This change was written with an AI coding assistant (Claude Code).
🤖 Generated with Claude Code