Re: [apps-discuss] Ultimate and penultimate array references with json-pointers?

Mark Nottingham <mnot@mnot.net> Mon, 11 March 2013 13:44 UTC

Return-Path: <mnot@mnot.net>
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 A612F21F8522 for <apps-discuss@ietfa.amsl.com>; Mon, 11 Mar 2013 06:44:34 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -102.599
X-Spam-Level:
X-Spam-Status: No, score=-102.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, USER_IN_WHITELIST=-100]
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 FJGh85VyCMTe for <apps-discuss@ietfa.amsl.com>; Mon, 11 Mar 2013 06:44:34 -0700 (PDT)
Received: from mxout-07.mxes.net (mxout-07.mxes.net [216.86.168.182]) by ietfa.amsl.com (Postfix) with ESMTP id 5FFA021F8480 for <apps-discuss@ietf.org>; Mon, 11 Mar 2013 06:44:23 -0700 (PDT)
Received: from [172.30.21.201] (unknown [72.246.0.14]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTPSA id CF5D222E259; Mon, 11 Mar 2013 09:44:16 -0400 (EDT)
Content-Type: text/plain; charset="us-ascii"
Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\))
From: Mark Nottingham <mnot@mnot.net>
In-Reply-To: <397B382EC2E6D9479F9A5D6D050FB70747A8663E@WO-SFOEXCH-02.wideorbit.com>
Date: Mon, 11 Mar 2013 09:44:15 -0400
Content-Transfer-Encoding: quoted-printable
Message-Id: <84ADC755-04EC-43B6-8F1E-417FC297BE1E@mnot.net>
References: <397B382EC2E6D9479F9A5D6D050FB70747A8663E@WO-SFOEXCH-02.wideorbit.com>
To: Steffen Yount <syount@wideorbit.com>
X-Mailer: Apple Mail (2.1499)
Cc: Kris Zyp <kris@sitepen.com>, "apps-discuss@ietf.org" <apps-discuss@ietf.org>
Subject: Re: [apps-discuss] Ultimate and penultimate array references with json-pointers?
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: Mon, 11 Mar 2013 13:44:34 -0000

Hi Steffen,

JSON Pointer is already in the RFC Editor queue, so it's too late to make this sort of change.

Cheers,


On 10/03/2013, at 4:52 AM, Steffen Yount <syount@wideorbit.com> wrote:

> Hi Paul, Kris, & Mark,
> 
> I'm working on a json-hyper-schema integration that relies on json-pointers where I want a single json-pointer value that can reference the last or possibly second to last item in a variable length JSON array.
> 
> Unfortunately, the json-pointer definition as-is has no built-in mechanism to support this kind of tail-offset array reference.
> 
> Would it be possible to modify the "draft-ietf-appsawg-json-pointer" I-D to support negative values as array-indexes where a value (-x) would be semantically equivalent to the positive index value (array.length - x)?
> 
> Example references for the last and second to last elements could look like:
>    "/foo/-1"     "baz"
>    "/foo/-2"     "bar"
>    #/foo/-1      "baz"
>    #/foo/-2      "bar"
> 
> 
> The new wording for the JSON Array evaluation section could look like:
> 
> 
>   o  If the currently referenced value is a JSON array, the reference
>      token MUST contain either:
> 
>      *  characters representing a positive base-10 integer value (see 
>         ABNF below; note that leading zeros are not allowed), making 
>         the new referenced value the array element identified by the 
>         zero-based index value in the token, or
> 
>      *  characters representing a negative base-10 integer value, 
>         making the new referenced value the array element identified 
>         by the zero-based index value found by adding the negative
>         token value to the count of elements in the array, or
> 
>      *  exactly the single character "-", making the new referenced
>         value the (non-existent) member after the last array element.
> 
>   The ABNF syntax for array indices is:
> 
>   array-index = %x30 / ( *(%x2D) %x31-39 *(%x30-39) ) / %x2D
>                 ; "0", a signed integer without a leading "0", or "-"
> 
> 
> 
> Yes? No? Your thoughts?
> 
> Thanks for your consideration,
> -Steffen

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