source: imaps-frontend/node_modules/ajv/lib/dot/if.jst

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

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.6 KB
Line 
1{{# def.definitions }}
2{{# def.errors }}
3{{# def.setupKeyword }}
4{{# def.setupNextLevel }}
5
6
7{{## def.validateIfClause:_clause:
8 {{
9 $it.schema = it.schema['_clause'];
10 $it.schemaPath = it.schemaPath + '._clause';
11 $it.errSchemaPath = it.errSchemaPath + '/_clause';
12 }}
13 {{# def.insertSubschemaCode }}
14 {{=$valid}} = {{=$nextValid}};
15 {{? $thenPresent && $elsePresent }}
16 {{ $ifClause = 'ifClause' + $lvl; }}
17 var {{=$ifClause}} = '_clause';
18 {{??}}
19 {{ $ifClause = '\'_clause\''; }}
20 {{?}}
21#}}
22
23{{
24 var $thenSch = it.schema['then']
25 , $elseSch = it.schema['else']
26 , $thenPresent = $thenSch !== undefined && {{# def.nonEmptySchema:$thenSch }}
27 , $elsePresent = $elseSch !== undefined && {{# def.nonEmptySchema:$elseSch }}
28 , $currentBaseId = $it.baseId;
29}}
30
31{{? $thenPresent || $elsePresent }}
32 {{
33 var $ifClause;
34 $it.createErrors = false;
35 $it.schema = $schema;
36 $it.schemaPath = $schemaPath;
37 $it.errSchemaPath = $errSchemaPath;
38 }}
39 var {{=$errs}} = errors;
40 var {{=$valid}} = true;
41
42 {{# def.setCompositeRule }}
43 {{# def.insertSubschemaCode }}
44 {{ $it.createErrors = true; }}
45 {{# def.resetErrors }}
46 {{# def.resetCompositeRule }}
47
48 {{? $thenPresent }}
49 if ({{=$nextValid}}) {
50 {{# def.validateIfClause:then }}
51 }
52 {{? $elsePresent }}
53 else {
54 {{?}}
55 {{??}}
56 if (!{{=$nextValid}}) {
57 {{?}}
58
59 {{? $elsePresent }}
60 {{# def.validateIfClause:else }}
61 }
62 {{?}}
63
64 if (!{{=$valid}}) {
65 {{# def.extraError:'if' }}
66 }
67 {{? $breakOnError }} else { {{?}}
68{{??}}
69 {{? $breakOnError }}
70 if (true) {
71 {{?}}
72{{?}}
73
Note: See TracBrowser for help on using the repository browser.