patternRequired.jst 781 B

123456789101112131415161718192021222324252627282930313233
  1. {{# def.definitions }}
  2. {{# def.errors }}
  3. {{# def.setupKeyword }}
  4. {{
  5. var $key = 'key' + $lvl
  6. , $idx = 'idx' + $lvl
  7. , $matched = 'patternMatched' + $lvl
  8. , $dataProperties = 'dataProperties' + $lvl
  9. , $closingBraces = ''
  10. , $ownProperties = it.opts.ownProperties;
  11. }}
  12. var {{=$valid}} = true;
  13. {{? $ownProperties }}
  14. var {{=$dataProperties}} = undefined;
  15. {{?}}
  16. {{~ $schema:$pProperty }}
  17. var {{=$matched}} = false;
  18. {{# def.iterateProperties }}
  19. {{=$matched}} = {{= it.usePattern($pProperty) }}.test({{=$key}});
  20. if ({{=$matched}}) break;
  21. }
  22. {{ var $missingPattern = it.util.escapeQuotes($pProperty); }}
  23. if (!{{=$matched}}) {
  24. {{=$valid}} = false;
  25. {{# def.addError:'patternRequired' }}
  26. } {{# def.elseIfValid }}
  27. {{~}}
  28. {{= $closingBraces }}