squash: contains does not exist in draft4
{
"description": "empty data",
"data": [ ],
- "valid": false
+ "valid": true
},
{
"description": "all elements match, valid maxContains",
{
"description": "empty data",
"data": [ ],
- "valid": false
+ "valid": true
},
{
"description": "all elements match, invalid minContains",
{
"description": "empty array is valid with minContains=0",
"data": [ ],
- "valid": false
+ "valid": true
},
{
"description": "minContains = 0 would make contains always pass",
"data": [ 2 ],
- "valid": false
+ "valid": true
}
]
},
}
]
},
+ {
+ "description": "contains keyword validation",
+ "schema": {
+ "contains": {"minimum": 5}
+ },
+ "tests": [
+ {
+ "description": "array with item matching schema (5) is valid",
+ "data": [3, 4, 5],
+ "valid": true
+ },
+ {
+ "description": "array with item matching schema (6) is valid",
+ "data": [3, 4, 6],
+ "valid": true
+ },
+ {
+ "description": "array with two items matching schema (5, 6) is valid",
+ "data": [3, 4, 5, 6],
+ "valid": true
+ },
+ {
+ "description": "array without items matching schema is invalid",
+ "data": [2, 3, 4],
+ "valid": false
+ },
+ {
+ "description": "empty array is invalid",
+ "data": [],
+ "valid": false
+ },
+ {
+ "description": "not array is valid",
+ "data": {},
+ "valid": true
+ }
+ ]
+ },
{
"description": "if with boolean schema false",
"schema": { "if": false, "then": { "const": "then" }, "else": { "const": "else" } },
