4 {{# def.setupKeyword }}
7 {{ var $vSchema = 'schema' + $lvl; }}
11 var {{=$vSchema}} = validate.schema{{=$schemaPath}};
16 , $propertyPath = 'schema' + $lvl + '[' + $i + ']'
17 , $missingProperty = '\' + ' + $propertyPath + ' + \'';
18 if (it.opts._errorDataPathProperty) {
19 it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
26 {{? $schema.length < it.opts.loopRequired &&
27 it.schema.properties && Object.keys(it.schema.properties).length }}
28 {{ var $required = []; }}
29 {{~ $schema:$property }}
30 {{ var $propertySch = it.schema.properties[$property]; }}
31 {{? !($propertySch && {{# def.nonEmptySchema:$propertySch}}) }}
32 {{ $required[$required.length] = $property; }}
36 {{ var $required = $schema; }}
41 {{? $isData || $required.length }}
43 var $currentErrorPath = it.errorPath
44 , $loopRequired = $isData || $required.length >= it.opts.loopRequired;
51 var {{=$valid}} = true;
53 {{?$isData}}{{# def.check$dataIsArray }}{{?}}
55 for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) {
56 {{=$valid}} = {{=$data}}[{{=$vSchema}}[{{=$i}}]] !== undefined;
57 if (!{{=$valid}}) break;
60 {{? $isData }} } {{?}}
62 {{# def.checkError:'required' }}
65 if ({{# def.checkMissingProperty:$required }}) {
66 {{# def.errorMissingProperty:'required' }}
73 if ({{=$vSchema}} && !Array.isArray({{=$vSchema}})) {
74 {{# def.addError:'required' }}
75 } else if ({{=$vSchema}} !== undefined) {
78 for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) {
79 if ({{=$data}}[{{=$vSchema}}[{{=$i}}]] === undefined) {
80 {{# def.addError:'required' }}
84 {{? $isData }} } {{?}}
86 {{~ $required:$reqProperty }}
87 {{# def.allErrorsMissingProperty:'required' }}
92 {{ it.errorPath = $currentErrorPath; }}