source: imaps-frontend/node_modules/ajv/lib/dot/dependencies.jst@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.8 KB
Line 
1{{# def.definitions }}
2{{# def.errors }}
3{{# def.missing }}
4{{# def.setupKeyword }}
5{{# def.setupNextLevel }}
6
7
8{{## def.propertyInData:
9 {{=$data}}{{= it.util.getProperty($property) }} !== undefined
10 {{? $ownProperties }}
11 && Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($property)}}')
12 {{?}}
13#}}
14
15
16{{
17 var $schemaDeps = {}
18 , $propertyDeps = {}
19 , $ownProperties = it.opts.ownProperties;
20
21 for ($property in $schema) {
22 if ($property == '__proto__') continue;
23 var $sch = $schema[$property];
24 var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
25 $deps[$property] = $sch;
26 }
27}}
28
29var {{=$errs}} = errors;
30
31{{ var $currentErrorPath = it.errorPath; }}
32
33var missing{{=$lvl}};
34{{ for (var $property in $propertyDeps) { }}
35 {{ $deps = $propertyDeps[$property]; }}
36 {{? $deps.length }}
37 if ({{# def.propertyInData }}
38 {{? $breakOnError }}
39 && ({{# def.checkMissingProperty:$deps }})) {
40 {{# def.errorMissingProperty:'dependencies' }}
41 {{??}}
42 ) {
43 {{~ $deps:$propertyKey }}
44 {{# def.allErrorsMissingProperty:'dependencies' }}
45 {{~}}
46 {{?}}
47 } {{# def.elseIfValid }}
48 {{?}}
49{{ } }}
50
51{{
52 it.errorPath = $currentErrorPath;
53 var $currentBaseId = $it.baseId;
54}}
55
56
57{{ for (var $property in $schemaDeps) { }}
58 {{ var $sch = $schemaDeps[$property]; }}
59 {{? {{# def.nonEmptySchema:$sch }} }}
60 {{=$nextValid}} = true;
61
62 if ({{# def.propertyInData }}) {
63 {{
64 $it.schema = $sch;
65 $it.schemaPath = $schemaPath + it.util.getProperty($property);
66 $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);
67 }}
68
69 {{# def.insertSubschemaCode }}
70 }
71
72 {{# def.ifResultValid }}
73 {{?}}
74{{ } }}
75
76{{? $breakOnError }}
77 {{= $closingBraces }}
78 if ({{=$errs}} == errors) {
79{{?}}
Note: See TracBrowser for help on using the repository browser.