fix: schema "dependencies" with property containing single quotes, closes #413
parent
af458d3460
commit
8413890875
|
@ -47,7 +47,7 @@ var missing{{=$lvl}};
|
|||
{{? {{# def.nonEmptySchema:$sch }} }}
|
||||
{{=$nextValid}} = true;
|
||||
|
||||
if ({{=$data}}['{{= $property }}'] !== undefined) {
|
||||
if ({{=$data}}{{= it.util.getProperty($property) }} !== undefined) {
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + it.util.getProperty($property);
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
[
|
||||
{
|
||||
"description": "JSON with control characters - 'dependencies'",
|
||||
"schema": {
|
||||
"dependencies": {
|
||||
"foo'bar": {
|
||||
"not": { "required": ["bar"] }
|
||||
}
|
||||
}
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "valid object",
|
||||
"data": {
|
||||
"foo'bar": 1
|
||||
},
|
||||
"valid": true
|
||||
},
|
||||
{
|
||||
"description": "invalid object",
|
||||
"data": {
|
||||
"foo'bar": 1,
|
||||
"bar": 2
|
||||
},
|
||||
"valid": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue