ajv/spec/async/switch.json

41 lines
819 B
JSON

[
{
"description": "switch: async + sync conditions",
"schema": {
"$async": true,
"switch": [
{
"if": { "idExists": { "table": "users" } },
"then": { "minimum": 6 }
},
{
"if": { "minimum": 21 },
"then": { "idExists": { "table": "posts" } }
}
]
},
"tests": [
{
"description": "valid - first condition",
"data": 8,
"valid": true
},
{
"description": "valid - second condition",
"data": 28,
"valid": true
},
{
"description": "invalid - first condition",
"data": 1,
"valid": false
},
{
"description": "invalid - second condition",
"data": 22,
"valid": false
}
]
}
]