Getting $ref history

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

Maintainers usually reply within 6 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

Start with the validator.iter_errors example in the issue and review reference #1144, then trace how the deprecated validator.resolver exposes the $ref scope history. Done means the project has a supported way to retrieve this debugging information without relying on the deprecated resolver, with the expected behavior documented or covered by tests.

Written by the indexing model from the issue text.

Description

Dialects v2 Enhancement Error Reporting

In large schemas, understanding which $ref is being referenced when an error occurs can be helpful in debugging. We used to refer to the history of $ref with (ill-mannered) code like this:

for error in validator.iter_errors(instance):
    print(validator.resolver._scopes_stack)
    print(error)

However, with the current version of jsonschema, validator.resolver is deprecated, and it will be not possible to refer to it.

Is there a legitimate way to retrieve this information in jsonschema?

Reference: #1144

Dominant language
Python
Stars
5k
Forks
741
Avg merge
4d 17h
Merged PRs (30d)
6

Getting set up

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.

More from python-jsonschema/jsonschema

All issues in python-jsonschema/jsonschema

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.