66 lines
1.4 KiB
JSON
66 lines
1.4 KiB
JSON
[
|
|
{
|
|
"description": "required schema in data property",
|
|
"schema": {
|
|
"properties": {
|
|
"foo": {},
|
|
"bar": {},
|
|
"requiredProperties": {}
|
|
},
|
|
"required": { "$data": "0/requiredProperties" }
|
|
},
|
|
"tests": [
|
|
{
|
|
"description": "present required property is valid",
|
|
"data": {
|
|
"foo": 1,
|
|
"requiredProperties": ["foo"]
|
|
},
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "non-present required property is invalid",
|
|
"data": {
|
|
"bar": 2,
|
|
"requiredProperties": ["foo"]
|
|
},
|
|
"valid": false
|
|
},
|
|
{
|
|
"description": "non-present second required property is invalid",
|
|
"data": {
|
|
"foo": 1,
|
|
"requiredProperties": ["foo", "bar"]
|
|
},
|
|
"valid": false
|
|
},
|
|
{
|
|
"description": "two present required properties is valid",
|
|
"data": {
|
|
"foo": 1,
|
|
"bar": 2,
|
|
"requiredProperties": ["foo", "bar"]
|
|
},
|
|
"valid": true
|
|
},
|
|
{
|
|
"description": "fails if value of required is not an array",
|
|
"data": {
|
|
"foo": 1,
|
|
"bar": 2,
|
|
"requiredProperties": true
|
|
},
|
|
"valid": false
|
|
},
|
|
{
|
|
"description": "valid if value of required is undefined",
|
|
"data": {
|
|
"foo": 1,
|
|
"bar": 2
|
|
},
|
|
"valid": true
|
|
}
|
|
]
|
|
}
|
|
]
|