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);
25 {{## def.isRequiredOwnProperty:
26 Object.prototype.hasOwnProperty.call({{=$data}}, {{=$vSchema}}[{{=$i}}])
31 {{? $schema.length < it.opts.loopRequired &&
32 it.schema.properties && Object.keys(it.schema.properties).length }}
33 {{ var $required = []; }}
34 {{~ $schema:$property }}
35 {{ var $propertySch = it.schema.properties[$property]; }}
36 {{? !($propertySch && {{# def.nonEmptySchema:$propertySch}}) }}
37 {{ $required[$required.length] = $property; }}
41 {{ var $required = $schema; }}
46 {{? $isData || $required.length }}
48 var $currentErrorPath = it.errorPath
49 , $loopRequired = $isData || $required.length >= it.opts.loopRequired
50 , $ownProperties = it.opts.ownProperties;
57 var {{=$valid}} = true;
59 {{?$isData}}{{# def.check$dataIsArray }}{{?}}
61 for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) {
62 {{=$valid}} = {{=$data}}[{{=$vSchema}}[{{=$i}}]] !== undefined
64 && {{# def.isRequiredOwnProperty }}
66 if (!{{=$valid}}) break;
69 {{? $isData }} } {{?}}
71 {{# def.checkError:'required' }}
74 if ({{# def.checkMissingProperty:$required }}) {
75 {{# def.errorMissingProperty:'required' }}
82 if ({{=$vSchema}} && !Array.isArray({{=$vSchema}})) {
83 {{# def.addError:'required' }}
84 } else if ({{=$vSchema}} !== undefined) {
87 for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) {
88 if ({{=$data}}[{{=$vSchema}}[{{=$i}}]] === undefined
90 || !{{# def.isRequiredOwnProperty }}
92 {{# def.addError:'required' }}
96 {{? $isData }} } {{?}}
98 {{~ $required:$propertyKey }}
99 {{# def.allErrorsMissingProperty:'required' }}
104 {{ it.errorPath = $currentErrorPath; }}
106 {{?? $breakOnError }}