json-patch / json-patch2

A possibile revision to the JSON-Patch format
44 stars 0 forks source link

Patch Inversion #2

Open mnot opened 10 years ago

mnot commented 10 years ago

See: https://github.com/cujojs/jiff/issues/9

briancavalier commented 10 years ago

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

espadrine commented 8 years ago

I personally lean towards https://github.com/cujojs/jiff/issues/15#issuecomment-42357803, 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.