From f7d27e6cbc48a8a870ebef9db3446bf6adfef1bc Mon Sep 17 00:00:00 2001 From: Patrick Roemer Date: Tue, 25 Nov 2025 12:52:16 +0100 Subject: [PATCH 1/2] add test for tag URI in $id (#797) --- tests/draft2019-09/ref.json | 24 ++++++++++++++++++++++++ tests/draft2020-12/ref.json | 24 ++++++++++++++++++++++++ tests/draft6/ref.json | 24 ++++++++++++++++++++++++ tests/draft7/ref.json | 24 ++++++++++++++++++++++++ tests/v1/ref.json | 24 ++++++++++++++++++++++++ 5 files changed, 120 insertions(+) diff --git a/tests/draft2019-09/ref.json b/tests/draft2019-09/ref.json index 5ab99100..3c8ef07e 100644 --- a/tests/draft2019-09/ref.json +++ b/tests/draft2019-09/ref.json @@ -720,6 +720,30 @@ } ] }, + { + "description": "simple tag URI base URI with $ref via the tag URI", + "schema": { + "$comment": "URIs do not have to have HTTP(s) schemes", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "tag:foo.example,2025:bar/baz", + "minimum": 30, + "properties": { + "foo": {"$ref": "tag:foo.example,2025:bar/baz"} + } + }, + "tests": [ + { + "description": "valid under the tag URI IDed schema", + "data": {"foo": 37}, + "valid": true + }, + { + "description": "invalid under the tag URI IDed schema", + "data": {"foo": 12}, + "valid": false + } + ] + }, { "description": "simple URN base URI with JSON pointer", "schema": { diff --git a/tests/draft2020-12/ref.json b/tests/draft2020-12/ref.json index 9ca82eeb..e97f7ac7 100644 --- a/tests/draft2020-12/ref.json +++ b/tests/draft2020-12/ref.json @@ -720,6 +720,30 @@ } ] }, + { + "description": "simple tag URI base URI with $ref via the tag URI", + "schema": { + "$comment": "URIs do not have to have HTTP(s) schemes", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "tag:foo.example,2025:bar/baz", + "minimum": 30, + "properties": { + "foo": {"$ref": "tag:foo.example,2025:bar/baz"} + } + }, + "tests": [ + { + "description": "valid under the tag URI IDed schema", + "data": {"foo": 37}, + "valid": true + }, + { + "description": "invalid under the tag URI IDed schema", + "data": {"foo": 12}, + "valid": false + } + ] + }, { "description": "simple URN base URI with JSON pointer", "schema": { diff --git a/tests/draft6/ref.json b/tests/draft6/ref.json index 379322c7..63986810 100644 --- a/tests/draft6/ref.json +++ b/tests/draft6/ref.json @@ -659,6 +659,30 @@ } ] }, + { + "description": "simple tag URI base URI with $ref via the tag URI", + "schema": { + "$comment": "URIs do not have to have HTTP(s) schemes", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "tag:foo.example,2025:bar/baz", + "minimum": 30, + "properties": { + "foo": {"$ref": "tag:foo.example,2025:bar/baz"} + } + }, + "tests": [ + { + "description": "valid under the tag URI IDed schema", + "data": {"foo": 37}, + "valid": true + }, + { + "description": "invalid under the tag URI IDed schema", + "data": {"foo": 12}, + "valid": false + } + ] + }, { "description": "simple URN base URI with JSON pointer", "schema": { diff --git a/tests/draft7/ref.json b/tests/draft7/ref.json index 82e1e167..28c1750b 100644 --- a/tests/draft7/ref.json +++ b/tests/draft7/ref.json @@ -695,6 +695,30 @@ } ] }, + { + "description": "simple tag URI base URI with $ref via the tag URI", + "schema": { + "$comment": "URIs do not have to have HTTP(s) schemes", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "tag:foo.example,2025:bar/baz", + "minimum": 30, + "properties": { + "foo": {"$ref": "tag:foo.example,2025:bar/baz"} + } + }, + "tests": [ + { + "description": "valid under the tag URI IDed schema", + "data": {"foo": 37}, + "valid": true + }, + { + "description": "invalid under the tag URI IDed schema", + "data": {"foo": 12}, + "valid": false + } + ] + }, { "description": "simple URN base URI with JSON pointer", "schema": { diff --git a/tests/v1/ref.json b/tests/v1/ref.json index e7a36f68..fa8af5a5 100644 --- a/tests/v1/ref.json +++ b/tests/v1/ref.json @@ -720,6 +720,30 @@ } ] }, + { + "description": "simple tag URI base URI with $ref via the tag URI", + "schema": { + "$comment": "URIs do not have to have HTTP(s) schemes", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "tag:foo.example,2025:bar/baz", + "minimum": 30, + "properties": { + "foo": {"$ref": "tag:foo.example,2025:bar/baz"} + } + }, + "tests": [ + { + "description": "valid under the tag URI IDed schema", + "data": {"foo": 37}, + "valid": true + }, + { + "description": "invalid under the tag URI IDed schema", + "data": {"foo": 12}, + "valid": false + } + ] + }, { "description": "simple URN base URI with JSON pointer", "schema": { From 542d5beaab0ef3246219be4246a895d66efb52f3 Mon Sep 17 00:00:00 2001 From: Patrick Roemer Date: Wed, 26 Nov 2025 11:56:35 +0100 Subject: [PATCH 2/2] use custom made up URI schema instead of tag URI for arbitrary URI $id tests (#797) --- tests/draft2019-09/ref.json | 10 +++++----- tests/draft2020-12/ref.json | 10 +++++----- tests/draft6/ref.json | 10 +++++----- tests/draft7/ref.json | 10 +++++----- tests/v1/ref.json | 10 +++++----- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tests/draft2019-09/ref.json b/tests/draft2019-09/ref.json index 3c8ef07e..5b0f0931 100644 --- a/tests/draft2019-09/ref.json +++ b/tests/draft2019-09/ref.json @@ -721,24 +721,24 @@ ] }, { - "description": "simple tag URI base URI with $ref via the tag URI", + "description": "simple custom URI base URI with $ref via the custom URI", "schema": { "$comment": "URIs do not have to have HTTP(s) schemes", "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "tag:foo.example,2025:bar/baz", + "$id": "foo:bar/baz", "minimum": 30, "properties": { - "foo": {"$ref": "tag:foo.example,2025:bar/baz"} + "foo": {"$ref": "foo:bar/baz"} } }, "tests": [ { - "description": "valid under the tag URI IDed schema", + "description": "valid under the custom URI IDed schema", "data": {"foo": 37}, "valid": true }, { - "description": "invalid under the tag URI IDed schema", + "description": "invalid under the custom URI IDed schema", "data": {"foo": 12}, "valid": false } diff --git a/tests/draft2020-12/ref.json b/tests/draft2020-12/ref.json index e97f7ac7..9ba8527b 100644 --- a/tests/draft2020-12/ref.json +++ b/tests/draft2020-12/ref.json @@ -721,24 +721,24 @@ ] }, { - "description": "simple tag URI base URI with $ref via the tag URI", + "description": "simple custom URI base URI with $ref via the custom URI", "schema": { "$comment": "URIs do not have to have HTTP(s) schemes", "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "tag:foo.example,2025:bar/baz", + "$id": "foo:bar/baz", "minimum": 30, "properties": { - "foo": {"$ref": "tag:foo.example,2025:bar/baz"} + "foo": {"$ref": "foo:bar/baz"} } }, "tests": [ { - "description": "valid under the tag URI IDed schema", + "description": "valid under the custom URI IDed schema", "data": {"foo": 37}, "valid": true }, { - "description": "invalid under the tag URI IDed schema", + "description": "invalid under the custom URI IDed schema", "data": {"foo": 12}, "valid": false } diff --git a/tests/draft6/ref.json b/tests/draft6/ref.json index 63986810..c7901287 100644 --- a/tests/draft6/ref.json +++ b/tests/draft6/ref.json @@ -660,24 +660,24 @@ ] }, { - "description": "simple tag URI base URI with $ref via the tag URI", + "description": "simple custom URI base URI with $ref via the custom URI", "schema": { "$comment": "URIs do not have to have HTTP(s) schemes", "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "tag:foo.example,2025:bar/baz", + "$id": "foo:bar/baz", "minimum": 30, "properties": { - "foo": {"$ref": "tag:foo.example,2025:bar/baz"} + "foo": {"$ref": "foo:bar/baz"} } }, "tests": [ { - "description": "valid under the tag URI IDed schema", + "description": "valid under the custom URI IDed schema", "data": {"foo": 37}, "valid": true }, { - "description": "invalid under the tag URI IDed schema", + "description": "invalid under the custom URI IDed schema", "data": {"foo": 12}, "valid": false } diff --git a/tests/draft7/ref.json b/tests/draft7/ref.json index 28c1750b..e1a75f85 100644 --- a/tests/draft7/ref.json +++ b/tests/draft7/ref.json @@ -696,24 +696,24 @@ ] }, { - "description": "simple tag URI base URI with $ref via the tag URI", + "description": "simple custom URI base URI with $ref via the custom URI", "schema": { "$comment": "URIs do not have to have HTTP(s) schemes", "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "tag:foo.example,2025:bar/baz", + "$id": "foo:bar/baz", "minimum": 30, "properties": { - "foo": {"$ref": "tag:foo.example,2025:bar/baz"} + "foo": {"$ref": "foo:bar/baz"} } }, "tests": [ { - "description": "valid under the tag URI IDed schema", + "description": "valid under the custom URI IDed schema", "data": {"foo": 37}, "valid": true }, { - "description": "invalid under the tag URI IDed schema", + "description": "invalid under the custom URI IDed schema", "data": {"foo": 12}, "valid": false } diff --git a/tests/v1/ref.json b/tests/v1/ref.json index fa8af5a5..425d71a9 100644 --- a/tests/v1/ref.json +++ b/tests/v1/ref.json @@ -721,24 +721,24 @@ ] }, { - "description": "simple tag URI base URI with $ref via the tag URI", + "description": "simple custom URI base URI with $ref via the custom URI", "schema": { "$comment": "URIs do not have to have HTTP(s) schemes", "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "tag:foo.example,2025:bar/baz", + "$id": "foo:bar/baz", "minimum": 30, "properties": { - "foo": {"$ref": "tag:foo.example,2025:bar/baz"} + "foo": {"$ref": "foo:bar/baz"} } }, "tests": [ { - "description": "valid under the tag URI IDed schema", + "description": "valid under the custom URI IDed schema", "data": {"foo": 37}, "valid": true }, { - "description": "invalid under the tag URI IDed schema", + "description": "invalid under the custom URI IDed schema", "data": {"foo": 12}, "valid": false }