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

"David J. Biesack" <David.Biesack@sas.com> Fri, 14 December 2012 17:13 UTC

Return-Path: <David.Biesack@sas.com>
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 44B6621F855B for <ietf@ietfa.amsl.com>; Fri, 14 Dec 2012 09:13:31 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.044
X-Spam-Level:
X-Spam-Status: No, score=-3.044 tagged_above=-999 required=5 tests=[AWL=0.555, BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1]
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 CrJLxiXMEhju for <ietf@ietfa.amsl.com>; Fri, 14 Dec 2012 09:13:29 -0800 (PST)
Received: from am1outboundpool.messaging.microsoft.com (am1ehsobe004.messaging.microsoft.com [213.199.154.207]) by ietfa.amsl.com (Postfix) with ESMTP id 64F0621F8467 for <ietf@ietf.org>; Fri, 14 Dec 2012 09:13:16 -0800 (PST)
Received: from mail70-am1-R.bigfish.com (10.3.201.247) by AM1EHSOBE005.bigfish.com (10.3.204.25) with Microsoft SMTP Server id 14.1.225.23; Fri, 14 Dec 2012 17:13:15 +0000
Received: from mail70-am1 (localhost [127.0.0.1]) by mail70-am1-R.bigfish.com (Postfix) with ESMTP id 66E8E3E028F for <ietf@ietf.org>; Fri, 14 Dec 2012 17:13:15 +0000 (UTC)
X-Forefront-Antispam-Report: CIP:149.173.6.149; KIP:(null); UIP:(null); IPV:NLI; H:mercav05r.na.sas.com; RD:mercav05r.na.sas.com; EFVD:NLI
X-SpamScore: 0
X-BigFish: S0(zzzz1de0h1202h1e76h1d1ah1d2ahzz18602eh8275bhz2fh2a8h668h839h944hcf6hd24hf0ah1220h1288h12a5h12a9h12bdh137ah13b6h1441h1504h1537h153bh162dh1631h1758h1155h)
Received-SPF: pass (mail70-am1: domain of sas.com designates 149.173.6.149 as permitted sender) client-ip=149.173.6.149; envelope-from=David.Biesack@sas.com; helo=mercav05r.na.sas.com ; r.na.sas.com ;
Received: from mail70-am1 (localhost.localdomain [127.0.0.1]) by mail70-am1 (MessageSwitch) id 1355505193673164_18133; Fri, 14 Dec 2012 17:13:13 +0000 (UTC)
Received: from AM1EHSMHS017.bigfish.com (unknown [10.3.201.230]) by mail70-am1.bigfish.com (Postfix) with ESMTP id A28172C03D1 for <ietf@ietf.org>; Fri, 14 Dec 2012 17:13:13 +0000 (UTC)
Received: from mercav05r.na.sas.com (149.173.6.149) by AM1EHSMHS017.bigfish.com (10.3.207.155) with Microsoft SMTP Server (TLS) id 14.1.225.23; Fri, 14 Dec 2012 17:13:13 +0000
X-TM-IMSS-Message-ID: <9aa92e5e0021db26@mercav05r.na.sas.com>
Received: from d72933.na.sas.com.na.sas.com ([10.23.16.81]) by mercav05r.na.sas.com ([10.16.10.186]) with ESMTP (TREND IMSS SMTP Service 7.1) id 9aa92e5e0021db26 ; Fri, 14 Dec 2012 12:13:10 -0500
From: "David J. Biesack" <David.Biesack@sas.com>
To: ietf@ietf.org
Subject: Re: Last Call: <draft-ietf-appsawg-json-patch-08.txt> (JSON Patch) to Proposed Standard
Date: Fri, 14 Dec 2012 12:13:07 -0500
Message-ID: <p1sj78lfq4.fsf@d72933.na.sas.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
X-OriginatorOrg: sas.com
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: Fri, 14 Dec 2012 18:15:14 -0000

"4.1 add" and "4.2 remove" refers to "specified index", but I do not see name of the index member specified in the draft, or how to represent it.
(Other sections are more explicit, i.e. "from" for the "move" op.)

i.e. "index" as in 

  "index" : integer 

The phrasing 

   If the "-" character is used to index the end of the array, this has the effect of appending the value to the array.

is not clear. Where does this "-" character appear? Does one use just

  "index" : "-" 

in which case the spec should be 

  If the "-" string is used ...

If instead you mean a negative integer, i.e.

  "index" : negative-integer

and not just "-", does the spec interpret all negative integers to indicate appending to the end?

I'd prefer the value not have two separate types, integer vs. string.

Suggestion: allow negative numbers to indicate a position counted from the end of the array i.e. -1 to append, -2 to insert before the last item, and so on. E.g. after appending to an array of length l at i < 0, the item will be at the zero-based index (l + 1) + i. Error if |i| > l

E.g. given the document with an array of length 4:

{ "a" : [ 0, 1, 2, 3, ] }

then 

{ "op" : "add", "path" : "a", "value" : 99, "index" : -1 }

yields

{ "a" : [ 0, 1, 2, 3, 99] }

i.e. 99 is found at (4 + 1) -1 == 4

{ "op" : "add", "path" : "a", "value" : 99, "index" : -2 }

yields

{ "a" : [ 0, 1, 2, 99, 3] }

i.e. 99 is found at (4 + 1) -2 == 3

and finally

{ "op" : "add", "path" : "a", "value" : 99, "index" : -5 }

yields

{ "a" : [ 99, 0, 1, 2,, 3] }

i.e. 99 is found at (4 + 1) -5 == 0

-- 
David J. Biesack | Principal API Architect, SAS | @davidbiesack | 919-531-7771 | www.sas.com