Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve uniqueItemProperties messages #94

Open
rmadrid9006 opened this issue Apr 4, 2019 · 1 comment
Open

improve uniqueItemProperties messages #94

rmadrid9006 opened this issue Apr 4, 2019 · 1 comment

Comments

@rmadrid9006
Copy link

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

@Pushkarang
Copy link

Pushkarang commented May 23, 2020

Create a PR #123. @epoberezkin could you please take a look at it??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants