anyOf.jst 943 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. {{# def.definitions }}
  2. {{# def.errors }}
  3. {{# def.setupKeyword }}
  4. {{# def.setupNextLevel }}
  5. {{
  6. var $noEmptySchema = $schema.every(function($sch) {
  7. return {{# def.nonEmptySchema:$sch }};
  8. });
  9. }}
  10. {{? $noEmptySchema }}
  11. {{ var $currentBaseId = $it.baseId; }}
  12. var {{=$errs}} = errors;
  13. var {{=$valid}} = false;
  14. {{# def.setCompositeRule }}
  15. {{~ $schema:$sch:$i }}
  16. {{
  17. $it.schema = $sch;
  18. $it.schemaPath = $schemaPath + '[' + $i + ']';
  19. $it.errSchemaPath = $errSchemaPath + '/' + $i;
  20. }}
  21. {{# def.insertSubschemaCode }}
  22. {{=$valid}} = {{=$valid}} || {{=$nextValid}};
  23. if (!{{=$valid}}) {
  24. {{ $closingBraces += '}'; }}
  25. {{~}}
  26. {{# def.resetCompositeRule }}
  27. {{= $closingBraces }}
  28. if (!{{=$valid}}) {
  29. {{# def.extraError:'anyOf' }}
  30. } else {
  31. {{# def.resetErrors }}
  32. {{? it.opts.allErrors }} } {{?}}
  33. {{# def.cleanUp }}
  34. {{??}}
  35. {{? $breakOnError }}
  36. if (true) {
  37. {{?}}
  38. {{?}}