ajv/spec/extras/const.json

66 lines
1.5 KiB
JSON
Raw Normal View History

2015-11-28 17:59:08 +03:00
[
{
"description": "const keyword requires the value to be equal to some constant",
"schema": { "const": 2 },
2015-11-28 17:59:08 +03:00
"tests": [
{
"description": "same value is valid",
"data": 2,
"valid": true
},
{
"description": "another value is invalid",
"data": 5,
"valid": false
},
{
"description": "another type is invalid",
"data": "a",
"valid": false
}
]
},
{
"description": "const keyword requires the value to be equal to some object",
"schema": { "const": { "foo": "bar", "baz": "bax" } },
2015-11-28 17:59:08 +03:00
"tests": [
{
"description": "same object is valid",
"data": { "foo": "bar", "baz": "bax" },
"valid": true
},
{
"description": "same object with different property order is valid",
"data": { "baz": "bax", "foo": "bar" },
"valid": true
},
{
"description": "another object is invalid",
"data": { "foo": "bar" },
"valid": false
},
{
"description": "another type is invalid",
"data": [ 1, 2 ],
"valid": false
}
]
},
{
"description": "const keyword with null",
"schema": { "const": null },
"tests": [
{
"description": "null is valid",
"data": null,
"valid": true
},
{
"description": "not null is invalid",
"data": 0,
"valid": false
}
]
2015-11-28 17:59:08 +03:00
}
]