| 1 | {{## def.checkMissingProperty:_properties: |
| 2 | {{~ _properties:$propertyKey:$i }} |
| 3 | {{?$i}} || {{?}} |
| 4 | {{ |
| 5 | var $prop = it.util.getProperty($propertyKey) |
| 6 | , $useData = $data + $prop; |
| 7 | }} |
| 8 | ( ({{# def.noPropertyInData }}) && (missing{{=$lvl}} = {{= it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop) }}) ) |
| 9 | {{~}} |
| 10 | #}} |
| 11 | |
| 12 | |
| 13 | {{## def.errorMissingProperty:_error: |
| 14 | {{ |
| 15 | var $propertyPath = 'missing' + $lvl |
| 16 | , $missingProperty = '\' + ' + $propertyPath + ' + \''; |
| 17 | if (it.opts._errorDataPathProperty) { |
| 18 | it.errorPath = it.opts.jsonPointers |
| 19 | ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) |
| 20 | : $currentErrorPath + ' + ' + $propertyPath; |
| 21 | } |
| 22 | }} |
| 23 | {{# def.error:_error }} |
| 24 | #}} |
| 25 | |
| 26 | |
| 27 | {{## def.allErrorsMissingProperty:_error: |
| 28 | {{ |
| 29 | var $prop = it.util.getProperty($propertyKey) |
| 30 | , $missingProperty = it.util.escapeQuotes($propertyKey) |
| 31 | , $useData = $data + $prop; |
| 32 | if (it.opts._errorDataPathProperty) { |
| 33 | it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); |
| 34 | } |
| 35 | }} |
| 36 | if ({{# def.noPropertyInData }}) { |
| 37 | {{# def.addError:_error }} |
| 38 | } |
| 39 | #}} |