4 ms·
Where would this be useful? I am not trying to bring the article down but I'm genuinely interested in knowing where/how people would use this. It seems like jus
by salil999 4y ago
Where would this be useful? I am not trying to bring the article down but I'm genuinely interested in knowing where/how people would use this. It seems like just locally modifying a payload would be more efficient?
- Hamuko 4y agoKustomize patches.
- mathgladiator 4y agoJSON merge ( https://datatracker.ietf.org/doc/html/rfc7386 https://datatracker.ietf.org/doc/html/rfc7386 ) is the entire basis for how I persist document changes to disk and to clients ( http://www.adama-platform.com/2021/03/28/json.html http://www.adama-platform.com/2021/03/28/json.html ). Arrays require some care to handle which is why I'm got some extensions in my client, but a super power that JSON patching enables is that it can be algebraic in nature. That it, we can define a patching which is associative (another extension where you preserve nulls) such that (X + da) + db = X + (da + db) = X + dc where da + db + dc This allows you to leverage flow control when congestion happens (especially on mobile connections).
- nigma1337 4y agoUsing it for k8s currently, in a request like [{"op": "replace", "path":"/spec/template/metadata/annotations/restarted-at", "value": "'$(date -Iseconds)'"}] to restart/redeploy.
- kgeist 4y agoI can think of realtime collaborative document editing - patches are sent to the server instead of sending the whole JSON-based document every time and the app resolves potential conflicts.
- chii 4y agoBut i wonder if you have to use a very long pointer expression to identify a single character being typed, you'd end up with much higher overhead.
- EdwardDiego 4y agoI've used it with K8s and kustomize a fair bit.
- jurple 4y agoWe have a supplier who uses it to distribute daily updates to their (large) product catalog. It helps that most of the mutations are to specific fields like availability and price, while EAN/GTIN etc tend to be stable. Deletions are trivial as well.
- coredog64 4y agoAmazon uses this for changes to API Gateway. Take that as either a positive or a negative :)
- wvh 4y agoSoftware such as Kubernetes uses it with different processes writing to the same data fields, but different subsets. If you have a typical API with only one main blob that gets updated in its entirety, you might not avoid conflicts using the PATCH approach.