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.

52 lines
1.3 KiB

4 years ago
  1. {{# def.definitions }}
  2. {{# def.errors }}
  3. {{# def.setupKeyword }}
  4. {{# def.setupNextLevel }}
  5. var {{=$errs}} = errors;
  6. {{? {{# def.nonEmptySchema:$schema }} }}
  7. {{
  8. $it.schema = $schema;
  9. $it.schemaPath = $schemaPath;
  10. $it.errSchemaPath = $errSchemaPath;
  11. }}
  12. {{
  13. var $key = 'key' + $lvl
  14. , $idx = 'idx' + $lvl
  15. , $i = 'i' + $lvl
  16. , $invalidName = '\' + ' + $key + ' + \''
  17. , $dataNxt = $it.dataLevel = it.dataLevel + 1
  18. , $nextData = 'data' + $dataNxt
  19. , $dataProperties = 'dataProperties' + $lvl
  20. , $ownProperties = it.opts.ownProperties
  21. , $currentBaseId = it.baseId;
  22. }}
  23. {{? $ownProperties }}
  24. var {{=$dataProperties}} = undefined;
  25. {{?}}
  26. {{# def.iterateProperties }}
  27. var startErrs{{=$lvl}} = errors;
  28. {{ var $passData = $key; }}
  29. {{# def.setCompositeRule }}
  30. {{# def.generateSubschemaCode }}
  31. {{# def.optimizeValidate }}
  32. {{# def.resetCompositeRule }}
  33. if (!{{=$nextValid}}) {
  34. for (var {{=$i}}=startErrs{{=$lvl}}; {{=$i}}<errors; {{=$i}}++) {
  35. vErrors[{{=$i}}].propertyName = {{=$key}};
  36. }
  37. {{# def.extraError:'propertyNames' }}
  38. {{? $breakOnError }} break; {{?}}
  39. }
  40. }
  41. {{?}}
  42. {{? $breakOnError }}
  43. {{= $closingBraces }}
  44. if ({{=$errs}} == errors) {
  45. {{?}}