Re: [apps-discuss] JSON patch: "test" operation

"Paul C. Bryan" <paul.bryan@forgerock.com> Wed, 30 November 2011 17:09 UTC

Return-Path: <paul.bryan@forgerock.com>
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 D4E8221F8BB9 for <apps-discuss@ietfa.amsl.com>; Wed, 30 Nov 2011 09:09:28 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.598
X-Spam-Level:
X-Spam-Status: No, score=-6.598 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-4]
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 P+xb7g5Plh9I for <apps-discuss@ietfa.amsl.com>; Wed, 30 Nov 2011 09:09:28 -0800 (PST)
Received: from eu1sys200aog115.obsmtp.com (eu1sys200aog115.obsmtp.com [207.126.144.139]) by ietfa.amsl.com (Postfix) with SMTP id A05D421F8BB7 for <apps-discuss@ietf.org>; Wed, 30 Nov 2011 09:09:27 -0800 (PST)
Received: from mail-iy0-f171.google.com ([209.85.210.171]) (using TLSv1) by eu1sys200aob115.postini.com ([207.126.147.11]) with SMTP ID DSNKTtZjPNthNL/ewprrafMKgsz+N2arWz5u@postini.com; Wed, 30 Nov 2011 17:09:27 UTC
Received: by mail-iy0-f171.google.com with SMTP id n33so617171iae.2 for <apps-discuss@ietf.org>; Wed, 30 Nov 2011 09:09:16 -0800 (PST)
Received: by 10.42.72.135 with SMTP id o7mr3985164icj.45.1322672956117; Wed, 30 Nov 2011 09:09:16 -0800 (PST)
Received: from [192.168.1.3] (S0106a021b762dbb3.vf.shawcable.net. [174.1.40.184]) by mx.google.com with ESMTPS id el2sm10089761ibb.10.2011.11.30.09.09.13 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 30 Nov 2011 09:09:14 -0800 (PST)
Message-ID: <1322672952.2050.8.camel@neutron>
From: "Paul C. Bryan" <paul.bryan@forgerock.com>
To: IETF Apps Discuss <apps-discuss@ietf.org>
Date: Wed, 30 Nov 2011 09:09:12 -0800
In-Reply-To: <4ED64A26.5030003@gmx.de>
References: <4ED64A26.5030003@gmx.de>
Content-Type: multipart/alternative; boundary="=-ukWJvETsZiKtRFvk50e/"
X-Mailer: Evolution 3.0.3-2
Mime-Version: 1.0
Subject: Re: [apps-discuss] JSON patch: "test" operation
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: Wed, 30 Nov 2011 17:09:28 -0000

Yes, assert/equals/test has been mentioned in the past. As you point
out, HTTP preconditions to handle this to some extent. I've avoided
adding it thus far mostly because I haven't had a single concrete use
case outside of HTTP. Given at least the pattern of multiple requests
wanting to test a value for equality, I think I have enough data to add
it to the next revision of the spec. Consider it added.

Paul 

On Wed, 2011-11-30 at 16:22 +0100, Julian Reschke wrote:

> Hi,
> 
> this came up during discussions of patch formats on the Apache 
> jackrabbit-dev mailing list:
> 
> Would it make sense to add a "test" operation that allows checking the 
> state of the JSON object to be modified?
> 
> It would be consistent with other diff formats that use context 
> information in order to check whether the patch "cleanly applies".
> 
> An example would be:
> 
>     [
>           { "test": "/vsn", "value" : 17 },
>           { "replace": "/vsn", "value" : 18 },
>           { "replace": "/balance", "value": 1234 }
>     ]
> 
> And yes, concurrency control can also be achieved using conditional HTTP 
> methods, but that doesn't mean that they don't make sense in the patch 
> format as well.
> 
> Best regards, Julian
> _______________________________________________
> apps-discuss mailing list
> apps-discuss@ietf.org
> https://www.ietf.org/mailman/listinfo/apps-discuss