json-patch/json-patch2

Patch Inversion

Opened this issue · 2 comments

Also see cujojs/jiff#15 - brainstorming possible ways to allow inversion.

I personally lean towards cujojs/jiff#15 (comment), using the key was. I implemented that in https://github.com/espadrine/json-diff.

However, there's a small catch: if an add operation was generated, but it replaces data instead of just adding it, its inverse won't yield the original document. I suppose the patch generator has to ensure that they only use add as a strict add.