python-jsonschema / python-jsonschema/jsonschema

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

Open
#1,363 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Error Reporting
Dominant language
Python
Stars
5k
Forks
671
Avg merge
1d 1h
Merged PRs (30d)
10

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how ValidationError is produced for array items defined as unique, then inspect the validation path that currently reports “ has non-unique elements.” Done means the error exposes exact context such as the relevant index and duplicated item, avoiding post-processing to locate duplicates.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.