Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsonschema

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonschema - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

7

lib/validator.js

@@ -104,4 +104,7 @@ 'use strict';

var prop;
// Don't validate undefined's
// Only validate undefined's if they are required
if (!helpers.isDefined(instance)) {
if (helpers.isDefined(schema) && schema.required === true) {
this.addError(helpers.createError(schema, undefined, options.propertyName, "is required", instance));
}
return;

@@ -186,2 +189,2 @@ }

module.exports = Validator;
module.exports = Validator;
{
"author": "Tom de Grunt <tom@degrunt.nl>",
"name": "jsonschema",
"version": "0.1.2",
"version": "0.1.3",
"dependencies": {
"mocha": "~1.3.0",
"mocha": "~1.3",
"should": "~0.6.3",

@@ -8,0 +8,0 @@ "deep-equal": "0.0.0"

@@ -104,2 +104,23 @@ 'use strict';

});
describe('undefined but required object', function () {
it('should NOT validate an undefined object', function () {
var ret = this.validator.validate(
{'foo': {'baz': 1}},
{
'type': 'object',
'required': true,
'properties': {
'foo': {
'type': 'object',
'required': true,
'properties': {
'bar': {'type': 'object', 'required': true},
'baz': {'type': 'number', 'required': true}
}
}
}
}
).should.not.be.empty;
});
});
});
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc