Skip to content

Commit b59543f

Browse files
authored
Merge pull request #647 from santhosh-tekuri/ref-start-slash
test: $ref with absolute-path-reference
2 parents 6e5d45d + 39af4c1 commit b59543f

File tree

5 files changed

+152
-3
lines changed

5 files changed

+152
-3
lines changed

tests/draft-next/ref.json

+30-1
Original file line numberDiff line numberDiff line change
@@ -949,5 +949,34 @@
949949
"valid": true
950950
}
951951
]
952-
}
952+
},
953+
{
954+
"description": "ref with absolute-path-reference",
955+
"schema": {
956+
"$id": "http://example.com/ref/absref.json",
957+
"$defs": {
958+
"a": {
959+
"$id": "http://example.com/ref/absref/foobar.json",
960+
"type": "number"
961+
},
962+
"b": {
963+
"$id": "http://example.com/absref/foobar.json",
964+
"type": "string"
965+
}
966+
},
967+
"$ref": "/absref/foobar.json"
968+
},
969+
"tests": [
970+
{
971+
"description": "a string is valid",
972+
"data": "foo",
973+
"valid": true
974+
},
975+
{
976+
"description": "an integer is invalid",
977+
"data": 12,
978+
"valid": false
979+
}
980+
]
981+
}
953982
]

tests/draft2019-09/ref.json

+30-1
Original file line numberDiff line numberDiff line change
@@ -949,5 +949,34 @@
949949
"valid": true
950950
}
951951
]
952-
}
952+
},
953+
{
954+
"description": "ref with absolute-path-reference",
955+
"schema": {
956+
"$id": "http://example.com/ref/absref.json",
957+
"$defs": {
958+
"a": {
959+
"$id": "http://example.com/ref/absref/foobar.json",
960+
"type": "number"
961+
},
962+
"b": {
963+
"$id": "http://example.com/absref/foobar.json",
964+
"type": "string"
965+
}
966+
},
967+
"$ref": "/absref/foobar.json"
968+
},
969+
"tests": [
970+
{
971+
"description": "a string is valid",
972+
"data": "foo",
973+
"valid": true
974+
},
975+
{
976+
"description": "an integer is invalid",
977+
"data": 12,
978+
"valid": false
979+
}
980+
]
981+
}
953982
]

tests/draft2020-12/ref.json

+29
Original file line numberDiff line numberDiff line change
@@ -949,5 +949,34 @@
949949
"valid": true
950950
}
951951
]
952+
},
953+
{
954+
"description": "ref with absolute-path-reference",
955+
"schema": {
956+
"$id": "http://example.com/ref/absref.json",
957+
"$defs": {
958+
"a": {
959+
"$id": "http://example.com/ref/absref/foobar.json",
960+
"type": "number"
961+
},
962+
"b": {
963+
"$id": "http://example.com/absref/foobar.json",
964+
"type": "string"
965+
}
966+
},
967+
"$ref": "/absref/foobar.json"
968+
},
969+
"tests": [
970+
{
971+
"description": "a string is valid",
972+
"data": "foo",
973+
"valid": true
974+
},
975+
{
976+
"description": "an integer is invalid",
977+
"data": 12,
978+
"valid": false
979+
}
980+
]
952981
}
953982
]

tests/draft6/ref.json

+32-1
Original file line numberDiff line numberDiff line change
@@ -782,5 +782,36 @@
782782
"valid": false
783783
}
784784
]
785-
}
785+
},
786+
{
787+
"description": "ref with absolute-path-reference",
788+
"schema": {
789+
"$id": "http://example.com/ref/absref.json",
790+
"definitions": {
791+
"a": {
792+
"$id": "http://example.com/ref/absref/foobar.json",
793+
"type": "number"
794+
},
795+
"b": {
796+
"$id": "http://example.com/absref/foobar.json",
797+
"type": "string"
798+
}
799+
},
800+
"allOf": [
801+
{ "$ref": "/absref/foobar.json" }
802+
]
803+
},
804+
"tests": [
805+
{
806+
"description": "a string is valid",
807+
"data": "foo",
808+
"valid": true
809+
},
810+
{
811+
"description": "an integer is invalid",
812+
"data": 12,
813+
"valid": false
814+
}
815+
]
816+
}
786817
]

tests/draft7/ref.json

+31
Original file line numberDiff line numberDiff line change
@@ -896,5 +896,36 @@
896896
"valid": true
897897
}
898898
]
899+
},
900+
{
901+
"description": "ref with absolute-path-reference",
902+
"schema": {
903+
"$id": "http://example.com/ref/absref.json",
904+
"definitions": {
905+
"a": {
906+
"$id": "http://example.com/ref/absref/foobar.json",
907+
"type": "number"
908+
},
909+
"b": {
910+
"$id": "http://example.com/absref/foobar.json",
911+
"type": "string"
912+
}
913+
},
914+
"allOf": [
915+
{ "$ref": "/absref/foobar.json" }
916+
]
917+
},
918+
"tests": [
919+
{
920+
"description": "a string is valid",
921+
"data": "foo",
922+
"valid": true
923+
},
924+
{
925+
"description": "an integer is invalid",
926+
"data": 12,
927+
"valid": false
928+
}
929+
]
899930
}
900931
]

0 commit comments

Comments
 (0)