Skip to content

Commit f46745b

Browse files
committed
Also add tests for refs with URN+pointer and URN+fragment.
1 parent fc8aca8 commit f46745b

File tree

5 files changed

+255
-0
lines changed

5 files changed

+255
-0
lines changed

tests/draft-next/ref.json

+51
Original file line numberDiff line numberDiff line change
@@ -779,5 +779,56 @@
779779
"valid": false
780780
}
781781
]
782+
},
783+
{
784+
"description": "URN base URI with URN and JSON pointer ref",
785+
"schema": {
786+
"$id": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed",
787+
"properties": {
788+
"foo": {"$ref": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed#/$defs/bar"}
789+
},
790+
"$defs": {
791+
"bar": {"type": "string"}
792+
}
793+
},
794+
"tests": [
795+
{
796+
"description": "a string is valid",
797+
"data": {"foo": "bar"},
798+
"valid": true
799+
},
800+
{
801+
"description": "a non-string is invalid",
802+
"data": {"foo": 12},
803+
"valid": false
804+
}
805+
]
806+
},
807+
{
808+
"description": "URN base URI with URN and anchor ref",
809+
"schema": {
810+
"$id": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed",
811+
"properties": {
812+
"foo": {"$ref": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed#something"}
813+
},
814+
"$defs": {
815+
"bar": {
816+
"$anchor": "something",
817+
"type": "string"
818+
}
819+
}
820+
},
821+
"tests": [
822+
{
823+
"description": "a string is valid",
824+
"data": {"foo": "bar"},
825+
"valid": true
826+
},
827+
{
828+
"description": "a non-string is invalid",
829+
"data": {"foo": 12},
830+
"valid": false
831+
}
832+
]
782833
}
783834
]

tests/draft2019-09/ref.json

+51
Original file line numberDiff line numberDiff line change
@@ -779,5 +779,56 @@
779779
"valid": false
780780
}
781781
]
782+
},
783+
{
784+
"description": "URN base URI with URN and JSON pointer ref",
785+
"schema": {
786+
"$id": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed",
787+
"properties": {
788+
"foo": {"$ref": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed#/$defs/bar"}
789+
},
790+
"$defs": {
791+
"bar": {"type": "string"}
792+
}
793+
},
794+
"tests": [
795+
{
796+
"description": "a string is valid",
797+
"data": {"foo": "bar"},
798+
"valid": true
799+
},
800+
{
801+
"description": "a non-string is invalid",
802+
"data": {"foo": 12},
803+
"valid": false
804+
}
805+
]
806+
},
807+
{
808+
"description": "URN base URI with URN and anchor ref",
809+
"schema": {
810+
"$id": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed",
811+
"properties": {
812+
"foo": {"$ref": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed#something"}
813+
},
814+
"$defs": {
815+
"bar": {
816+
"$anchor": "something",
817+
"type": "string"
818+
}
819+
}
820+
},
821+
"tests": [
822+
{
823+
"description": "a string is valid",
824+
"data": {"foo": "bar"},
825+
"valid": true
826+
},
827+
{
828+
"description": "a non-string is invalid",
829+
"data": {"foo": 12},
830+
"valid": false
831+
}
832+
]
782833
}
783834
]

tests/draft2020-12/ref.json

+51
Original file line numberDiff line numberDiff line change
@@ -779,5 +779,56 @@
779779
"valid": false
780780
}
781781
]
782+
},
783+
{
784+
"description": "URN base URI with URN and JSON pointer ref",
785+
"schema": {
786+
"$id": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed",
787+
"properties": {
788+
"foo": {"$ref": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed#/$defs/bar"}
789+
},
790+
"$defs": {
791+
"bar": {"type": "string"}
792+
}
793+
},
794+
"tests": [
795+
{
796+
"description": "a string is valid",
797+
"data": {"foo": "bar"},
798+
"valid": true
799+
},
800+
{
801+
"description": "a non-string is invalid",
802+
"data": {"foo": 12},
803+
"valid": false
804+
}
805+
]
806+
},
807+
{
808+
"description": "URN base URI with URN and anchor ref",
809+
"schema": {
810+
"$id": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed",
811+
"properties": {
812+
"foo": {"$ref": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed#something"}
813+
},
814+
"$defs": {
815+
"bar": {
816+
"$anchor": "something",
817+
"type": "string"
818+
}
819+
}
820+
},
821+
"tests": [
822+
{
823+
"description": "a string is valid",
824+
"data": {"foo": "bar"},
825+
"valid": true
826+
},
827+
{
828+
"description": "a non-string is invalid",
829+
"data": {"foo": 12},
830+
"valid": false
831+
}
832+
]
782833
}
783834
]

tests/draft6/ref.json

+51
Original file line numberDiff line numberDiff line change
@@ -832,5 +832,56 @@
832832
"valid": false
833833
}
834834
]
835+
},
836+
{
837+
"description": "URN base URI with URN and JSON pointer ref",
838+
"schema": {
839+
"$id": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed",
840+
"properties": {
841+
"foo": {"$ref": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed#/$defs/bar"}
842+
},
843+
"$defs": {
844+
"bar": {"type": "string"}
845+
}
846+
},
847+
"tests": [
848+
{
849+
"description": "a string is valid",
850+
"data": {"foo": "bar"},
851+
"valid": true
852+
},
853+
{
854+
"description": "a non-string is invalid",
855+
"data": {"foo": 12},
856+
"valid": false
857+
}
858+
]
859+
},
860+
{
861+
"description": "URN base URI with URN and anchor ref",
862+
"schema": {
863+
"$id": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed",
864+
"properties": {
865+
"foo": {"$ref": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed#something"}
866+
},
867+
"$defs": {
868+
"bar": {
869+
"$id": "something",
870+
"type": "string"
871+
}
872+
}
873+
},
874+
"tests": [
875+
{
876+
"description": "a string is valid",
877+
"data": {"foo": "bar"},
878+
"valid": true
879+
},
880+
{
881+
"description": "a non-string is invalid",
882+
"data": {"foo": 12},
883+
"valid": false
884+
}
885+
]
835886
}
836887
]

tests/draft7/ref.json

+51
Original file line numberDiff line numberDiff line change
@@ -832,5 +832,56 @@
832832
"valid": false
833833
}
834834
]
835+
},
836+
{
837+
"description": "URN base URI with URN and JSON pointer ref",
838+
"schema": {
839+
"$id": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed",
840+
"properties": {
841+
"foo": {"$ref": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed#/$defs/bar"}
842+
},
843+
"$defs": {
844+
"bar": {"type": "string"}
845+
}
846+
},
847+
"tests": [
848+
{
849+
"description": "a string is valid",
850+
"data": {"foo": "bar"},
851+
"valid": true
852+
},
853+
{
854+
"description": "a non-string is invalid",
855+
"data": {"foo": 12},
856+
"valid": false
857+
}
858+
]
859+
},
860+
{
861+
"description": "URN base URI with URN and anchor ref",
862+
"schema": {
863+
"$id": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed",
864+
"properties": {
865+
"foo": {"$ref": "urn:uuid:deadbeef-1234-0000-0000-4321feebdaed#something"}
866+
},
867+
"$defs": {
868+
"bar": {
869+
"$id": "#something",
870+
"type": "string"
871+
}
872+
}
873+
},
874+
"tests": [
875+
{
876+
"description": "a string is valid",
877+
"data": {"foo": "bar"},
878+
"valid": true
879+
},
880+
{
881+
"description": "a non-string is invalid",
882+
"data": {"foo": 12},
883+
"valid": false
884+
}
885+
]
835886
}
836887
]

0 commit comments

Comments
 (0)