@knowark/validarkjs
Version:
Simple Data Validation Library
70 lines (69 loc) • 1.92 kB
JSON
[
{
"description": "reference of a root arbitrary keyword ",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"unknown-keyword": {"type": "integer"},
"properties": {
"bar": {"$ref": "#/unknown-keyword"}
}
},
"tests": [
{
"description": "match",
"data": {"bar": 3},
"valid": true
},
{
"description": "mismatch",
"data": {"bar": true},
"valid": false
}
]
},
{
"description": "reference of an arbitrary keyword of a sub-schema",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"foo": {"unknown-keyword": {"type": "integer"}},
"bar": {"$ref": "#/properties/foo/unknown-keyword"}
}
},
"tests": [
{
"description": "match",
"data": {"bar": 3},
"valid": true
},
{
"description": "mismatch",
"data": {"bar": true},
"valid": false
}
]
},
{
"description": "reference internals of known non-applicator",
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "/base",
"examples": [
{ "type": "string" }
],
"$ref": "#/examples/0"
},
"tests": [
{
"description": "match",
"data": "a string",
"valid": true
},
{
"description": "mismatch",
"data": 42,
"valid": false
}
]
}
]