You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As MLG has been using the OIP042 Edit spec for the past month or two, we have occasionally ran into an issue with how Edits use a Squashed version of the RFC6902 Patches.
While squashing the patch works in most instances, there are a couple specific semi-common cases that the squashed patches cannot handle. The main issue occurs when multiple items are being added to an array, as if there are multiple add operations for an Array, and they are “appending” the data, the squashed patch format will only pick up on one of the adds and ignore the second. The additional issues stem from how RFC6902 patches are Sequential, and how the Squashed Patch format removes any ordering.
The main bug logic can be demonstrated as follows using js-oip. Notice how we lose the “add” for “three”.
We propose that we retroactively remove support for the Squashed Patch format from js-oip and OIPd and only support patches containing a full RFC6902 formatted JSON Patch. MLG would then publish "replacement" edits for records that we have already edited. We at MLG think this way forward would be simplest for the long term support of OIPd, in order to prevent having to maintain the squashed patch format forever.
Currently MLG is the only user of OIP042 Edits, so this should luckily not affect anybody else.
We propose that the format of an OIP042 Edit be defined as the following:
Due to arrays maintaining order, the order of operations would remain within an op type however as mentioned order between types would indeed be lost and lead to potential edge cases resulting in invalid final output such as the index removed/replaced being incorrect if an insert were processed first
Overall, it's probably safest to fall back to full spec RFC6902 if MLG doesn't mind invalidating and rebroadcasting all current oip042 edits.
We had initially thought about going down the route of using the arrays for each operation, but decided that for the full ordering between op types, it was worth falling back to the RFC6902 spec.
MLG is ok with invalidating and rebroadcasting all of our current OIP042 edits :)
I am going to work on developing code to perform this work and will create a PR referencing this issue once I have tested it and believe it to be feature complete.
As MLG has been using the OIP042 Edit spec for the past month or two, we have occasionally ran into an issue with how Edits use a Squashed version of the RFC6902 Patches.
While squashing the patch works in most instances, there are a couple specific semi-common cases that the squashed patches cannot handle. The main issue occurs when multiple items are being added to an array, as if there are multiple
add
operations for an Array, and they are “appending” the data, the squashed patch format will only pick up on one of theadd
s and ignore the second. The additional issues stem from how RFC6902 patches are Sequential, and how the Squashed Patch format removes any ordering.The main bug logic can be demonstrated as follows using
js-oip
. Notice how we lose the “add” for “three”.We propose that we retroactively remove support for the Squashed Patch format from
js-oip
andOIPd
and only support patches containing a full RFC6902 formatted JSON Patch. MLG would then publish "replacement" edits for records that we have already edited. We at MLG think this way forward would be simplest for the long term support of OIPd, in order to prevent having to maintain the squashed patch format forever.Currently MLG is the only user of OIP042 Edits, so this should luckily not affect anybody else.
We propose that the format of an OIP042 Edit be defined as the following:
An example edit would look like:
The text was updated successfully, but these errors were encountered: