Initial commit
[yaffs-website] / node_modules / ajv / lib / dot / dependencies.jst
1 {{# def.definitions }}
2 {{# def.errors }}
3 {{# def.missing }}
4 {{# def.setupKeyword }}
5 {{# def.setupNextLevel }}
6
7
8 {{
9   var $schemaDeps = {}
10     , $propertyDeps = {};
11
12   for ($property in $schema) {
13     var $sch = $schema[$property];
14     var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
15     $deps[$property] = $sch;
16   }
17 }}
18
19 var {{=$errs}} = errors;
20
21 {{ var $currentErrorPath = it.errorPath; }}
22
23 var missing{{=$lvl}};
24 {{ for (var $property in $propertyDeps) { }}
25   {{ $deps = $propertyDeps[$property]; }}
26   if ({{=$data}}{{= it.util.getProperty($property) }} !== undefined
27     {{? $breakOnError }}
28         && ({{# def.checkMissingProperty:$deps }})) {
29         {{# def.errorMissingProperty:'dependencies' }}
30     {{??}}
31       ) {
32         {{~ $deps:$reqProperty }}
33           {{# def.allErrorsMissingProperty:'dependencies' }}
34         {{~}}
35     {{?}}
36   } {{# def.elseIfValid }}
37 {{ } }}
38
39 {{
40   it.errorPath = $currentErrorPath;
41   var $currentBaseId = $it.baseId;
42 }}
43
44
45 {{ for (var $property in $schemaDeps) { }}
46   {{ var $sch = $schemaDeps[$property]; }}
47   {{? {{# def.nonEmptySchema:$sch }} }}
48     {{=$nextValid}} = true;
49
50     if ({{=$data}}{{= it.util.getProperty($property) }} !== undefined) {
51       {{ 
52         $it.schema = $sch;
53         $it.schemaPath = $schemaPath + it.util.getProperty($property);
54         $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);
55       }}
56
57       {{# def.insertSubschemaCode }}
58     }
59
60     {{# def.ifResultValid }}
61   {{?}}
62 {{ } }}
63
64 {{? $breakOnError }} 
65   {{= $closingBraces }}
66   if ({{=$errs}} == errors) {
67 {{?}}
68
69 {{# def.cleanUp }}