Skip to content

test(idn-hostname): accept a single label starting with a digit in draft7 - #1165

Open
kabirvashisht4-glitch wants to merge 1 commit into
json-schema-org:mainfrom
kabirvashisht4-glitch:test/idn-hostname-draft7-digit-label
Open

test(idn-hostname): accept a single label starting with a digit in draft7#1165
kabirvashisht4-glitch wants to merge 1 commit into
json-schema-org:mainfrom
kabirvashisht4-glitch:test/idn-hostname-draft7-digit-label

Conversation

@kabirvashisht4-glitch

@kabirvashisht4-glitch kabirvashisht4-glitch commented Aug 31, 2026

Copy link
Copy Markdown

Closes #1163.

tests/draft7/optional/format/idn-hostname.json is 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-12 and v1 all have it.

How it happened

732e727, the commit closing #686, added five single-label cases to draft-next, draft2019-09 and draft2020-12 but only four to draft7 — 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.json for 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.json has asserted "1host" is valid: true ever since.

The inconsistency

draft7 currently accepts 1host as a hostname but says nothing about it as an idn-hostname, even though draft 7 §7.3.3 defines the latter in terms of the former:

idn-hostname: As defined by either RFC 1034 as for hostname, or an internationalized hostname as defined by RFC 5890, section 2.3.2.3.

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.json identical across draft7, draft2019-09, draft2020-12 and v1 apart from the schema object.

Verification

bin/jsonschema_suite check passes 11/11 with no skips (jsonschema==4.19.0).

@kabirvashisht4-glitch
kabirvashisht4-glitch requested a review from a team as a code owner August 31, 2026 02:03
…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
kabirvashisht4-glitch force-pushed the test/idn-hostname-draft7-digit-label branch from 3a4bf06 to fafd65d Compare August 31, 2026 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

idn-hostname: draft7 is missing the single-label-starting-with-digit case from #686

1 participant