Skip to content

Only reject '-' in replace when it refers to an array (#212) - #223

Merged
stefankoegl merged 1 commit into
masterfrom
claude/wizardly-feynman-waxqkp
Oct 9, 2026
Merged

stefankoegl merged 1 commit into
masterfrom
claude/wizardly-feynman-waxqkp

Conversation

@stefankoegl

Copy link
Copy Markdown
Owner

ReplaceOperation.apply rejected every path ending in '-', including
paths where '-' names an object member. RFC 6901 gives '-' a special
meaning only for arrays, so make_patch could emit a replace of an
object member '-' that apply then refused.

Move the check into the array branch. Replacing a missing '-' member
of an object now raises JsonPatchConflict, like any other missing
member, instead of InvalidJsonPatch.

Drop the expectedFailure markers from test_roundtrip and
test_replace_any_existing_location, which pass now.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01AFifAtR66mm468E2xYSRmw

ReplaceOperation.apply rejected every path ending in '-', including
paths where '-' names an object member. RFC 6901 gives '-' a special
meaning only for arrays, so make_patch could emit a replace of an
object member '-' that apply then refused.

Move the check into the array branch. Replacing a missing '-' member
of an object now raises JsonPatchConflict, like any other missing
member, instead of InvalidJsonPatch.

Drop the expectedFailure markers from test_roundtrip and
test_replace_any_existing_location, which pass now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFifAtR66mm468E2xYSRmw
@stefankoegl
stefankoegl merged commit 5f53d8b into master Oct 9, 2026
5 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.

2 participants