Skip to content

Add test reproducing JsonPointerException on missing key in OrderedDict#71

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-jsonpointer-exception
Draft

Add test reproducing JsonPointerException on missing key in OrderedDict#71
Copilot wants to merge 2 commits intomasterfrom
copilot/fix-jsonpointer-exception

Conversation

Copy link
Contributor

Copilot AI commented Mar 11, 2026

resolve_pointer raises an unhandled JsonPointerException when traversing an OrderedDict and encountering a missing key — reported when sphinx-jsonschema processes JSON Schema files containing OrderedDict-backed documents.

Changes

  • tests.py: Import OrderedDict; add test_ordereddict_member_not_found to WrongInputTests — constructs an OrderedDict mirroring the schema from the issue report and asserts JsonPointerException is raised when resolving a pointer to a non-existent member.
doc = OrderedDict([
    ('$schema', 'http://json-schema.org/draft-07/schema#'),
    ('$id', '/sports_field'),
    ('type', 'object'),
    ('properties', OrderedDict([...])),
])
# Raises JsonPointerException: member 'src' not found in OrderedDict(...)
resolve_pointer(doc, '/src')
Original prompt

This section details on the original issue you should resolve

<issue_title>Exception occured in Jsonpointer</issue_title>
<issue_description>I am trying to document schema files using sphinx.
Once I add the file path it throws this error

  File "/Users/eyshika.agarwal/.virtualenvs/gui-intrinsic/lib/python3.7/site-packages/jsonpointer.py", line 279, in walk
    raise JsonPointerException("member '%s' not found in %s" % (part, doc))
jsonpointer.JsonPointerException: member 'src' not found in OrderedDict([('$schema', 'http://json-schema.org/draft-07/schema#'), ('$id', '/sports_field'), ('title', 'Field'), ('description', 'A sports field description.'), ('type', 'object'), ('properties', OrderedDict([('description', OrderedDict([('description', 'Field description'), ('type', 'string')])), ('units', OrderedDict([('description', 'length units in which the calibration points are defined.'), ('$ref', '/units_length')])), ('calibration_points', OrderedDict([('description', "list of XYZ corner points of the filed lines. Length units defined by 'units' property."), ('type', 'array'), ('items', OrderedDict([('type', 'array'), ('maxItems', 3), ('minItems', 3), ('items', OrderedDict([('anyOf', [OrderedDict([('type', 'number')]), OrderedDict([('type', 'string'), ('description', 'An arithmetic expression to be evaluated along with the parameters provided.'), ('examples', ['(0.5 * width) + 10.0'])])])]))])), ('uniqueItems', True)])), ('parameters', OrderedDict([('description', 'parameter list used for generating the calibration points'), ('type', 'array'), ('items', OrderedDict([('type', 'object'), ('properties', OrderedDict([('name', OrderedDict([('type', 'string'), ('description', 'parameter name')])), ('description', OrderedDict([('type', 'string'), ('description', 'parameter description')])), ('default', OrderedDict([('type', 'number'), ('description', 'parameter default value')]))])), ('required', ['name', 'description', 'default'])]))]))])), ('required', ['units', 'calibration_points'])])```</issue_description>

<agent_instructions>Can you come up with a test that can trigger the mentioned error?</agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
<comment_new><author>@stefankoegl</author><body>
Hi! Can you please provide some example code to reproduce the exception?</body></comment_new>
</comments>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: stefankoegl <184196+stefankoegl@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix exception in Jsonpointer during schema documentation Add test reproducing JsonPointerException on missing key in OrderedDict Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exception occured in Jsonpointer

2 participants