Socket
Socket
Sign inDemoInstall

ajv

Package Overview
Dependencies
Maintainers
1
Versions
355
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ajv - npm Package Compare versions

Comparing version 0.5.3 to 0.5.4

43

lib/dotjs/$ref.js

@@ -26,4 +26,3 @@ 'use strict';

} else {
var $v = 'v' + $lvl;
out += ' var ' + ($v) + ' = root.refVal[0]; if (! ' + ($v) + '(' + ($data) + ', (dataPath || \'\') + ' + (it.errorPath) + ') ) { if (validate.errors === null) validate.errors = ' + ($v) + '.errors; else validate.errors = validate.errors.concat(' + ($v) + '.errors); errors = validate.errors.length; } ';
out += ' if (! ' + ('root.refVal[0]') + '(' + ($data) + ', (dataPath || \'\') + ' + (it.errorPath) + ') ) { if (validate.errors === null) validate.errors = ' + ('root.refVal[0]') + '.errors; else validate.errors = validate.errors.concat(' + ('root.refVal[0]') + '.errors); errors = validate.errors.length; } ';
if ($breakOnError) {

@@ -36,21 +35,31 @@ out += ' else { ';

if ($refVal === undefined) {
if (it.wasTop && $breakOnError) {
out += ' validate.errors = [ { keyword: \'' + ('$ref') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'can\\\'t resolve reference ' + ($schema) + '\' ';
if (it.opts.verbose) {
out += ', schema: \'' + ($schema) + '\', data: ' + ($data);
var $message = 'can\'t resolve reference ' + $schema;
if (it.opts.missingRefs == 'fail') {
console.log($message);
if (it.wasTop && $breakOnError) {
out += ' validate.errors = [ { keyword: \'' + ('$ref') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'can\\\'t resolve reference ' + ($schema) + '\' ';
if (it.opts.verbose) {
out += ', schema: \'' + ($schema) + '\', data: ' + ($data);
}
out += ' }]; return false; ';
} else {
out += ' var err = { keyword: \'' + ('$ref') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'can\\\'t resolve reference ' + ($schema) + '\' ';
if (it.opts.verbose) {
out += ', schema: \'' + ($schema) + '\', data: ' + ($data);
}
out += ' }; if (validate.errors === null) validate.errors = [err]; else validate.errors.push(err); errors++; ';
}
out += ' }]; return false; ';
if ($breakOnError) {
out += ' if (false) { ';
}
} else if (it.opts.missingRefs == 'ignore') {
console.log($message);
if ($breakOnError) {
out += ' if (true) { ';
}
} else {
out += ' var err = { keyword: \'' + ('$ref') + '\', dataPath: (dataPath || \'\') + ' + (it.errorPath) + ', message: \'can\\\'t resolve reference ' + ($schema) + '\' ';
if (it.opts.verbose) {
out += ', schema: \'' + ($schema) + '\', data: ' + ($data);
}
out += ' }; if (validate.errors === null) validate.errors = [err]; else validate.errors.push(err); errors++; ';
throw new Error($message);
}
if ($breakOnError) {
out += ' if (false) { ';
}
} else {
var $v = 'v' + $lvl;
out += ' var ' + ($v) + ' = ' + ($refVal) + '; if (! ' + ($v) + '(' + ($data) + ', (dataPath || \'\') + ' + (it.errorPath) + ') ) { if (validate.errors === null) validate.errors = ' + ($v) + '.errors; else validate.errors = validate.errors.concat(' + ($v) + '.errors); errors = validate.errors.length; } ';
out += ' if (! ' + ($refVal) + '(' + ($data) + ', (dataPath || \'\') + ' + (it.errorPath) + ') ) { if (validate.errors === null) validate.errors = ' + ($refVal) + '.errors; else validate.errors = validate.errors.concat(' + ($refVal) + '.errors); errors = validate.errors.length; } ';
if ($breakOnError) {

@@ -57,0 +66,0 @@ out += ' else { ';

{
"name": "ajv",
"version": "0.5.3",
"version": "0.5.4",
"description": "Another JSON schema Validator",

@@ -5,0 +5,0 @@ "main": "lib/ajv.js",

@@ -156,3 +156,4 @@ # ajv - Another JSON Schema Validator

- _meta_: add [meta-schema](http://json-schema.org/documentation.html) so it can be used by other schemas (true by default).
- _validateSchema: validate added/compiled schemas against meta-schema (true by default). `$schema` property in the schema can either be absent (draft-4 meta-schema will be used) or can be a reference to any previously added schema. If the validation fails, the exception is thrown. Pass "log" in this option to log error instead of throwing exception.
- _validateSchema_: validate added/compiled schemas against meta-schema (true by default). `$schema` property in the schema can either be absent (draft-4 meta-schema will be used) or can be a reference to any previously added schema. If the validation fails, the exception is thrown. Pass "log" in this option to log error instead of throwing exception.
- _missingRefs_: by default if the reference cannot be resolved during compilation the exception is thrown. Pass 'ignore' to log error during compilation and pass validation. Pass 'fail' to log error and successfully compile schema but fail validation if this rule is checked.
- _uniqueItems_: validate `uniqueItems` keyword (true by default).

@@ -159,0 +160,0 @@ - _unicode_: calculate correct length of strings with unicode pairs (true by default). Pass `false` to use `.length` of strings that is faster, but gives "incorrect" lengths of strings with unicode pairs - each unicode pair is counted as two characters.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc