Re: [apps-discuss] Should this patch succeed?

"Paul C. Bryan" <pbryan@anode.ca> Tue, 12 March 2013 20:05 UTC

Return-Path: <pbryan@anode.ca>
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 1C7A811E8149 for <apps-discuss@ietfa.amsl.com>; Tue, 12 Mar 2013 13:05:57 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.598
X-Spam-Level:
X-Spam-Status: No, score=-2.598 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, HTML_MESSAGE=0.001]
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 N3C4QWItZv-H for <apps-discuss@ietfa.amsl.com>; Tue, 12 Mar 2013 13:05:55 -0700 (PDT)
Received: from maple.anode.ca (maple.anode.ca [72.14.183.184]) by ietfa.amsl.com (Postfix) with ESMTP id 7F3BC11E8122 for <apps-discuss@ietf.org>; Tue, 12 Mar 2013 13:05:53 -0700 (PDT)
Received: from [10.126.22.27] (nat-204-14-239-210-sfo.net.salesforce.com [204.14.239.210]) by maple.anode.ca (Postfix) with ESMTPSA id 98D7DEA021; Tue, 12 Mar 2013 20:05:51 +0000 (UTC)
From: "Paul C. Bryan" <pbryan@anode.ca>
To: Francis Galiegue <fgaliegue@gmail.com>
In-Reply-To: <CALcybBDsSpT24QeY_bE48cyp8dR5gGcBd32ev5--3EWh2RoNHw@mail.gmail.com>
References: <CALcybBDsSpT24QeY_bE48cyp8dR5gGcBd32ev5--3EWh2RoNHw@mail.gmail.com>
Content-Type: multipart/alternative; boundary="=-z3r2P9nDduOhInYvm0Zq"
Date: Tue, 12 Mar 2013 13:05:46 -0700
Message-ID: <1363118746.358.3.camel@pbryan-wsl.internal.salesforce.com>
Mime-Version: 1.0
X-Mailer: Evolution 2.28.3
Cc: Mark Nottingham <mnot@mnot.net>, apps-discuss@ietf.org
Subject: Re: [apps-discuss] Should this patch succeed?
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, 12 Mar 2013 20:05:57 -0000

Yes, it should succeed.

Before .../- came along, the way to add to end of the array was to
specify an index equal to the number of elements in the array. This is
why it was phrased as such.

Paul

On Tue, 2013-03-12 at 21:03 +0100, Francis Galiegue wrote:

> On Tue, Mar 12, 2013 at 4:44 PM, Francis Galiegue <fgaliegue@gmail.com> wrote:
> > On Tue, Mar 12, 2013 at 3:56 PM, Mark Nottingham <mnot@mnot.net> wrote:
> >> Test cases are still more than welcome:
> >>   https://github.com/json-patch/json-patch-tests
> >>
> 
> One test reads something akin to this:
> 
> [ { "op": "add", "path": "/0", "value": 1 } ]
> 
> With input [], it is expected to give output [ 1 ].
> 
> However the spec says:
> 
>       [... ]The specified index MUST NOT be greater than the
>       number of elements in the array.  If the "-" character is used to
>       index the end of the array (see [JSON-Pointer]), this has the
>       effect of appending the value to the array.
> 
> Strictly speaking, here the 0 in "/0" is not strictly greater than the
> number of elements but it is an element which does not exist. And it
> would seem that "/-" is the recommended approach here.
> 
> So, should this patch succeed? Was it the real intent of the text, or
> was is meant to be "the specified index MUST refer to an existing
> index in the array. If the character is" etc etc?
> 
> --
> Francis Galiegue, fgaliegue@gmail.com
> JSON Schema in Java: http://json-schema-validator.herokuapp.com