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

Julian Reschke <julian.reschke@gmx.de> Wed, 30 November 2011 15:22 UTC

Return-Path: <julian.reschke@gmx.de>
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 8A17321F8B44 for <apps-discuss@ietfa.amsl.com>; Wed, 30 Nov 2011 07:22:37 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -102.524
X-Spam-Level:
X-Spam-Status: No, score=-102.524 tagged_above=-999 required=5 tests=[AWL=0.075, BAYES_00=-2.599, USER_IN_WHITELIST=-100]
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 urNnA+sHz3Lc for <apps-discuss@ietfa.amsl.com>; Wed, 30 Nov 2011 07:22:37 -0800 (PST)
Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.22]) by ietfa.amsl.com (Postfix) with SMTP id B3F3121F8B4D for <apps-discuss@ietf.org>; Wed, 30 Nov 2011 07:22:36 -0800 (PST)
Received: (qmail invoked by alias); 30 Nov 2011 15:22:23 -0000
Received: from mail.greenbytes.de (EHLO [192.168.1.140]) [217.91.35.233] by mail.gmx.net (mp038) with SMTP; 30 Nov 2011 16:22:23 +0100
X-Authenticated: #1915285
X-Provags-ID: V01U2FsdGVkX1/0eygzGh/0e60rJ90ZP9p+gCh5V7Oy0JPuZ83/8X zVFYzGuD9o/PsM
Message-ID: <4ED64A26.5030003@gmx.de>
Date: Wed, 30 Nov 2011 16:22:14 +0100
From: Julian Reschke <julian.reschke@gmx.de>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: IETF Apps Discuss <apps-discuss@ietf.org>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
X-Y-GMX-Trusted: 0
Subject: [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 15:22:37 -0000

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