ajv-merge-patch
Version:
$merge and $patch keywords for Ajv JSON-Schema validator to extend schemas
32 lines (26 loc) • 626 B
JavaScript
;
var Ajv = require('ajv');
var addKeywords = require('..');
var assert = require('assert');
describe('errors', function() {
var ajv;
describe('missing $ref', function() {
beforeEach(function() {
ajv = new Ajv;
addKeywords(ajv);
});
it('should throw exception if cannot resolve $ref', function() {
var schema = {
"$merge": {
"source": { "$ref": "obj.json#" },
"with": {
"properties": { "q": { "type": "number" } }
}
}
};
assert.throws(function() {
ajv.compile(schema);
});
});
});
});