WARNING: This server is unstable and will be retired in the next days. If you want to keep this forum available, please request immediately a migration on the Nabble Support forum. Forums that don't receive any migration request will be deleted forever.

 « Return to Thread: [apps-discuss] draft-pbryan-json-patch-04 - comments

[apps-discuss] draft-pbryan-json-patch-04 - comments

by Vadim Zaliva :: Rate this Message:

| View in Thread

Hi!

I was looking for JSON patch formats available and found this draft. It looks nice - concise and to the point. I would like to share few comments I have.

1. I am not sure if 'test' operation should be part of it. The purpose of the patch is to modify the document. 'test' operation either succeeds of fails, but it is unclear how this information will be communicated or used. It almost looks like a API operation rather than patch format instruction. I would argue that in current state it should not be included in the format.

I could see a case when it could be included as a part of conditional syntax. In this case 'test' becomes a container for other operations which would be executed only if the test succeeds. For example:


{ "test": "/baz", "value": "qux",
        "onsuccess" : [
          { "replace": "/baz", "value": "boo" },
          { "add": "/baz1", "value": "qux" }
        ]
}

2. In most examples "value" property holds simple scalar values (strings or integers) or arrays of such. I think it should be possible to use arbitrary complex JSON data structures as such values. I hope this was the intention. Perhaps adding an example with more complex value (object or array) could illustrate this very powerful capability. For example A.1 could be modified as following;

An example target JSON document:

   {
       "foo": "bar"
   }

   A JSON Patch document:

   [
       { "add": "/baz", "value": {"a":1,"b":2} }
   ]

   The resulting JSON document:

   {
       "baz": {"a":1,"b":2},
       "foo": "bar"
   }

Sincerely,
Vadim



_______________________________________________
apps-discuss mailing list
apps-discuss@...
https://www.ietf.org/mailman/listinfo/apps-discuss

 « Return to Thread: [apps-discuss] draft-pbryan-json-patch-04 - comments