3 {{# def.setupKeyword }}
4 {{# def.setupNextLevel }}
8 {{# def.setCompositeRule }}
9 {{ $it.createErrors = false; }}
10 {{# def._validateSwitchRule:if }}
11 {{ $it.createErrors = true; }}
12 {{# def.resetCompositeRule }}
13 {{=$ifPassed}} = {{=$nextValid}};
16 {{## def.validateThen:
17 {{? typeof $sch.then == 'boolean' }}
18 {{? $sch.then === false }}
19 {{# def.error:'switch' }}
21 var {{=$nextValid}} = {{= $sch.then }};
23 {{# def._validateSwitchRule:then }}
27 {{## def._validateSwitchRule:_clause:
29 $it.schema = $sch._clause;
30 $it.schemaPath = $schemaPath + '[' + $caseIndex + ']._clause';
31 $it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/_clause';
33 {{# def.insertSubschemaCode }}
37 {{? $sch.if && {{# def.nonEmptySchema:$sch.if }} }}
38 var {{=$errs}} = errors;
41 {{# def.validateThen }}
43 {{# def.resetErrors }}
46 {{=$ifPassed}} = true;
47 {{# def.validateThen }}
53 var $ifPassed = 'ifPassed' + it.level
54 , $currentBaseId = $it.baseId
59 {{~ $schema:$sch:$caseIndex }}
60 {{? $caseIndex && !$shouldContinue }}
61 if (!{{=$ifPassed}}) {
62 {{ $closingBraces+= '}'; }}
66 {{ $shouldContinue = $sch.continue }}
71 var {{=$valid}} = {{=$nextValid}};