Skip to content

Commit f7d27e6

Browse files
committed
add test for tag URI in $id (#797)
1 parent a247442 commit f7d27e6

File tree

5 files changed

+120
-0
lines changed

5 files changed

+120
-0
lines changed

tests/draft2019-09/ref.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,30 @@
720720
}
721721
]
722722
},
723+
{
724+
"description": "simple tag URI base URI with $ref via the tag URI",
725+
"schema": {
726+
"$comment": "URIs do not have to have HTTP(s) schemes",
727+
"$schema": "https://json-schema.org/draft/2020-12/schema",
728+
"$id": "tag:foo.example,2025:bar/baz",
729+
"minimum": 30,
730+
"properties": {
731+
"foo": {"$ref": "tag:foo.example,2025:bar/baz"}
732+
}
733+
},
734+
"tests": [
735+
{
736+
"description": "valid under the tag URI IDed schema",
737+
"data": {"foo": 37},
738+
"valid": true
739+
},
740+
{
741+
"description": "invalid under the tag URI IDed schema",
742+
"data": {"foo": 12},
743+
"valid": false
744+
}
745+
]
746+
},
723747
{
724748
"description": "simple URN base URI with JSON pointer",
725749
"schema": {

tests/draft2020-12/ref.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,30 @@
720720
}
721721
]
722722
},
723+
{
724+
"description": "simple tag URI base URI with $ref via the tag URI",
725+
"schema": {
726+
"$comment": "URIs do not have to have HTTP(s) schemes",
727+
"$schema": "https://json-schema.org/draft/2020-12/schema",
728+
"$id": "tag:foo.example,2025:bar/baz",
729+
"minimum": 30,
730+
"properties": {
731+
"foo": {"$ref": "tag:foo.example,2025:bar/baz"}
732+
}
733+
},
734+
"tests": [
735+
{
736+
"description": "valid under the tag URI IDed schema",
737+
"data": {"foo": 37},
738+
"valid": true
739+
},
740+
{
741+
"description": "invalid under the tag URI IDed schema",
742+
"data": {"foo": 12},
743+
"valid": false
744+
}
745+
]
746+
},
723747
{
724748
"description": "simple URN base URI with JSON pointer",
725749
"schema": {

tests/draft6/ref.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,30 @@
659659
}
660660
]
661661
},
662+
{
663+
"description": "simple tag URI base URI with $ref via the tag URI",
664+
"schema": {
665+
"$comment": "URIs do not have to have HTTP(s) schemes",
666+
"$schema": "https://json-schema.org/draft/2020-12/schema",
667+
"$id": "tag:foo.example,2025:bar/baz",
668+
"minimum": 30,
669+
"properties": {
670+
"foo": {"$ref": "tag:foo.example,2025:bar/baz"}
671+
}
672+
},
673+
"tests": [
674+
{
675+
"description": "valid under the tag URI IDed schema",
676+
"data": {"foo": 37},
677+
"valid": true
678+
},
679+
{
680+
"description": "invalid under the tag URI IDed schema",
681+
"data": {"foo": 12},
682+
"valid": false
683+
}
684+
]
685+
},
662686
{
663687
"description": "simple URN base URI with JSON pointer",
664688
"schema": {

tests/draft7/ref.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,30 @@
695695
}
696696
]
697697
},
698+
{
699+
"description": "simple tag URI base URI with $ref via the tag URI",
700+
"schema": {
701+
"$comment": "URIs do not have to have HTTP(s) schemes",
702+
"$schema": "https://json-schema.org/draft/2020-12/schema",
703+
"$id": "tag:foo.example,2025:bar/baz",
704+
"minimum": 30,
705+
"properties": {
706+
"foo": {"$ref": "tag:foo.example,2025:bar/baz"}
707+
}
708+
},
709+
"tests": [
710+
{
711+
"description": "valid under the tag URI IDed schema",
712+
"data": {"foo": 37},
713+
"valid": true
714+
},
715+
{
716+
"description": "invalid under the tag URI IDed schema",
717+
"data": {"foo": 12},
718+
"valid": false
719+
}
720+
]
721+
},
698722
{
699723
"description": "simple URN base URI with JSON pointer",
700724
"schema": {

tests/v1/ref.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,30 @@
720720
}
721721
]
722722
},
723+
{
724+
"description": "simple tag URI base URI with $ref via the tag URI",
725+
"schema": {
726+
"$comment": "URIs do not have to have HTTP(s) schemes",
727+
"$schema": "https://json-schema.org/draft/2020-12/schema",
728+
"$id": "tag:foo.example,2025:bar/baz",
729+
"minimum": 30,
730+
"properties": {
731+
"foo": {"$ref": "tag:foo.example,2025:bar/baz"}
732+
}
733+
},
734+
"tests": [
735+
{
736+
"description": "valid under the tag URI IDed schema",
737+
"data": {"foo": 37},
738+
"valid": true
739+
},
740+
{
741+
"description": "invalid under the tag URI IDed schema",
742+
"data": {"foo": 12},
743+
"valid": false
744+
}
745+
]
746+
},
723747
{
724748
"description": "simple URN base URI with JSON pointer",
725749
"schema": {

0 commit comments

Comments
 (0)