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

TianLinyi <tianlinyi@huawei.com> Thu, 01 December 2011 07:19 UTC

Return-Path: <tianlinyi@huawei.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 4990511E80A6 for <apps-discuss@ietfa.amsl.com>; Wed, 30 Nov 2011 23:19:33 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.599
X-Spam-Level:
X-Spam-Status: No, score=-6.599 tagged_above=-999 required=5 tests=[AWL=-0.001, 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 93mMovOMAiUg for <apps-discuss@ietfa.amsl.com>; Wed, 30 Nov 2011 23:19:32 -0800 (PST)
Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [119.145.14.64]) by ietfa.amsl.com (Postfix) with ESMTP id D110011E8080 for <apps-discuss@ietf.org>; Wed, 30 Nov 2011 23:19:31 -0800 (PST)
Received: from huawei.com (szxga05-in [172.24.2.49]) by szxga05-in.huawei.com (iPlanet Messaging Server 5.2 HotFix 2.14 (built Aug 8 2006)) with ESMTP id <0LVI0060XK9UEB@szxga05-in.huawei.com> for apps-discuss@ietf.org; Thu, 01 Dec 2011 15:17:55 +0800 (CST)
Received: from szxrg01-dlp.huawei.com ([172.24.2.119]) by szxga05-in.huawei.com (iPlanet Messaging Server 5.2 HotFix 2.14 (built Aug 8 2006)) with ESMTP id <0LVI007WMK9TRF@szxga05-in.huawei.com> for apps-discuss@ietf.org; Thu, 01 Dec 2011 15:17:54 +0800 (CST)
Received: from szxeml205-edg.china.huawei.com ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.1.9-GA) with ESMTP id AFL93546; Thu, 01 Dec 2011 15:17:24 +0800
Received: from SZXEML417-HUB.china.huawei.com (10.82.67.156) by szxeml205-edg.china.huawei.com (172.24.2.57) with Microsoft SMTP Server (TLS) id 14.1.323.3; Thu, 01 Dec 2011 15:17:19 +0800
Received: from SZXEML513-MBX.china.huawei.com ([169.254.8.59]) by szxeml417-hub.china.huawei.com ([10.82.67.156]) with mapi id 14.01.0218.012; Thu, 01 Dec 2011 15:17:15 +0800
Date: Thu, 01 Dec 2011 07:17:13 +0000
From: TianLinyi <tianlinyi@huawei.com>
In-reply-to: <CAPW_8m6v0wgQoMXzFFrA5bgjksWY-No3cmuJeFa1X6RJwOvctg@mail.gmail.com>
X-Originating-IP: [10.70.109.57]
To: mike amundsen <mamund@yahoo.com>, "Paul C. Bryan" <paul.bryan@forgerock.com>
Message-id: <3615F3CCD55F054395A882F51C6E5FDA1820A0A1@szxeml513-mbx.china.huawei.com>
MIME-version: 1.0
Content-type: multipart/alternative; boundary="Boundary_(ID_3byUGIe21Z7jU4mPqwgyLg)"
Content-language: zh-CN
Accept-Language: zh-CN, en-US
Thread-topic: [apps-discuss] JSON patch: "test" operation
Thread-index: AQHMr3PqiS1xzTn7t0aU/VYqf7sfw5XFIIsAgAAFBQCAAW1hgA==
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
X-CFilter-Loop: Reflected
References: <4ED64A26.5030003@gmx.de> <1322672952.2050.8.camel@neutron> <CAPW_8m6v0wgQoMXzFFrA5bgjksWY-No3cmuJeFa1X6RJwOvctg@mail.gmail.com>
Cc: IETF Apps Discuss <apps-discuss@ietf.org>
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: Thu, 01 Dec 2011 07:19:33 -0000

Hi, All

I think test would make it complicated. The test could result in <, >, <=, >=, = conditions.

If we want something like HTTP If-Match mechanism, I would think it should not be in the JSON patch. We should keep JSON patch simple. The status code is better to be delivered in the protocol layer who delivers the JSON patch document.

Cheers,
Linyi

From: apps-discuss-bounces@ietf.org [mailto:apps-discuss-bounces@ietf.org] On Behalf Of mike amundsen
Sent: Thursday, December 01, 2011 1:27 AM
To: Paul C. Bryan
Cc: IETF Apps Discuss
Subject: Re: [apps-discuss] JSON patch: "test" operation

Julian:

Is the thinking that _clients_ should tell servers to test an insert/update?  IOW, clients would want to see test results?  A "dry run" scenario?

Also, was there any talk about how servers would handle failed tests (HTTP Response code, etc.)? If one or more tests fail, would the server have the option of making the changes and then returning a list of success/fail information?


mca
http://amundsen.com/blog/
http://twitter.com@mamund
http://mamund.com/foaf.rdf#me



On Wed, Nov 30, 2011 at 12:09, Paul C. Bryan <paul.bryan@forgerock.com<mailto:paul.bryan@forgerock.com>> wrote:
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<mailto:apps-discuss@ietf.org>

https://www.ietf.org/mailman/listinfo/apps-discuss


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