Skip to content

Preserve JsonPointer subclasses when joining - #78

Merged
stefankoegl merged 1 commit into
stefankoegl:masterfrom
x0Lazarus:fix/subclass-join
Oct 1, 2026
Merged

stefankoegl merged 1 commit into
stefankoegl:masterfrom
x0Lazarus:fix/subclass-join

Conversation

@x0Lazarus

Copy link
Copy Markdown
Contributor

Joining a JsonPointer subclass currently returns a base JsonPointer, losing subclass behavior. Construct the result through the left operand's existing from_parts factory so both join() and / preserve its class.

Suffix handling stays the same, including base pointers, different subclasses, strings and part lists. Regression tests cover those inputs, escaped segments and chained / operations.

Fixes #64.

Validation on Windows / Python 3.12:

  • python -m unittest: 30 tests passed, including doctests. The new regressions fail before the fix.
  • coverage run --source=jsonpointer -m unittest and coverage report -m: 100% statement/branch coverage.
  • flake8: passed.
  • python -m build --no-isolation: sdist and wheel built; installed-wheel consumer checks passed.

Other Python versions and the hosted Ubuntu matrix have not been run locally.

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.

Copilot review overview

🟢 Approval recommended

The focused implementation is correct and adequately covered by regression tests.

Review effort: Balanced
Findings: None

What changed in this PR

Preserves JsonPointer subclasses when joining pointers.

Changes:

  • Constructs joined pointers through the left operand’s from_parts factory.
  • Adds regression tests for suffix types, escaping, and chained / operations.
File Description
jsonpointer.py Preserves the left operand’s subclass during joins.
tests.py Covers subclass-preserving joins and chaining.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@stefankoegl
stefankoegl merged commit 09b3cd7 into stefankoegl:master Oct 1, 2026
6 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.

Feature request: make join() return self.__class__ to support subclassing

3 participants