Earlier quoted context omitted.
Hmm, I got the impression that REST purists insist on using PATCH. Rails 4 uses it for their REST implementation, for example. Also check out Will Durand's post [1]. I mused about the relative merits of PATCH vs POST in a blog post [2] - if you have any references you wouldn't mind leaving in the comments, I'd love to check them out. PS. nesting resources is a pretty interesting issue in itself; there seem to be a fe…
It's more complex than that: http://roy.gbiv.com/untangled/2009/it-is-okay-to-use-post
JSON Patch – a format for describing changes to a JSON document
91–100 of 112 posts
Re: JSON Patch – a format for describing changes to a JSON document
#92Re: JSON Patch – a format for describing changes to a JSON document
#93 [
{ "op": "replace", "path": "/baz", "value": "boo" },
{ "op": "add", "path": "/hello", "value": ["world"] },
{ "op": "remove", "path": "/foo"}
]
would be better described as value["baz"] = "boo";
value["hello"] = ["world"];
delete value["foo"];
Why go to the trouble of defining your grammar as a strict subset of JSON documents, which are themselves written using a strict subset of JavaScript syntax, when you could just limit yourself instead to the strict subset of JavaScript syntax that encapsulates the operations you actually want to perform?Re: JSON Patch – a format for describing changes to a JSON document
#94I can't help thinking that [ { "op": "replace", "path": "/baz", "value": "boo" }, { "op": "add", "path": "/hello", "value": ["world"] }, { "op": "remove", "path": "/foo"} ] would be better described as value["baz"] = "boo"; value["hello"] = ["world"]; delete value["foo"]; Why go to the trouble of defining your grammar as a strict subset of JSON documents, which are themselves written using a strict subset of JavaScri…
Re: JSON Patch – a format for describing changes to a JSON document
#95Re: JSON Patch – a format for describing changes to a JSON document
#96I can't help thinking that [ { "op": "replace", "path": "/baz", "value": "boo" }, { "op": "add", "path": "/hello", "value": ["world"] }, { "op": "remove", "path": "/foo"} ] would be better described as value["baz"] = "boo"; value["hello"] = ["world"]; delete value["foo"]; Why go to the trouble of defining your grammar as a strict subset of JSON documents, which are themselves written using a strict subset of JavaScri…
Because it's much easier to implement?
To support my approach, you need to validate that each line uses a strict subset of JavaScript, then securely evaluate each one according to the well defined rules of JavaScript.
Both have basically the same essential complexity - not sure I see why the JSON format patch is inherently 'easier' to work with.
Re: JSON Patch – a format for describing changes to a JSON document
#97Earlier quoted context omitted.
> Errr, to apply any delta, including these, you need the document on hand. If your goal is to store deltas, this is no better than anything else. Doesn't this allow the sender to send updates without knowledge of the existing values, though? With a string diff, the existing value would have to be known. > This is in no way better at handling concurrent changes than anything other diff format. In fact, the extra oper…
> Doesn't this allow the sender to send updates without knowledge of the existing values, though? This system requires knowledge of existing values/nodes to create the diff/patch document. However for JSON data, it does have the advantage of not clobbering data unlike a string diff as you mentioned.
Re: JSON Patch – a format for describing changes to a JSON document
#98Earlier quoted context omitted.
Because it's much easier to implement?
To support this JSON patch format, you've got to implement a system which validates that all the array entries are in a valid format, securely interprets the 'path' attribute, and processes the rules according to a specification which may or may not cover every edge case To support my approach, you need to validate that each line uses a strict subset of JavaScript, then securely evaluate each one according to the wel…
Re: JSON Patch – a format for describing changes to a JSON document
#99We (Empirical) have implemented a similar couple years ago in our json-backed model. I see two big problems with this standard: 1. Why express paths as a string if you have the ability to encode it as an array in json? Otherwise you run up against the escaping problem for which they use ~0 and ~1 (of all things?!) which is only going to cause bugs. 2. Indexing into arrays is a problem in distributed computing because…
Probably because it's mimicking XPath, which was the analogous string but for XML. Think regex as well, which is a string.