您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

missing.def 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. {{## def.errorMissingProperty:_error:
  12. {{
  13. var $propertyPath = 'missing' + $lvl
  14. , $missingProperty = '\' + ' + $propertyPath + ' + \'';
  15. if (it.opts._errorDataPathProperty) {
  16. it.errorPath = it.opts.jsonPointers
  17. ? it.util.getPathExpr($currentErrorPath, $propertyPath, true)
  18. : $currentErrorPath + ' + ' + $propertyPath;
  19. }
  20. }}
  21. {{# def.error:_error }}
  22. #}}
  23. {{## def.allErrorsMissingProperty:_error:
  24. {{
  25. var $prop = it.util.getProperty($propertyKey)
  26. , $missingProperty = it.util.escapeQuotes($propertyKey)
  27. , $useData = $data + $prop;
  28. if (it.opts._errorDataPathProperty) {
  29. it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
  30. }
  31. }}
  32. if ({{# def.noPropertyInData }}) {
  33. {{# def.addError:_error }}
  34. }
  35. #}}