should change `add` to `replace`?
Alanscut opened this issue · 1 comments
Alanscut commented
when I run the follow case with python-json-patch, it failed. Detail in stefankoegl/python-json-patch#111 (comment). But when I change the add operation to replace, it succeeded.
Lines 63 to 66 in ea3af85
jayvdb commented
A path of "" means the root, or whole document.
See https://datatracker.ietf.org/doc/html/rfc6901#section-5
"" // the whole document
The fact "add" to the whole document does a replace is covered by this part of the json-patch spec
https://datatracker.ietf.org/doc/html/rfc6902/#section-4.1
If the target location specifies an object member that does exist, that member's value is replaced.
The root exists, so it becomes a replace op