jspg progress
This commit is contained in:
90
tests/fixtures/dependentSchemas.json
vendored
90
tests/fixtures/dependentSchemas.json
vendored
@ -1,6 +1,6 @@
|
||||
[
|
||||
{
|
||||
"description": "single dependency",
|
||||
"description": "single dependency (STRICT)",
|
||||
"schema": {
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"properties": {
|
||||
@ -61,14 +61,19 @@
|
||||
"valid": false
|
||||
},
|
||||
{
|
||||
"description": "ignores arrays",
|
||||
"description": "ignores arrays (invalid in strict mode)",
|
||||
"data": [
|
||||
"bar"
|
||||
],
|
||||
"valid": true
|
||||
"valid": false,
|
||||
"expect_errors": [
|
||||
{
|
||||
"code": "STRICT_ITEM_VIOLATION"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "ignores strings",
|
||||
"description": "ignores strings (invalid in strict mode - wait, strings are scalars, strict only checks obj/arr)",
|
||||
"data": "foobar",
|
||||
"valid": true
|
||||
},
|
||||
@ -79,6 +84,38 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "single dependency (EXTENSIBLE)",
|
||||
"schema": {
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"properties": {
|
||||
"foo": true,
|
||||
"bar": true
|
||||
},
|
||||
"dependentSchemas": {
|
||||
"bar": {
|
||||
"properties": {
|
||||
"foo": {
|
||||
"type": "integer"
|
||||
},
|
||||
"bar": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"extensible": true
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "ignores arrays (valid in extensible mode)",
|
||||
"data": [
|
||||
"bar"
|
||||
],
|
||||
"valid": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "boolean subschemas",
|
||||
"schema": {
|
||||
@ -135,7 +172,8 @@
|
||||
},
|
||||
"dependentSchemas": {
|
||||
"foo\tbar": {
|
||||
"minProperties": 4
|
||||
"minProperties": 4,
|
||||
"extensible": true
|
||||
},
|
||||
"foo'bar": {
|
||||
"required": [
|
||||
@ -182,7 +220,7 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "dependent subschema incompatible with root",
|
||||
"description": "dependent subschema incompatible with root (STRICT)",
|
||||
"schema": {
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"properties": {
|
||||
@ -193,8 +231,7 @@
|
||||
"foo": {
|
||||
"properties": {
|
||||
"bar": {}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -207,11 +244,16 @@
|
||||
"valid": false
|
||||
},
|
||||
{
|
||||
"description": "matches dependency",
|
||||
"description": "matches dependency (invalid in strict mode - bar not allowed if foo missing)",
|
||||
"data": {
|
||||
"bar": 1
|
||||
},
|
||||
"valid": true
|
||||
"valid": false,
|
||||
"expect_errors": [
|
||||
{
|
||||
"code": "STRICT_PROPERTY_VIOLATION"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "matches both",
|
||||
@ -229,5 +271,33 @@
|
||||
"valid": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "dependent subschema incompatible with root (EXTENSIBLE)",
|
||||
"schema": {
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"properties": {
|
||||
"foo": {},
|
||||
"baz": true
|
||||
},
|
||||
"dependentSchemas": {
|
||||
"foo": {
|
||||
"properties": {
|
||||
"bar": {}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"extensible": true
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "matches dependency (valid in extensible mode)",
|
||||
"data": {
|
||||
"bar": 1
|
||||
},
|
||||
"valid": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user