jsonschema icon indicating copy to clipboard operation
jsonschema copied to clipboard

Add more context to the non-unique array item in error

Open yuri1969 opened this issue 7 months ago • 1 comments

Resolving validation errors caused by array items defined as unique requires post-processing the result to find the dups.

To illustrate, a validation of an array with 100s of items results in vague error of:

<array> has non-unique elements


Enriching ValidationError with additional exact context as an index/duplicated item would help a lot.

yuri1969 avatar Jun 02 '25 13:06 yuri1969

This isn't likely to happen unless #517 happens, as right now we don't calculate this information (and doing so isn't strictly necessary to know the list contains duplicates). But given that #517 may indeed happen some day I'm happy to leave this open to consider at that point.

Julian avatar Jun 06 '25 16:06 Julian