Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dependencies.jst 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. {{# def.definitions }}
  2. {{# def.errors }}
  3. {{# def.missing }}
  4. {{# def.setupKeyword }}
  5. {{# def.setupNextLevel }}
  6. {{## def.propertyInData:
  7. {{=$data}}{{= it.util.getProperty($property) }} !== undefined
  8. {{? $ownProperties }}
  9. && Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($property)}}')
  10. {{?}}
  11. #}}
  12. {{
  13. var $schemaDeps = {}
  14. , $propertyDeps = {}
  15. , $ownProperties = it.opts.ownProperties;
  16. for ($property in $schema) {
  17. var $sch = $schema[$property];
  18. var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
  19. $deps[$property] = $sch;
  20. }
  21. }}
  22. var {{=$errs}} = errors;
  23. {{ var $currentErrorPath = it.errorPath; }}
  24. var missing{{=$lvl}};
  25. {{ for (var $property in $propertyDeps) { }}
  26. {{ $deps = $propertyDeps[$property]; }}
  27. {{? $deps.length }}
  28. if ({{# def.propertyInData }}
  29. {{? $breakOnError }}
  30. && ({{# def.checkMissingProperty:$deps }})) {
  31. {{# def.errorMissingProperty:'dependencies' }}
  32. {{??}}
  33. ) {
  34. {{~ $deps:$propertyKey }}
  35. {{# def.allErrorsMissingProperty:'dependencies' }}
  36. {{~}}
  37. {{?}}
  38. } {{# def.elseIfValid }}
  39. {{?}}
  40. {{ } }}
  41. {{
  42. it.errorPath = $currentErrorPath;
  43. var $currentBaseId = $it.baseId;
  44. }}
  45. {{ for (var $property in $schemaDeps) { }}
  46. {{ var $sch = $schemaDeps[$property]; }}
  47. {{? {{# def.nonEmptySchema:$sch }} }}
  48. {{=$nextValid}} = true;
  49. if ({{# def.propertyInData }}) {
  50. {{
  51. $it.schema = $sch;
  52. $it.schemaPath = $schemaPath + it.util.getProperty($property);
  53. $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);
  54. }}
  55. {{# def.insertSubschemaCode }}
  56. }
  57. {{# def.ifResultValid }}
  58. {{?}}
  59. {{ } }}
  60. {{? $breakOnError }}
  61. {{= $closingBraces }}
  62. if ({{=$errs}} == errors) {
  63. {{?}}
  64. {{# def.cleanUp }}