{ valid: true, errors: [] }
{ valid: true, errors: [] }
{ valid: false,
errors:
[ { property: 'undefined.postcode',
message: 'is missing and it is required' } ] }
/root/smartdata/smart-admin-api/node_modules/json-gate/lib/valid-schema.js:10
throw new Error('Schema' + getName(names) + ': ' + attribFullName + ' is ' +
^
Error: Schema: 'type' attribute is an array when it should be a string
at throwInvalidType (/root/smartdata/smart-admin-api/node_modules/json-gate/lib/valid-schema.js:10:8)
at assertType (/root/smartdata/smart-admin-api/node_modules/json-gate/lib/valid-schema.js:16:4)
at module.exports (/root/smartdata/smart-admin-api/node_modules/json-gate/lib/valid-schema.js:281:2)
at new Schema (/root/smartdata/smart-admin-api/node_modules/json-gate/lib/json-gate.js:6:2)
at Object.module.exports.createSchema (/root/smartdata/smart-admin-api/node_modules/json-gate/lib/json-gate.js:14:9)
at Object.<anonymous> (/root/smartdata/smart-admin-api/toto.js:48:35)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
Hi
This stackoverflow solutions does not work with json-gate: http://stackoverflow.com/questions/9029524/json-schema-specify-field-is-required-based-on-value-of-another-field
The output is: