-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Starting in 0.2.8 this throws a fatal error. It only appears to happen if you have a reference to an empty schema. An empty schema by itself is fine as are refs in other situations.
var jsck = require("jsck").draft4;
var validator = new jsck({
"type": "object",
"properties": { "foo": { "$ref": "#/definitions/foo" } },
"definitions": { "foo": {} }
});
var res = validator.validate({ "foo": "bar" });
I get this error
count@bumba:~/jsck-test$ ./crash-0.3.0.js
/home/count/jsck-test/node_modules/jsck/lib/validator.js:316
return (_ref1 = _this.uris[uri])._test.apply(_ref1, args);
^
TypeError: Cannot call method 'apply' of undefined
at /home/count/jsck-test/node_modules/jsck/lib/validator.js:316:54
at /home/count/jsck-test/node_modules/jsck/lib/draft4/objects.js:52:15
at Object.test_function as _test
at Object.validate (/home/count/jsck-test/node_modules/jsck/lib/validator.js:109:22)
at Validator.validate (/home/count/jsck-test/node_modules/jsck/lib/validator.js:94:34)
at Object. (/home/count/jsck-test/crash-0.3.0.js:11:21)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)