missing.def 1.1 KB

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