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

Mike Acar <macar@cloudmark.com> Tue, 20 March 2012 23:38 UTC

Return-Path: <macar@cloudmark.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 7CC3921F854B for <apps-discuss@ietfa.amsl.com>; Tue, 20 Mar 2012 16:38:00 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599]
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 yw5ivf7+wmBQ for <apps-discuss@ietfa.amsl.com>; Tue, 20 Mar 2012 16:38:00 -0700 (PDT)
Received: from ht1-outbound.cloudmark.com (ht1-outbound.cloudmark.com [72.5.239.25]) by ietfa.amsl.com (Postfix) with ESMTP id 1131021F8546 for <apps-discuss@ietf.org>; Tue, 20 Mar 2012 16:38:00 -0700 (PDT)
Received: from [172.20.2.21] (172.20.2.21) by exch-htcas901.corp.cloudmark.com (172.22.10.73) with Microsoft SMTP Server (TLS) id 14.1.355.2; Tue, 20 Mar 2012 16:37:59 -0700
Message-ID: <4F6914D7.5050505@cloudmark.com>
Date: Tue, 20 Mar 2012 16:37:59 -0700
From: Mike Acar <macar@cloudmark.com>
User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2
MIME-Version: 1.0
To: apps-discuss@ietf.org
References: <9F0A2492-AE7D-4C12-8BB0-13489FD7F6C1@gmail.com> <1331271383.6504.1.camel@neutron> <4F5E6255.9040402@cloudmark.com> <1331651889.3301.5.camel@neutron>
In-Reply-To: <1331651889.3301.5.camel@neutron>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
X-Originating-IP: [172.20.2.21]
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: Tue, 20 Mar 2012 23:38:00 -0000

On 03/13/2012 08:18 AM, Paul C. Bryan wrote:
> On Mon, 2012-03-12 at 13:53 -0700, Mike Acar wrote:
>
>> I'm unsure about test as well. It seems strange to me to express "change
>> this document if it looks like this" in a patch; if the application
>> creating the patch doesn't know how the document looks, how can it
>> create a patch?
>
> I'm surprised that it seems so strange, as this is very much like how
> text-based diff/patches work.

But in diff, the "test" is not optional. The diff (AFAIK anyway) always 
expresses "replace this with that". Patch doesn't.

So I guess I should say it's the optionality that makes it a bit weird 
to me - mixing tested and not-tested operations. When would that make sense?

I'm not yet convinced it's a problem, but I wonder about the desired 
semantics and if this is sufficient to get them. For example, I can see 
that test combined with Patch's atomicity could be useful, but it seems 
like it can't protect you from race conditions. Maybe it's sufficient 
for some use cases, though.

> It allows assumptions about the state of the resource being modified
> to be a precondition to successfully modifying the resource. With
> HTTP, it's ideal if precondition headers be used, but this is not
> always feasible, nor is HTTP the only avenue for using JSON Patch.

Mhm.

>> Paul, is there an archived discussion of the "test" operation,
>> particularly regarding use cases?
>
> This was originally discussed on the JSON Patch Google Group discussion.

I've read some of the archives, but not all, so I'll have another look 
through them for this discussion.

-- 
Mike Acar -                                 - macar at cloudmark dot com