1.0.1 • Published 8 years ago
knode-jsv v1.0.1
knode-jsv
is a simple node module wrapper on jsonschema.
Install:
npm install --save knode-jsvUsage:
var validateInput = require('knode-jsv').validateInput;
var err = validateInput(data, schema); //err now contains either "null" or an object with error messageSample:
var validateInput = require('knode-jsv').validateInput;
var schema = {
	type: 'object',
	required: true,
	properties: {
		importantField: {
			type: 'string',
			required: true
		}
	}
};
var err = validateInput({}, schema);The err variable will now contain the following object:
{ message: 'Invalid input parameters: instance.importantField is required' }