ajv-keywords icon indicating copy to clipboard operation
ajv-keywords copied to clipboard

improve uniqueItemProperties messages

Open rmadrid9006 opened this issue 6 years ago • 1 comments
trafficstars

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' } ] */

rmadrid9006 avatar Apr 04 '19 16:04 rmadrid9006

Create a PR https://github.com/ajv-validator/ajv-keywords/pull/123. @epoberezkin could you please take a look at it??

Pushkarang avatar May 23 '20 08:05 Pushkarang