Projekt

Obecné

Profil

Stáhnout (1.8 KB) Statistiky
| Větev: | Revize:
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
    var $sch = $schema[$property];
23
    var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
24
    $deps[$property] = $sch;
25
  }
26
}}
27

    
28
var {{=$errs}} = errors;
29

    
30
{{ var $currentErrorPath = it.errorPath; }}
31

    
32
var missing{{=$lvl}};
33
{{ for (var $property in $propertyDeps) { }}
34
  {{ $deps = $propertyDeps[$property]; }}
35
  {{? $deps.length }}
36
    if ({{# def.propertyInData }}
37
      {{? $breakOnError }}
38
          && ({{# def.checkMissingProperty:$deps }})) {
39
          {{# def.errorMissingProperty:'dependencies' }}
40
      {{??}}
41
        ) {
42
          {{~ $deps:$propertyKey }}
43
            {{# def.allErrorsMissingProperty:'dependencies' }}
44
          {{~}}
45
      {{?}}
46
    } {{# def.elseIfValid }}
47
  {{?}}
48
{{ } }}
49

    
50
{{
51
  it.errorPath = $currentErrorPath;
52
  var $currentBaseId = $it.baseId;
53
}}
54

    
55

    
56
{{ for (var $property in $schemaDeps) { }}
57
  {{ var $sch = $schemaDeps[$property]; }}
58
  {{? {{# def.nonEmptySchema:$sch }} }}
59
    {{=$nextValid}} = true;
60

    
61
    if ({{# def.propertyInData }}) {
62
      {{ 
63
        $it.schema = $sch;
64
        $it.schemaPath = $schemaPath + it.util.getProperty($property);
65
        $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);
66
      }}
67

    
68
      {{# def.insertSubschemaCode }}
69
    }
70

    
71
    {{# def.ifResultValid }}
72
  {{?}}
73
{{ } }}
74

    
75
{{? $breakOnError }} 
76
  {{= $closingBraces }}
77
  if ({{=$errs}} == errors) {
78
{{?}}
79

    
80
{{# def.cleanUp }}
(14-14/30)