From the quick start guide: (http://json-schema.org/)
The JSON document being validated or described we call the instance,
and the document containing the description is called the schema.
The most basic schema is a blank JSON object, which constrains
nothing, allows anything, and describes nothing:
{}
You can apply constraints on an instance by adding validation keywords
to the schema. For example, the “type” keyword can be used to restrict
an instance to an object, array, string, number, boolean, or null:
{ "type": "string" }
This means that if your schema is either an empty object or does not use the JSON Schema vocabulary, Ajv's compile
function will always generate a validation function that always passes:
var Ajv = require('ajv');
var ajv = new Ajv({allErrors: true});
var schema = {
foo: 'bar',
bar: 'baz',
baz: 'baz'
};
var validate = ajv.compile(schema);
validate({answer: 42}); //=> true
validate('42'); //=> true
validate(42); //=> true
Perhaps your setup.json
is either incorrectly loaded or isn't a schema as per the JSON Schema specification.