Skip to content

Commit eadc416

Browse files
committed
Added tests to encoded refs to unknown keywords.
1 parent 299aa7f commit eadc416

File tree

3 files changed

+136
-4
lines changed

3 files changed

+136
-4
lines changed

tests/draft-next/optional/refOfUnknownKeyword.json

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"description": "reference of a root arbitrary keyword ",
44
"schema": {
5-
"$schema": "https://json-schema.org/draft/next/schema",
5+
"$schema": "https://json-schema.org/draft/2020-12/schema",
66
"unknown-keyword": {"type": "integer"},
77
"properties": {
88
"bar": {"$ref": "#/unknown-keyword"}
@@ -21,10 +21,32 @@
2121
}
2222
]
2323
},
24+
{
25+
"description": "reference of a root arbitrary keyword with encoded ref",
26+
"schema": {
27+
"$schema": "https://json-schema.org/draft/2020-12/schema",
28+
"unknown/keyword": {"type": "integer"},
29+
"properties": {
30+
"bar": {"$ref": "#/unknown~1keyword"}
31+
}
32+
},
33+
"tests": [
34+
{
35+
"description": "match",
36+
"data": {"bar": 3},
37+
"valid": true
38+
},
39+
{
40+
"description": "mismatch",
41+
"data": {"bar": true},
42+
"valid": false
43+
}
44+
]
45+
},
2446
{
2547
"description": "reference of an arbitrary keyword of a sub-schema",
2648
"schema": {
27-
"$schema": "https://json-schema.org/draft/next/schema",
49+
"$schema": "https://json-schema.org/draft/2020-12/schema",
2850
"properties": {
2951
"foo": {"unknown-keyword": {"type": "integer"}},
3052
"bar": {"$ref": "#/properties/foo/unknown-keyword"}
@@ -42,5 +64,27 @@
4264
"valid": false
4365
}
4466
]
67+
},
68+
{
69+
"description": "reference of an arbitrary keyword of a sub-schema with encoded ref",
70+
"schema": {
71+
"$schema": "https://json-schema.org/draft/2020-12/schema",
72+
"properties": {
73+
"foo": {"unknown/keyword": {"type": "integer"}},
74+
"bar": {"$ref": "#/properties/foo/unknown~1keyword"}
75+
}
76+
},
77+
"tests": [
78+
{
79+
"description": "match",
80+
"data": {"bar": 3},
81+
"valid": true
82+
},
83+
{
84+
"description": "mismatch",
85+
"data": {"bar": true},
86+
"valid": false
87+
}
88+
]
4589
}
4690
]

tests/draft2019-09/optional/refOfUnknownKeyword.json

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"description": "reference of a root arbitrary keyword ",
44
"schema": {
5-
"$schema": "https://json-schema.org/draft/2019-09/schema",
5+
"$schema": "https://json-schema.org/draft/2020-12/schema",
66
"unknown-keyword": {"type": "integer"},
77
"properties": {
88
"bar": {"$ref": "#/unknown-keyword"}
@@ -21,10 +21,32 @@
2121
}
2222
]
2323
},
24+
{
25+
"description": "reference of a root arbitrary keyword with encoded ref",
26+
"schema": {
27+
"$schema": "https://json-schema.org/draft/2020-12/schema",
28+
"unknown/keyword": {"type": "integer"},
29+
"properties": {
30+
"bar": {"$ref": "#/unknown~1keyword"}
31+
}
32+
},
33+
"tests": [
34+
{
35+
"description": "match",
36+
"data": {"bar": 3},
37+
"valid": true
38+
},
39+
{
40+
"description": "mismatch",
41+
"data": {"bar": true},
42+
"valid": false
43+
}
44+
]
45+
},
2446
{
2547
"description": "reference of an arbitrary keyword of a sub-schema",
2648
"schema": {
27-
"$schema": "https://json-schema.org/draft/2019-09/schema",
49+
"$schema": "https://json-schema.org/draft/2020-12/schema",
2850
"properties": {
2951
"foo": {"unknown-keyword": {"type": "integer"}},
3052
"bar": {"$ref": "#/properties/foo/unknown-keyword"}
@@ -42,5 +64,27 @@
4264
"valid": false
4365
}
4466
]
67+
},
68+
{
69+
"description": "reference of an arbitrary keyword of a sub-schema with encoded ref",
70+
"schema": {
71+
"$schema": "https://json-schema.org/draft/2020-12/schema",
72+
"properties": {
73+
"foo": {"unknown/keyword": {"type": "integer"}},
74+
"bar": {"$ref": "#/properties/foo/unknown~1keyword"}
75+
}
76+
},
77+
"tests": [
78+
{
79+
"description": "match",
80+
"data": {"bar": 3},
81+
"valid": true
82+
},
83+
{
84+
"description": "mismatch",
85+
"data": {"bar": true},
86+
"valid": false
87+
}
88+
]
4589
}
4690
]

tests/draft2020-12/optional/refOfUnknownKeyword.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,28 @@
2121
}
2222
]
2323
},
24+
{
25+
"description": "reference of a root arbitrary keyword with encoded ref",
26+
"schema": {
27+
"$schema": "https://json-schema.org/draft/2020-12/schema",
28+
"unknown/keyword": {"type": "integer"},
29+
"properties": {
30+
"bar": {"$ref": "#/unknown~1keyword"}
31+
}
32+
},
33+
"tests": [
34+
{
35+
"description": "match",
36+
"data": {"bar": 3},
37+
"valid": true
38+
},
39+
{
40+
"description": "mismatch",
41+
"data": {"bar": true},
42+
"valid": false
43+
}
44+
]
45+
},
2446
{
2547
"description": "reference of an arbitrary keyword of a sub-schema",
2648
"schema": {
@@ -42,5 +64,27 @@
4264
"valid": false
4365
}
4466
]
67+
},
68+
{
69+
"description": "reference of an arbitrary keyword of a sub-schema with encoded ref",
70+
"schema": {
71+
"$schema": "https://json-schema.org/draft/2020-12/schema",
72+
"properties": {
73+
"foo": {"unknown/keyword": {"type": "integer"}},
74+
"bar": {"$ref": "#/properties/foo/unknown~1keyword"}
75+
}
76+
},
77+
"tests": [
78+
{
79+
"description": "match",
80+
"data": {"bar": 3},
81+
"valid": true
82+
},
83+
{
84+
"description": "mismatch",
85+
"data": {"bar": true},
86+
"valid": false
87+
}
88+
]
4589
}
4690
]

0 commit comments

Comments
 (0)