ajv/lib/dot/dependencies.jst

70 lines
1.5 KiB
Plaintext
Raw Normal View History

{{# def.definitions }}
2015-12-12 16:41:51 +03:00
{{# def.errors }}
{{# def.missing }}
2015-12-22 20:03:09 +03:00
{{# def.setupKeyword }}
{{# def.setupNextLevel }}
2015-06-01 22:44:12 +03:00
{{
var $schemaDeps = {}
, $propertyDeps = {};
for ($property in $schema) {
var $sch = $schema[$property];
var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
$deps[$property] = $sch;
2015-06-01 22:44:12 +03:00
}
}}
var {{=$errs}} = errors;
2015-06-02 03:59:32 +03:00
{{ var $currentErrorPath = it.errorPath; }}
2015-06-02 03:59:32 +03:00
var missing{{=$lvl}};
{{ for (var $property in $propertyDeps) { }}
{{ $deps = $propertyDeps[$property]; }}
if ({{=$data}}{{= it.util.getProperty($property) }} !== undefined
{{? $breakOnError }}
&& ({{# def.checkMissingProperty:$deps }})) {
{{# def.errorMissingProperty:'dependencies' }}
{{??}}
) {
{{~ $deps:$reqProperty }}
{{# def.allErrorsMissingProperty:'dependencies' }}
{{~}}
{{?}}
} {{# def.elseIfValid }}
2015-06-01 22:44:12 +03:00
{{ } }}
{{
it.errorPath = $currentErrorPath;
var $currentBaseId = $it.baseId;
}}
2015-06-01 22:44:12 +03:00
{{ for (var $property in $schemaDeps) { }}
{{ var $sch = $schemaDeps[$property]; }}
{{? {{# def.nonEmptySchema:$sch }} }}
2015-06-06 04:07:50 +03:00
valid{{=$it.level}} = true;
if ({{=$data}}['{{= $property }}'] !== undefined) {
{{
$it.schema = $sch;
$it.schemaPath = $schemaPath + it.util.getProperty($property);
2015-12-19 13:52:39 +03:00
$it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);
}}
{{# def.insertSubschemaCode }}
}
2015-06-06 04:07:50 +03:00
{{# def.ifResultValid }}
{{?}}
2015-06-01 22:44:12 +03:00
{{ } }}
{{? $breakOnError }}
{{= $closingBraces }}
if ({{=$errs}} == errors) {
{{?}}
2015-06-02 03:59:32 +03:00
{{# def.cleanUp }}