test(idn-hostname): accept a single label starting with a digit in draft7 - #1165
Open
kabirvashisht4-glitch wants to merge 1 commit into
Open
Conversation
…aft7 732e727, which closed json-schema-org#686, added five single-label cases to draft-next, draft2019-09 and draft2020-12 but only four to draft7, leaving out the leading-digit label. That omission made sense at the time: 9265a4f, five days earlier, had removed the leading-digit case from hostname.json for drafts 4, 6 and 7 on the grounds that those drafts cite RFC 1034 rather than RFC 1123. But 9b8ef53 reinstated it, and draft7's hostname.json has asserted "1host" is valid ever since. So draft7 is now the only place where idn-hostname is silent on a label its own hostname.json already accepts. Draft 7 defines idn-hostname in terms of hostname plus RFC 5890, so the two files should agree. Closes json-schema-org#1163
kabirvashisht4-glitch
force-pushed
the
test/idn-hostname-draft7-digit-label
branch
from
August 31, 2026 02:06
3a4bf06 to
fafd65d
Compare
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.
Closes #1163.
tests/draft7/optional/format/idn-hostname.jsonis the only copy of that file with no case for a label beginning with a digit:{ "description": "single label starting with digit", "data": "1host", "valid": true }draft2019-09,draft2020-12andv1all have it.How it happened
732e727, the commit closing #686, added five single-label cases to
draft-next,draft2019-09anddraft2020-12but only four todraft7— the leading-digit one was dropped.That was deliberate at the time. Five days earlier, 9265a4f (do not test hostname with leading digit for older drafts) had removed the equivalent case from
hostname.jsonfor drafts 4, 6 and 7, reasoning that those drafts cite RFC 1034 §3.5 (<label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]) rather than RFC 1123 §2.1, which relaxed the rule to permit a leading digit.That rationale no longer holds for draft7: 9b8ef53 (Cleanup hostname tests) reinstated the case, and
tests/draft7/optional/format/hostname.jsonhas asserted"1host"isvalid: trueever since.The inconsistency
draft7 currently accepts
1hostas ahostnamebut says nothing about it as anidn-hostname, even though draft 7 §7.3.3 defines the latter in terms of the former:This is also what #686 asked for — "idn-hostnames also reference RFC 1123, and thereby allow hostnames with single labels. We should copy these tests there as well." — draft7 just didn't get the full set.
The case is added at the position it occupies in the other drafts, making
idn-hostname.jsonidentical across draft7, draft2019-09, draft2020-12 andv1apart from theschemaobject.Verification
bin/jsonschema_suite checkpasses 11/11 with no skips (jsonschema==4.19.0).