Skip to content

Commit 8feb429

Browse files
jgraettingerJulian
authored andcommitted
More unevaluatedProperties tests.
1 parent 960f519 commit 8feb429

File tree

1 file changed

+69
-11
lines changed

1 file changed

+69
-11
lines changed

tests/draft2019-09/unevaluatedProperties.json

Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
[
22
{
3-
"description": "can peer inside allOf, results in no-op",
3+
"description": "allOf with false unevaluatedProperties",
44
"schema": {
55
"$schema": "https://json-schema.org/draft/2019-09/schema",
66
"unevaluatedProperties": false,
77
"allOf": [
8-
{
9-
"properties": {
10-
"foo": { "type": ["string", "null"] },
11-
"bar": { "type": ["string", "null"] }
8+
{
9+
"properties": {
10+
"foo": { "type": ["string", "null"] },
11+
"bar": { "type": ["string", "null"] }
12+
}
13+
},
14+
{
15+
"additionalProperties": {
16+
"not": { "enum": [ null ] }
17+
}
1218
}
13-
},
14-
{
15-
"additionalProperties": {
16-
"not": { "enum": [ null ] }
17-
}
18-
}
1919
]
2020
},
2121
"tests": [
@@ -28,6 +28,64 @@
2828
"description": "null prop is invalid",
2929
"data": { "bar": "foo", "bob": null },
3030
"valid": false
31+
},
32+
{
33+
"description": "named property with wrong type is invalid",
34+
"data": { "bar": "foo", "bob": "who?" },
35+
"valid": true
36+
}
37+
]
38+
},
39+
{
40+
"description": "complex unevaluated schema",
41+
"schema": {
42+
"$schema": "https://json-schema.org/draft/2019-09/schema",
43+
"unevaluatedProperties": {
44+
"allOf": [{"minLength": 3}, {"type": "string"}]
45+
},
46+
"if": {
47+
"properties": {
48+
"foo": {"type": "integer"},
49+
"arr": {"type": "array"}
50+
},
51+
"required": ["foo"]
52+
}
53+
},
54+
"tests": [
55+
{
56+
"description": "empty object",
57+
"data": {},
58+
"valid": true
59+
},
60+
{
61+
"description": "if passes",
62+
"data": {"foo": 3, "arr": [1,2]},
63+
"valid": true
64+
},
65+
{
66+
"description": "if passes with valid uneval",
67+
"data": {"foo": 3, "arr": [1,2], "uneval": "long-string"},
68+
"valid": true
69+
},
70+
{
71+
"description": "if passes with invalid short uneval",
72+
"data": {"foo": 3, "arr": [1,2], "uneval": "zz"},
73+
"valid": false
74+
},
75+
{
76+
"description": "if fails, and uneval fails because of array",
77+
"data": {"foo": "not-an-int", "arr": [1,2], "uneval": "long-string"},
78+
"valid": false
79+
},
80+
{
81+
"description": "if fails with valid uneval",
82+
"data": {"foo": "not-an-int", "uneval": "long-string"},
83+
"valid": true
84+
},
85+
{
86+
"description": "if fails with invalid uneval",
87+
"data": {"foo": "zz", "uneval": "long-string"},
88+
"valid": false
3189
}
3290
]
3391
}

0 commit comments

Comments
 (0)