ShareDB with JSON-Patch (CRF-6902)

149 views Asked by At

If I read the documentation correctly, one needs to create "JSON0 OT Type" records for any change in the target data-model and send these to the ShareDB backend for transformation and forwarding to other clients. There also seems to be a newer "JSON1 OT Type".

Since I have a libray which already produces JSON-Patch records, I was wondering if it is possible to use this JSON-Patch (CRF-6902) standard to specify the changes to the ShareDB backend.

1

There are 1 answers

0
Alec On

json0 (and other ShareDB types) don't just define a "shape" of the patch: they also implement a number of methods that are responsible for performing operational transform, so they need to use the op shape they've defined.

Your options are:

  • Disregard your CRF-6902 patches and create new ShareDB patches
  • Work out how to transform CRF-6902 patches into json0 patches
  • Write your own OT type that works with CRF-6902