Skip to content

docs: explain copy and in-place behavior when a patch fails - #243

Open
PerchAnton wants to merge 1 commit into
stefankoegl:masterfrom
PerchAnton:python-json-patch/docs-failed-application
Open

PerchAnton wants to merge 1 commit into
stefankoegl:masterfrom
PerchAnton:python-json-patch/docs-failed-application

Conversation

@PerchAnton

Copy link
Copy Markdown

A failed operation can leave earlier changes in the input when in_place=True. Add a short example under “Applying a Patch” that runs the same replace followed by a failing test in both modes: the default copy mode leaves {'value': 1} unchanged, while in-place mode retains {'value': 2}.

This is the small documentation follow-up invited in #239. Only doc/tutorial.rst changes; the example uses jsonpatch.apply_patch directly.

Validation on upstream f45a5001 with Python 3.14.3:

  • All 7 doctest examples in the added section pass against the checkout's jsonpatch.py.
  • sphinx-build -W --keep-going -b html doc ../docs-html passes.
  • git diff --check passes.

Prepared with AI assistance.

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 focused documentation change accurately describes failure behavior, and no unresolved issues were identified.

No open issues 🎉

What changed in this PR

Adds the documentation follow-up discussed in #239, explaining how failed patches affect the input document in copy and in-place modes. No runtime behavior changes.

Changes:

  • Adds a runnable example where a successful replace is followed by a failing test.
  • Shows that default copy mode preserves the original document, while in-place mode retains earlier changes without rollback.
File Description
doc/​tutorial.rst Documents patch failure behavior with examples for both application modes.

Review effort: Balanced

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 100.0%. remained the same — PerchAnton:python-json-patch/docs-failed-application into stefankoegl:master

This branch has not been deployed

No deployments
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.

3 participants