Iterator error contexts lose parent links and absolute paths
Maintainers usually reply within 6 days
@DawnofGenX is already working on this.
Since Oct 5, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start by locating the ValidationError and SchemaError constructors and reproduce the iterator example from the issue. Inspect the existing regression tests for context and parent behavior, then cover one-shot iterator contexts for both error classes alongside list and tuple contexts. Done means children retain their parent links and produce absolute paths including the parent path.
Written by the indexing model from the issue text.
Description
Problem
Passing an iterator as ValidationError(context=...) retains its children, but does not set their parent. The iterator is consumed by self.context = list(context), then iterated again when assigning parents. This also affects SchemaError.
from jsonschema.exceptions import ValidationError
child = ValidationError("child", path=["name"], schema_path=[0, "type"])
parent = ValidationError(
"parent",
path=["record"],
schema_path=["properties", "record", "anyOf"],
context=iter([child]),
)
print(parent.context == [child]) # True
print(child.parent is parent) # False (expected True)
print(child.json_path) # $.name (expected $.record.name)
Lists and tuples assign the parent correctly. Setting parents from the stored self.context instead of the original iterable should preserve the same behavior for one-shot iterators.
Reproduced on main (51cd75e39), macOS, Python 3.12.13. A regression test fails for iterator contexts with both error classes and passes for list/tuple contexts.
Investigated with Codex assistance.
- Dominant language
- Python
- Stars
- 5k
- Forks
- 741
- Avg merge
- 4d 17h
- Merged PRs (30d)
- 6
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python-jsonschema/jsonschema
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
python-jsonschema/jsonschema#1610 · 1 comment ·
Maintainers usually reply within 6 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
python-jsonschema/jsonschema#1588 · 2 comments ·
Maintainers usually reply within 6 days
-
regex format checker crashes with RecursionError on deeply nested patternsPossibly taken @DawnofGenX claimed this 59 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
python-jsonschema/jsonschema#1538 · 1 comment ·
Maintainers usually reply within 6 days
-
is_duration raises an uncaught decimal.Overflow on a duration with a large exponentMay be free again A pull request for this issue was closed without being merged. OpenNeeds Test Upstream
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
python-jsonschema/jsonschema#1511 · 1 comment ·
Maintainers usually reply within 6 days
-
python-jsonschema/jsonschema#1605 ·
Maintainers usually reply within 6 days
All issues in python-jsonschema/jsonschema
Similar issues
-
area:print-dispatch
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
area/geometry good first issue help wanted kind/doc-mismatch severity/4-minor
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Apich-Organization/rssn#295 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
chore claimed
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
schuyler/corvidae#1424 · 2 comments ·
Maintainers usually reply within 1 day