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

TianLinyi <> Thu, 01 December 2011 07:19 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 4990511E80A6 for <>; Wed, 30 Nov 2011 23:19:33 -0800 (PST)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -6.599
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 ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id 93mMovOMAiUg for <>; Wed, 30 Nov 2011 23:19:32 -0800 (PST)
Received: from ( []) by (Postfix) with ESMTP id D110011E8080 for <>; Wed, 30 Nov 2011 23:19:31 -0800 (PST)
Received: from (szxga05-in []) by (iPlanet Messaging Server 5.2 HotFix 2.14 (built Aug 8 2006)) with ESMTP id <> for; Thu, 01 Dec 2011 15:17:55 +0800 (CST)
Received: from ([]) by (iPlanet Messaging Server 5.2 HotFix 2.14 (built Aug 8 2006)) with ESMTP id <> for; Thu, 01 Dec 2011 15:17:54 +0800 (CST)
Received: from ([]) by (MOS 4.1.9-GA) with ESMTP id AFL93546; Thu, 01 Dec 2011 15:17:24 +0800
Received: from ( by ( with Microsoft SMTP Server (TLS) id 14.1.323.3; Thu, 01 Dec 2011 15:17:19 +0800
Received: from ([]) by ([]) 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 <>
In-reply-to: <>
X-Originating-IP: []
To: mike amundsen <>, "Paul C. Bryan" <>
Message-id: <>
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-CFilter-Loop: Reflected
References: <> <1322672952.2050.8.camel@neutron> <>
Cc: IETF Apps Discuss <>
Subject: Re: [apps-discuss] JSON patch: "test" operation
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: General discussion of application-layer protocols <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-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.


From: [] 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


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?


On Wed, Nov 30, 2011 at 12:09, Paul C. Bryan <<>> 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.


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


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 mailing list<>