Skip to content

Clarify the direction of pointer containment checks - #97

Merged
stefankoegl merged 1 commit into
stefankoegl:masterfrom
UmutAlisoglu:codex/document-pointer-prefix-direction
Oct 26, 2026
Merged

stefankoegl merged 1 commit into
stefankoegl:masterfrom
UmutAlisoglu:codex/document-pointer-prefix-direction

Conversation

@UmutAlisoglu

Copy link
Copy Markdown
Contributor

The containment docstrings say that self contains the given pointer, but the implementation checks whether the argument's parts are a prefix of self. For example, child.contains(parent) and parent in child return true.

Clarify this direction in the API docs and tutorial, with executable examples for both directions, equal/root pointers and whole-part matching (/foo/b is not a prefix of /foo/bar). Runtime behavior is unchanged.

Validation on Windows / Python 3.14.7: all 74 tests pass, including the new doctests; Flake8 passes; the Sphinx HTML build passes with warnings treated as errors.

AI-assisted with OpenAI Codex, including editing and verification.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The documentation and examples accurately describe the unchanged implementation, with no unresolved issues.

No open issues 🎉

What changed in this PR

This PR clarifies the direction of JSON Pointer containment checks without changing runtime behavior.

Changes:

  • Corrects API docstrings to explain that the argument’s parts must be a prefix of the receiver’s parts.
  • Adds doctests covering direction, equality, root pointers, and whole-part matching.
  • Adds tutorial guidance showing the equivalent parent in child expression.
File Description
jsonpointer.py Clarifies containment docstrings and adds executable examples.
doc/​tutorial.rst Explains pointer-prefix checks and membership direction.

Review effort: Balanced

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 97.714%. remained the same — UmutAlisoglu:codex/document-pointer-prefix-direction into stefankoegl:master

@stefankoegl
stefankoegl merged commit 694694d into stefankoegl:master Oct 26, 2026
13 checks passed
@stefankoegl

Copy link
Copy Markdown
Owner

Thanks!

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.

4 participants