Socket
Socket
Sign inDemoInstall

jsonschema

Package Overview
Dependencies
0
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.6 to 1.2.7

46

lib/attribute.js

@@ -25,3 +25,3 @@ 'use strict';

'$ref': true,
'extends': true
'extends': true,
};

@@ -95,3 +95,3 @@

this, instance, options, ctx, function(res){inner.importErrors(res);}
))) {
))) {
var list = schema.anyOf.map(function (v, i) {

@@ -166,3 +166,3 @@ return (v.id && ('<' + v.id + '>')) || (v.title && JSON.stringify(v.title)) || (v['$ref'] && ('<' + v['$ref'] + '>')) || '[subschema '+i+']';

this, instance, options, ctx, function(res) {inner.importErrors(res);}
) ).length;
) ).length;
var list = schema.oneOf.map(function (v, i) {

@@ -256,3 +256,3 @@ return (v.id && ('<' + v.id + '>')) || (v.title && JSON.stringify(v.title)) || (v['$ref'] && ('<' + v['$ref'] + '>')) || '[subschema '+i+']';

for (var pattern in patternProperties) {
var expr = new RegExp(pattern);
var expr = new RegExp(pattern, 'u');
if (!expr.test(property)) {

@@ -315,3 +315,3 @@ continue;

message: "does not meet minimum property length of " + schema.minProperties,
})
});
}

@@ -452,3 +452,3 @@ return result;

argument: validationArgument,
message: errorMessage + JSON.stringify(validationArgument)
message: errorMessage + JSON.stringify(validationArgument),
});

@@ -467,3 +467,3 @@ }

validators.multipleOf = function validateMultipleOf (instance, schema, options, ctx) {
return validateMultipleOfOrDivisbleBy.call(this, instance, schema, options, ctx, "multipleOf", "is not a multiple of (divisible by) ");
return validateMultipleOfOrDivisbleBy.call(this, instance, schema, options, ctx, "multipleOf", "is not a multiple of (divisible by) ");
};

@@ -493,3 +493,3 @@

name: 'required',
message: "is required"
message: "is required",
});

@@ -519,3 +519,4 @@ } else if (this.types.object(instance) && Array.isArray(schema.required)) {

var result = new ValidatorResult(instance, schema, options, ctx);
if (!instance.match(schema.pattern)) {
var regexp = new RegExp(schema.pattern, 'u');
if (!instance.match(regexp)) {
result.addError({

@@ -646,28 +647,2 @@ name: 'pattern',

/**
* Validates that every item in an instance array is unique, when instance is an array
* @param instance
* @param schema
* @param options
* @param ctx
* @return {String|null|ValidatorResult}
*/
validators.uniqueItems = function validateUniqueItems (instance, schema, options, ctx) {
if (!this.types.array(instance)) return;
var result = new ValidatorResult(instance, schema, options, ctx);
function testArrays (v, i, a) {
for (var j = i + 1; j < a.length; j++) if (helpers.deepCompareStrict(v, a[j])) {
return false;
}
return true;
}
if (!instance.every(testArrays)) {
result.addError({
name: 'uniqueItems',
message: "contains duplicate item",
});
}
return result;
};
/**
* Deep compares arrays for duplicates

@@ -696,2 +671,3 @@ * @param v

validators.uniqueItems = function validateUniqueItems (instance, schema, options, ctx) {
if (schema.uniqueItems!==true) return;
if (!this.types.array(instance)) return;

@@ -698,0 +674,0 @@ var result = new ValidatorResult(instance, schema, options, ctx);

@@ -19,3 +19,3 @@ 'use strict';

}
if (instance) {
if (instance !== undefined) {
this.instance = instance;

@@ -90,4 +90,5 @@ }

SchemaError.prototype = Object.create(Error.prototype,
{ constructor: {value: SchemaError, enumerable: false}
, name: {value: 'SchemaError', enumerable: false}
{
constructor: {value: SchemaError, enumerable: false},
name: {value: 'SchemaError', enumerable: false},
});

@@ -115,3 +116,3 @@

return ctx;
}
};

@@ -149,3 +150,3 @@ var FORMAT_REGEXPS = exports.FORMAT_REGEXPS = {

'style': /\s*(.+?):\s*([^;]+);?/,
'phone': /^\+(?:[0-9] ?){6,14}[0-9]$/
'phone': /^\+(?:[0-9] ?){6,14}[0-9]$/,
};

@@ -219,6 +220,6 @@

if (typeof e === 'object') {
dst[i] = deepMerge(target[i], e)
dst[i] = deepMerge(target[i], e);
} else {
if (target.indexOf(e) === -1) {
dst.push(e)
dst.push(e);
}

@@ -240,3 +241,3 @@ }

} else {
dst[key] = deepMerge(target[key], src[key])
dst[key] = deepMerge(target[key], src[key]);
}

@@ -262,3 +263,3 @@ }

return dst;
};
}

@@ -294,5 +295,5 @@ module.exports.deepMerge = deepMerge;

exports.encodePath = function encodePointer(a){
// ~ must be encoded explicitly because hacks
// the slash is encoded by encodeURIComponent
return a.map(pathEncoder).join('');
// ~ must be encoded explicitly because hacks
// the slash is encoded by encodeURIComponent
return a.map(pathEncoder).join('');
};

@@ -299,0 +300,0 @@

@@ -85,2 +85,3 @@ /*

}
const?: any[]
'enum'?: any[]

@@ -102,2 +103,3 @@ type?: string | string[]

throwError?: boolean;
nestedErrors?: boolean;
}

@@ -104,0 +106,0 @@

@@ -0,1 +1,2 @@

"use strict";

@@ -71,5 +72,4 @@ var urilib = require('url');

var ref = {};
var schemaUri = base;
scanSchema(base, schema);
return new SchemaScanResult(found, ref);
}
};

@@ -155,3 +155,3 @@ 'use strict';

// Support for the true/false schemas
// Support for the true/false schemas
if(typeof schema==='boolean') {

@@ -184,4 +184,4 @@ if(schema===true){

// If passed a string argument, load that schema URI
var switchSchema;
if (switchSchema = shouldResolve(schema)) {
var switchSchema = shouldResolve(schema);
if (switchSchema) {
var resolved = this.resolve(schema, switchSchema, ctx);

@@ -225,3 +225,3 @@ var subctx = new SchemaContext(resolved.subschema, options, ctx.propertyPath, resolved.switchSchema, ctx.schemas);

schemaobj.schema = helpers.deepMerge(schemaobj.schema, this.superResolve(s, schemaobj.ctx));
}
};

@@ -235,8 +235,8 @@ /**

Validator.prototype.superResolve = function superResolve (schema, ctx) {
var ref;
if(ref = shouldResolve(schema)) {
var ref = shouldResolve(schema);
if(ref) {
return this.resolve(schema, ref, ctx).subschema;
}
return schema;
}
};

@@ -243,0 +243,0 @@ /**

{
"author": "Tom de Grunt <tom@degrunt.nl>",
"name": "jsonschema",
"version": "1.2.6",
"version": "1.2.7",
"license": "MIT",

@@ -15,5 +15,6 @@ "dependencies": {},

"devDependencies": {
"chai": "~4.2.0",
"eslint": "^7.7.0",
"json-metaschema": "^1.2.0",
"mocha": "~3",
"chai": "~1.5.0"
"mocha": "~8.1.1"
},

@@ -20,0 +21,0 @@ "optionalDependencies": {},

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc