anyOf.jst 921 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. {{??}}
  34. {{? $breakOnError }}
  35. if (true) {
  36. {{?}}
  37. {{?}}