2015-06-03 03:36:59 +03:00
|
|
|
{{# def.definitions }}
|
2015-12-12 16:41:51 +03:00
|
|
|
{{# def.errors }}
|
2015-11-21 15:43:44 +03:00
|
|
|
{{# def.missing }}
|
2015-12-22 20:03:09 +03:00
|
|
|
{{# def.setupKeyword }}
|
2015-06-03 03:36:59 +03:00
|
|
|
{{# def.setupNextLevel }}
|
|
|
|
|
|
|
|
|
2015-06-01 22:44:12 +03:00
|
|
|
{{
|
2015-06-03 03:36:59 +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
|
|
|
}
|
|
|
|
}}
|
|
|
|
|
2015-06-13 15:01:05 +03:00
|
|
|
var {{=$errs}} = errors;
|
2015-06-02 03:59:32 +03:00
|
|
|
|
2015-11-21 15:43:44 +03:00
|
|
|
{{ var $currentErrorPath = it.errorPath; }}
|
2015-06-02 03:59:32 +03:00
|
|
|
|
2015-11-21 15:43:44 +03:00
|
|
|
var missing{{=$lvl}};
|
2015-06-16 17:10:21 +03:00
|
|
|
{{ for (var $property in $propertyDeps) { }}
|
2015-12-31 02:04:14 +03:00
|
|
|
{{ $deps = $propertyDeps[$property]; }}
|
|
|
|
if ({{=$data}}{{= it.util.getProperty($property) }} !== undefined
|
|
|
|
&& ({{# def.checkMissingProperty:$deps }})) {
|
|
|
|
{{# def.errorMissingProperty }}
|
|
|
|
{{# def.error:'dependencies' }}
|
|
|
|
} {{# def.elseIfValid }}
|
2015-06-01 22:44:12 +03:00
|
|
|
{{ } }}
|
|
|
|
|
2015-11-21 15:43:44 +03:00
|
|
|
{{ it.errorPath = $currentErrorPath; }}
|
|
|
|
|
2015-06-01 22:44:12 +03:00
|
|
|
|
2015-06-16 17:10:21 +03:00
|
|
|
{{ for (var $property in $schemaDeps) { }}
|
2015-06-04 02:17:33 +03:00
|
|
|
{{ var $sch = $schemaDeps[$property]; }}
|
2015-06-13 00:10:56 +03:00
|
|
|
{{? {{# def.nonEmptySchema:$sch }} }}
|
2015-06-06 04:07:50 +03:00
|
|
|
valid{{=$it.level}} = true;
|
|
|
|
|
|
|
|
if ({{=$data}}['{{= $property }}'] !== undefined) {
|
2015-06-04 02:17:33 +03:00
|
|
|
{{
|
|
|
|
$it.schema = $sch;
|
2015-06-24 02:43:52 +03:00
|
|
|
$it.schemaPath = $schemaPath + it.util.getProperty($property);
|
2015-12-19 13:52:39 +03:00
|
|
|
$it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);
|
2015-06-04 02:17:33 +03:00
|
|
|
}}
|
|
|
|
|
|
|
|
{{= it.validate($it) }}
|
|
|
|
}
|
|
|
|
|
2015-06-06 04:07:50 +03:00
|
|
|
{{# def.ifResultValid }}
|
2015-06-04 02:17:33 +03:00
|
|
|
{{?}}
|
2015-06-01 22:44:12 +03:00
|
|
|
{{ } }}
|
|
|
|
|
2015-06-12 13:43:41 +03:00
|
|
|
{{? $breakOnError }}
|
|
|
|
{{= $closingBraces }}
|
2015-06-13 15:01:05 +03:00
|
|
|
if ({{=$errs}} == errors) {
|
2015-06-12 13:43:41 +03:00
|
|
|
{{?}}
|
2015-06-02 03:59:32 +03:00
|
|
|
|
2015-06-03 03:36:59 +03:00
|
|
|
{{# def.cleanUp }}
|