Open alandotcom opened 9 years ago
var schema = { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Result", "type": "object", "properties": { "additional_info": { "description": "More info", "type": "object", } }, "additionalProperties": false } var instance = {additional_info: undefined}; var JaySchema = require('jayschema'); var js = new JaySchema(); js.validate(instance, schema, function(errs) { if (errs) { console.error(errs); } else { console.log('validation OK!'); } }); /* * [ { [Error] * instanceContext: '#/additional_info', * resolutionScope: 'anon-schema://8acc7aec06a4b148e96a2130384cea97b268413d/#/properties/additional_info', * constraintName: 'type', * constraintValue: 'object', * testedValue: 'undefined' } ] */