ajv/lib/dot/anyOf.jst

47 lines
845 B
Plaintext
Raw Normal View History

{{# def.definitions }}
2015-12-12 16:41:51 +03:00
{{# def.errors }}
{{# def.setup:'anyOf' }}
{{# def.setupNextLevel }}
{{
var $noEmptySchema = $schema.every(function($sch) {
return {{# def.nonEmptySchema:$sch }};
});
}}
{{? $noEmptySchema }}
var {{=$errs}} = errors;
var {{=$valid}} = false;
2015-06-02 03:59:32 +03:00
{{# def.setCompositeRule }}
{{~ $schema:$sch:$i }}
{{
$it.schema = $sch;
$it.schemaPath = $schemaPath + '[' + $i + ']';
}}
{{= it.validate($it) }}
{{=$valid}} = {{=$valid}} || valid{{=$it.level}};
if (!{{=$valid}}) {
{{ $closingBraces += '}'; }}
{{~}}
{{# def.resetCompositeRule }}
{{= $closingBraces }}
2015-05-31 23:46:25 +03:00
2015-06-19 01:01:39 +03:00
if (!{{=$valid}}) {
{{# def.addError:'anyOf' }}
} else {
2015-12-12 16:41:51 +03:00
{{# def.resetErrors }}
{{? it.opts.allErrors }} } {{?}}
2015-05-31 23:46:25 +03:00
{{# def.cleanUp }}
{{??}}
{{? $breakOnError }}
if (true) {
{{?}}
{{?}}