←back to thread

JSON Patch

(zuplo.com)
299 points DataOverload | 3 comments | | HN request time: 0.611s | source
1. _blk ◴[] No.41881324[source]
I would love to see some (optional) checksumming or orignal value in the protocol and a little more flexibility in the root node for other metadata like format versioning etc. rather than just the array of patch ops in the root.

```

{ "checksum": { "algorithm": "sha1", "normalization": "minify", "root-checksum": "d930e659007308ac8090182fe664c7f64e898ed9" }, "patch": [ { "op": "replace", "path": "/id", "node-checksum": "b11ee5e59dc833a22b5f0802deb99c29fb50fdd0", "value": { "foo": "bar", "nullptr": 0 } }, { "op": "replace", "path": "/cat", "original-value": "foo" "value": "bar" } ] }

```

replies(1): >>41881525 #
2. naberhausj ◴[] No.41881525[source]
This is what "op": "test" is for. You can use it at the beginning of a patch to verify that the server's object hasn't drifted from your own.
replies(1): >>41888479 #
3. _blk ◴[] No.41888479[source]
Good point, thanks. Specified here: https://datatracker.ietf.org/doc/html/rfc6902#section-4.6

Yet, I would still like a checksum option because of its constant size impact.

I didn't consider before though that checksumming would differ from json's understanding of equality if items are reordered (objects, but also some other cases like integers with explicit sign +0, 0, -0). Those cases could (optionally) be considered in a normalization step.