-
-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Labels
Description
Using the next example:
const Ajv = require('ajv');
require('ajv-keywords')(ajv, 'uniqueItemProperties');
const schema = { uniqueItemProperties: ['id', 'name'] };
var invalidData2 = [
{ id: 1, name: 'taco' },
{ id: 2, name: 'taco' }, // duplicate "name"
{ id: 3, name: 'salsa' },
];
const validate = ajv.compile(schema);
console.log('validate errors: ', validate.errors);
The error message does not say which unique property is repeated.
/*
[ { keyword: 'uniqueItemProperties',
dataPath: '',
schemaPath: '#/uniqueItemProperties',
params: { keyword: 'uniqueItemProperties' },
message: 'should pass "uniqueItemProperties" keyword validation' } ]
*/
pushpa-pranik, amjedomar, Sumbersss, hsnassaad, rikribbers and 2 more