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

"Paul C. Bryan" <pbryan@anode.ca> Fri, 09 March 2012 05:36 UTC

Return-Path: <pbryan@anode.ca>
X-Original-To: apps-discuss@ietfa.amsl.com
Delivered-To: apps-discuss@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id F2C1F21E8063 for <apps-discuss@ietfa.amsl.com>; Thu, 8 Mar 2012 21:36:27 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.598
X-Spam-Level:
X-Spam-Status: No, score=-2.598 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, HTML_MESSAGE=0.001]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4xVNOeDjG6zx for <apps-discuss@ietfa.amsl.com>; Thu, 8 Mar 2012 21:36:26 -0800 (PST)
Received: from maple.anode.ca (maple.anode.ca [72.14.183.184]) by ietfa.amsl.com (Postfix) with ESMTP id 391F821E8043 for <apps-discuss@ietf.org>; Thu, 8 Mar 2012 21:36:26 -0800 (PST)
Received: from [192.168.1.9] (S0106a021b762dbb3.vf.shawcable.net [174.1.50.247]) by maple.anode.ca (Postfix) with ESMTPSA id 671A8617D for <apps-discuss@ietf.org>; Fri, 9 Mar 2012 05:36:25 +0000 (UTC)
Message-ID: <1331271383.6504.1.camel@neutron>
From: "Paul C. Bryan" <pbryan@anode.ca>
To: apps-discuss@ietf.org
Date: Thu, 08 Mar 2012 21:36:23 -0800
In-Reply-To: <9F0A2492-AE7D-4C12-8BB0-13489FD7F6C1@gmail.com>
References: <9F0A2492-AE7D-4C12-8BB0-13489FD7F6C1@gmail.com>
Content-Type: multipart/alternative; boundary="=-8BNeW29B3dl1uZ7gPejL"
X-Mailer: Evolution 3.2.2-1
Mime-Version: 1.0
Subject: Re: [apps-discuss] draft-pbryan-json-patch-04 - comments
X-BeenThere: apps-discuss@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: General discussion of application-layer protocols <apps-discuss.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/apps-discuss>
List-Post: <mailto:apps-discuss@ietf.org>
List-Help: <mailto:apps-discuss-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 09 Mar 2012 05:36:28 -0000

On Thu, 2012-03-08 at 13:46 -0800, Vadim Zaliva wrote:

> 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" }
> 	]
> }


I'd be interested in others' views on this.


> 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.


Yes, 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"
>    }


Thanks, I'll aim to add this to -02. (-01 should be out tomorrow.)

Paul