aboutsummaryrefslogtreecommitdiff
path: root/node_modules/ajv/lib/dotjs/validate.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/ajv/lib/dotjs/validate.js')
-rw-r--r--node_modules/ajv/lib/dotjs/validate.js29
1 files changed, 8 insertions, 21 deletions
diff --git a/node_modules/ajv/lib/dotjs/validate.js b/node_modules/ajv/lib/dotjs/validate.js
index 5ff9beee7..9f9e1ae40 100644
--- a/node_modules/ajv/lib/dotjs/validate.js
+++ b/node_modules/ajv/lib/dotjs/validate.js
@@ -5,25 +5,12 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
$refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref'),
$id = it.self._getId(it.schema);
if (it.isTop) {
- if ($async) {
- it.async = true;
- var $es7 = it.opts.async == 'es7';
- it.yieldAwait = $es7 ? 'await' : 'yield';
- }
out += ' var validate = ';
if ($async) {
- if ($es7) {
- out += ' (async function ';
- } else {
- if (it.opts.async != '*') {
- out += 'co.wrap';
- }
- out += '(function* ';
- }
- } else {
- out += ' (function ';
+ it.async = true;
+ out += 'async ';
}
- out += ' (data, dataPath, parentData, parentDataProperty, rootData) { \'use strict\'; ';
+ out += 'function(data, dataPath, parentData, parentDataProperty, rootData) { \'use strict\'; ';
if ($id && (it.opts.sourceCode || it.opts.processCode)) {
out += ' ' + ('/\*# sourceURL=' + $id + ' */') + ' ';
}
@@ -83,7 +70,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
}
}
if (it.isTop) {
- out += ' }); return validate; ';
+ out += ' }; return validate; ';
}
return out;
}
@@ -126,6 +113,9 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"');
}
}
+ if (it.schema.$comment && it.opts.$comment) {
+ out += ' ' + (it.RULES.all.$comment.code(it, '$comment'));
+ }
if ($typeSchema) {
if (it.opts.coerceTypes) {
var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema);
@@ -280,9 +270,6 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
$closingBraces2 += '}';
}
} else {
- if (it.opts.v5 && it.schema.patternGroups) {
- it.logger.warn('keyword "patternGroups" is deprecated and disabled. Use option patternGroups: true to enable.');
- }
var arr2 = it.RULES;
if (arr2) {
var $rulesGroup, i2 = -1,
@@ -430,7 +417,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) {
out += ' validate.errors = vErrors; ';
out += ' return errors === 0; ';
}
- out += ' }); return validate;';
+ out += ' }; return validate;';
} else {
out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';';
}