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

Mark Nottingham <mnot@mnot.net> Mon, 17 December 2012 04:00 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 762B521F88CF for <ietf@ietfa.amsl.com>; Sun, 16 Dec 2012 20:00:11 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -103.854
X-Spam-Level:
X-Spam-Status: No, score=-103.854 tagged_above=-999 required=5 tests=[AWL=-1.255, 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 kkwJ3PemBDWN for <ietf@ietfa.amsl.com>; Sun, 16 Dec 2012 20:00:10 -0800 (PST)
Received: from mxout-08.mxes.net (mxout-08.mxes.net [216.86.168.183]) by ietfa.amsl.com (Postfix) with ESMTP id 911EF21F88C4 for <ietf@ietf.org>; Sun, 16 Dec 2012 20:00:10 -0800 (PST)
Received: from [192.168.1.80] (unknown [118.209.33.170]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTPSA id 103F8509B6; Sun, 16 Dec 2012 23:00:08 -0500 (EST)
Content-Type: text/plain; charset="us-ascii"
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: <p1r4mslf23.fsf@d72933.na.sas.com>
Date: Mon, 17 Dec 2012 15:00:05 +1100
Content-Transfer-Encoding: quoted-printable
Message-Id: <61917A76-B4BD-4207-8C21-DEAE7BF255D8@mnot.net>
References: <p1r4mslf23.fsf@d72933.na.sas.com>
To: "David J. Biesack" <David.Biesack@sas.com>
X-Mailer: Apple Mail (2.1499)
Cc: ietf@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: Mon, 17 Dec 2012 04:00:11 -0000

On 15/12/2012, at 4:27 AM, David J. Biesack <David.Biesack@sas.com> wrote:

> 
> Can one add elements of array to an array? 
> 
> E.g. given the document
> 
> { "a" : { "b" : [ "red", "green" ] } }
> 
> If I want to add two values to an existing array, I can use
> 
> [
> { "op": "add", "path": "/a/b/-", "value": "blue" },
> { "op": "add", "path": "/a/b/-", "value": "yellow" }
> ]
> 
> (I found in the examples how an array index is specified in the path, not in a separate "index" member;
> I guess my comments there should be directed at draft-ietf-appsawg-json-pointer-06 )
> 
> However, for appending to arrays, I would like to use
> 
> [ { "op": "add", "path": "/a/b/-", "value": [ "blue", "yellow" ] } ]
> 
> Reading the spec literally, I expect that this will yield
> 
> { "a" : { "b" : [ "red", "green", [ "blue", "yellow" ] ] } }

Exactly.

> instead of the desired
> 
> { "a" : { "b" : [ "red", "green", "blue", "yellow" ] } }
> 
> I suggest the semantics of this case should be explicit, to avoid unexpected surprises.

I've added an example to clarify this; thanks.



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