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 }}
|
|
|
|
|
|
|
|
|
2017-02-12 03:36:14 +03:00
|
|
|
{{## def.propertyInData:
|
|
|
|
{{=$data}}{{= it.util.getProperty($property) }} !== undefined
|
|
|
|
{{? $ownProperties }}
|
|
|
|
&& Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($property)}}')
|
|
|
|
{{?}}
|
|
|
|
#}}
|
|
|
|
|
|
|
|
|
2015-06-01 22:44:12 +03:00
|
|
|
{{
|
2015-06-03 03:36:59 +03:00
|
|
|
var $schemaDeps = {}
|
2017-02-12 02:44:59 +03:00
|
|
|
, $propertyDeps = {}
|
|
|
|
, $ownProperties = it.opts.ownProperties;
|
2015-06-03 03:36:59 +03:00
|
|
|
|
|
|
|
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]; }}
|
2016-12-24 19:21:34 +03:00
|
|
|
{{? $deps.length }}
|
2017-02-12 03:36:14 +03:00
|
|
|
if ({{# def.propertyInData }}
|
2016-12-24 19:21:34 +03:00
|
|
|
{{? $breakOnError }}
|
|
|
|
&& ({{# def.checkMissingProperty:$deps }})) {
|
|
|
|
{{# def.errorMissingProperty:'dependencies' }}
|
|
|
|
{{??}}
|
|
|
|
) {
|
2017-02-12 02:44:59 +03:00
|
|
|
{{~ $deps:$propertyKey }}
|
2016-12-24 19:21:34 +03:00
|
|
|
{{# def.allErrorsMissingProperty:'dependencies' }}
|
|
|
|
{{~}}
|
|
|
|
{{?}}
|
|
|
|
} {{# def.elseIfValid }}
|
|
|
|
{{?}}
|
2015-06-01 22:44:12 +03:00
|
|
|
{{ } }}
|
|
|
|
|
2016-04-23 19:00:32 +03:00
|
|
|
{{
|
|
|
|
it.errorPath = $currentErrorPath;
|
|
|
|
var $currentBaseId = $it.baseId;
|
|
|
|
}}
|
2015-11-21 15:43:44 +03:00
|
|
|
|
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 }} }}
|
2016-12-24 01:02:41 +03:00
|
|
|
{{=$nextValid}} = true;
|
2015-06-06 04:07:50 +03:00
|
|
|
|
2017-02-12 03:36:14 +03:00
|
|
|
if ({{# def.propertyInData }}) {
|
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
|
|
|
}}
|
|
|
|
|
2016-04-23 19:00:32 +03:00
|
|
|
{{# def.insertSubschemaCode }}
|
2015-06-04 02:17:33 +03:00
|
|
|
}
|
|
|
|
|
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 }}
|