braid-org / braid-spec

Working area for Braid extensions to HTTP
https://braid.org
233 stars 16 forks source link

JSON Range Unit: deleting field in object is ambiguous #68

Open toomim opened 4 years ago

toomim commented 4 years ago

With the JSON Range Unit, the deletion of a field on a JSON object (e.g. delete foo.bar) is currently ambiguous:

   A patch with empty contents corresponds to deletion of existing
   content at the specified range.  A patch with a zero-length range but
   non-empty contents corresponds to inserting content immediately
   before the location of the zero-length range.  A patch with non-empty
   contents at a non-zero-length range corresponds to replacing existing
   content at the range with new content.

It's ambiguous whether "empty contents" refers to an empty string/array (such as "" and []) or an actually zero-length body (with Content-Length: 0). If you are deleting a portion of a string or array, it makes sense to replace that portion with a zero-length string or array. But if you are deleting a field from a JSON object, then it makes more sense to use Content-Length: 0.