propertyNames.jst 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. {{# def.definitions }}
  2. {{# def.errors }}
  3. {{# def.setupKeyword }}
  4. {{# def.setupNextLevel }}
  5. {{? {{# def.nonEmptySchema:$schema }} }}
  6. {{
  7. $it.schema = $schema;
  8. $it.schemaPath = $schemaPath;
  9. $it.errSchemaPath = $errSchemaPath;
  10. }}
  11. {{
  12. var $key = 'key' + $lvl
  13. , $idx = 'idx' + $lvl
  14. , $i = 'i' + $lvl
  15. , $invalidName = '\' + ' + $key + ' + \''
  16. , $dataNxt = $it.dataLevel = it.dataLevel + 1
  17. , $nextData = 'data' + $dataNxt
  18. , $dataProperties = 'dataProperties' + $lvl
  19. , $ownProperties = it.opts.ownProperties
  20. , $currentBaseId = it.baseId;
  21. }}
  22. var {{=$errs}} = errors;
  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. {{?}}
  46. {{# def.cleanUp }}