Re: Last Call: <draft-ietf-appsawg-json-patch-08.txt> (JSON Patch) to Proposed Standard

Mark Nottingham <mnot@mnot.net> Wed, 12 December 2012 00:31 UTC

Return-Path: <mnot@mnot.net>
X-Original-To: ietf@ietfa.amsl.com
Delivered-To: ietf@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D02C321F8898; Tue, 11 Dec 2012 16:31:44 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -104.036
X-Spam-Level:
X-Spam-Status: No, score=-104.036 tagged_above=-999 required=5 tests=[AWL=-1.437, BAYES_00=-2.599, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vWOB-cxYOSpe; Tue, 11 Dec 2012 16:31:44 -0800 (PST)
Received: from mxout-07.mxes.net (mxout-07.mxes.net [216.86.168.182]) by ietfa.amsl.com (Postfix) with ESMTP id 269D211E80A3; Tue, 11 Dec 2012 16:31:43 -0800 (PST)
Received: from mnot-mini.mnot.net (unknown [118.209.242.191]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTPSA id 30D0022E1F4; Tue, 11 Dec 2012 19:31:36 -0500 (EST)
Content-Type: text/plain; charset="iso-8859-1"
Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\))
Subject: Re: Last Call: <draft-ietf-appsawg-json-patch-08.txt> (JSON Patch) to Proposed Standard
From: Mark Nottingham <mnot@mnot.net>
In-Reply-To: <CALaySJ+BMsBJt7wWHN90itdPcqUqSd0gMh_YzmHZpN=8jcKJJA@mail.gmail.com>
Date: Wed, 12 Dec 2012 11:31:39 +1100
Content-Transfer-Encoding: quoted-printable
Message-Id: <82A453F8-9F1A-4427-B238-A63B43447F21@mnot.net>
References: <20121211150005.28209.96763.idtracker@ietfa.amsl.com> <CAC4RtVBNxQu03hZxFZiRg-7s2G_KYKFJjUUvSC_UUFwE_FZFdg@mail.gmail.com> <3448719B-185A-476A-A927-25A68D4B4358@mnot.net> <CALaySJ+BMsBJt7wWHN90itdPcqUqSd0gMh_YzmHZpN=8jcKJJA@mail.gmail.com>
To: Barry Leiba <barryleiba@computer.org>
X-Mailer: Apple Mail (2.1499)
Cc: IETF discussion list <ietf@ietf.org>, "apps-discuss@ietf.org" <apps-discuss@ietf.org>
X-BeenThere: ietf@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: IETF-Discussion <ietf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ietf>, <mailto:ietf-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/ietf>
List-Post: <mailto:ietf@ietf.org>
List-Help: <mailto:ietf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ietf>, <mailto:ietf-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 12 Dec 2012 00:31:45 -0000

So, do you have a suggestion?


On 12/12/2012, at 11:24 AM, Barry Leiba <barryleiba@computer.org> wrote:

>> "add" has the semantics of "make the value *this*".
> 
> Yeh, I guess the problem I have with that is that that's not the
> semantics most of us attach to the concept of "add a thing to a set".
> And it bothers me that "add to an object" and "add to an array" have
> different semantics.
> 
> That difference is unsettling.  It's OK to have "add" on an array have
> the semantics of "insert", especially because there's no "insert"
> action.  But having "add" on an object have the semantics of "replace"
> seems bad, partly because it's inconsistent with the semantics it has
> on an array and because there's already a "replace" action.
> 
> If I have { "baz": "qux", "foo": "bar" }, these two do exactly the same thing:
> 
> case 1a: [{ "op": "add", "path": "/baz", "value": "blarg" }]
> 
> case 1b: [{ "op": "replace", "path": "/baz", "value": "blarg" }]
> 
> Both result in { "baz": "blarg", "foo": "bar" }
> 
> While these are different:
> 
> case 2a: [{ "op": "add", "path": "/hah", "value": "blarg" }]
> 
> case 2b: [{ "op": "replace", "path": "/hah", "value": "blarg" }]
> 
> Case 2a results in { "baz": "blarg", "foo": "bar", "hah": "blarg" },
> and 2b is an error.
> 
> Case 1 just seems wrong.  The "add" in 1a should be an error, and then
> life would make sense.
> 
> 
>> As has already been mentioned, there are multiple tools in the box.
> 
> Stretching the analogy, having the wrench act as a hammer in some
> cases does not make for a particularly well defined, robust tool box.
> 
> Barry

--
Mark Nottingham   http://www.mnot.net/