anyOf.jst 921 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. {{?}}