Skip to content

Reject standard input for in-place patching - #278

Merged
stefankoegl merged 1 commit into
stefankoegl:masterfrom
boogu2005:fix/reject-in-place-stdin-original
Nov 28, 2026
Merged

stefankoegl merged 1 commit into
stefankoegl:masterfrom
boogu2005:fix/reject-in-place-stdin-original

Conversation

@boogu2005

Copy link
Copy Markdown
Contributor

With --in-place -, jsonpatch reads the original document from standard input and then tries to use the stream's name as a filesystem path. This reports a file error for an unsupported argument combination.

Reject standard input as ORIGINAL when --in-place is set, before reading either input. Report the error using the existing CLI diagnostic and exit status.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 100.0%. remained the same — boogu2005:fix/reject-in-place-stdin-original into stefankoegl:master

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

No active review issues remain for the change rejecting standard input when in-place patching is enabled.

No open issues 🎉

What changed in this PR

This PR makes jsonpatch reject standard input as ORIGINAL when --in-place is enabled, replacing a misleading filesystem error with the existing CLI diagnostic and exit status.

Changes:

  • Rejects the unsupported argument combination before reading either input.
  • Adds regression coverage for valid and invalid standard-input JSON, checking the diagnostic, exit status, empty output, and unchanged directory contents.
File Description
tests.py Adds regression tests for rejecting in-place patching from standard input.
jsonpatch_cli.py Adds the standard-input guard before loading the document or patch.

Review effort: Balanced

@stefankoegl
stefankoegl merged commit 14c5158 into stefankoegl:master Nov 28, 2026
22 checks passed
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