{{# def.definitions }} {{# def.errors }} {{# def.missing }} {{# def.setup:'dependencies' }} {{# def.setupNextLevel }} {{ var $schemaDeps = {} , $propertyDeps = {}; for ($property in $schema) { var $sch = $schema[$property]; var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps; $deps[$property] = $sch; } }} var {{=$errs}} = errors; {{ var $currentErrorPath = it.errorPath; }} var missing{{=$lvl}}; {{ for (var $property in $propertyDeps) { }} if ({{=$data}}{{= it.util.getProperty($property) }} !== undefined) { {{ $deps = $propertyDeps[$property]; }} if ({{# def.checkMissingProperty:$deps }}) { {{# def.errorMissingProperty }} {{# def.error:'dependencies' }} } {{# def.elseIfValid }} } {{ } }} {{ it.errorPath = $currentErrorPath; }} {{ for (var $property in $schemaDeps) { }} {{ var $sch = $schemaDeps[$property]; }} {{? {{# def.nonEmptySchema:$sch }} }} valid{{=$it.level}} = true; if ({{=$data}}['{{= $property }}'] !== undefined) { {{ $it.schema = $sch; $it.schemaPath = $schemaPath + it.util.getProperty($property); }} {{= it.validate($it) }} } {{# def.ifResultValid }} {{?}} {{ } }} {{? $breakOnError }} {{= $closingBraces }} if ({{=$errs}} == errors) { {{?}} {{# def.cleanUp }}