mutative icon indicating copy to clipboard operation
mutative copied to clipboard

Support `move` and `copy` ops

Open Richienb opened this issue 4 months ago • 1 comments

I'm using a spec-compliant upstream module to generate patches, and then I'm sending them the client. However, this upstream module generates move and copy operations which aren't supported here. The workaround is manually translating these ops to add/remove counterparts before sending them.

https://github.com/stefankoegl/python-json-patch/issues/172

Richienb avatar Sep 02 '25 20:09 Richienb

The workaround you mentioned is actually the appropriate approach. The 'move' operation can be composed of 'remove' and 'add' operations. Similarly, 'copy' can be replaced by 'add' (because in Mutative, the patch's value is deep-cloned).

Generally, the apply() function is primarily designed for patches generated by Mutative, which currently only supports 'remove', 'replace', and 'add'. Therefore, I highly recommend that you continue with your workaround, using it as a converter to transform 'op' patches into the format that Mutative supports.

unadlib avatar Sep 03 '25 15:09 unadlib