aboutsummaryrefslogtreecommitdiff
path: root/node_modules/ajv/lib/dotjs/anyOf.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/ajv/lib/dotjs/anyOf.js')
-rw-r--r--node_modules/ajv/lib/dotjs/anyOf.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/node_modules/ajv/lib/dotjs/anyOf.js b/node_modules/ajv/lib/dotjs/anyOf.js
index c95f8ff9a..994b09123 100644
--- a/node_modules/ajv/lib/dotjs/anyOf.js
+++ b/node_modules/ajv/lib/dotjs/anyOf.js
@@ -1,5 +1,5 @@
'use strict';
-module.exports = function generate_anyOf(it, $keyword) {
+module.exports = function generate_anyOf(it, $keyword, $ruleType) {
var out = ' ';
var $lvl = it.level;
var $dataLvl = it.dataLevel;
@@ -38,7 +38,7 @@ module.exports = function generate_anyOf(it, $keyword) {
}
}
it.compositeRule = $it.compositeRule = $wasComposite;
- out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */
+ out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */
if (it.createErrors !== false) {
out += ' { keyword: \'' + ('anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
if (it.opts.messages !== false) {
@@ -51,7 +51,15 @@ module.exports = function generate_anyOf(it, $keyword) {
} else {
out += ' {} ';
}
- out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
+ out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
+ if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
+ if (it.async) {
+ out += ' throw new ValidationError(vErrors); ';
+ } else {
+ out += ' validate.errors = vErrors; return false; ';
+ }
+ }
+ out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
if (it.opts.allErrors) {
out += ' } ';
}