Re: [Jsonpath] Remarks on the array slice operator described in https://jsonpath-standard.github.io/internet-draft/#name-array-selector-2

Tim Bray <tbray@textuality.com> Tue, 08 December 2020 21:35 UTC

Return-Path: <tbray@textuality.com>
X-Original-To: jsonpath@ietfa.amsl.com
Delivered-To: jsonpath@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id A29FE3A11ED for <jsonpath@ietfa.amsl.com>; Tue, 8 Dec 2020 13:35:44 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.898
X-Spam-Level:
X-Spam-Status: No, score=-1.898 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=textuality-com.20150623.gappssmtp.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0eAmoohKZvcX for <jsonpath@ietfa.amsl.com>; Tue, 8 Dec 2020 13:35:42 -0800 (PST)
Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5CBB73A11D8 for <jsonpath@ietf.org>; Tue, 8 Dec 2020 13:35:42 -0800 (PST)
Received: by mail-lf1-x12b.google.com with SMTP id b4so341611lfo.6 for <jsonpath@ietf.org>; Tue, 08 Dec 2020 13:35:42 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=textuality-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cfHdIIF1QPAaXOEPqX9x6rOFlOwOv1Q+hd9zAwy6KmM=; b=bKUKf1wDke8evpXu9CWss/nJlAPc4QIu4R6HUp+adaPoje7c8zighPj3oCyfjEIfQC NftEFB3PK4sDI5KNQmRCpkNW4Kl4T+++dThB58YjNoL9eK/p1sMaVQ6xyPWojd1OFsq0 iFdTQyZhndjQay9zs8DWmFiJJ7kaPW+8utXnHj/bA+iEeUf5gjEQibRY9BZemGG+sar2 ifFmsJK4kDa3R+Z1n/YDptPqLDAZsBxHyw+4jQCOFTiqPDVEO91PgjlQHVDutppBw7cY gv6vmUrZaS8n4k6qGaFG4CIFQdTLlPl4OZSkxm+Lc8cDKiHEQLA621+pb54it+QDKPDN Ai1A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cfHdIIF1QPAaXOEPqX9x6rOFlOwOv1Q+hd9zAwy6KmM=; b=ojVjETIP+zWrOHgBew6EJ7UiqRO8w73W/Sl4lCYYd2lPWzs+2pu1nkSMkabSV2C1mr I6XEx/bIfHl+8DFWAgBTrcLEtMG5mMf7IaeQEuUeAl5S0CACMXz4ocD1Xc8Ez3wlAdXr mWTh5c0v3QzguR34pTpzjsDISjlgIIOlxzG/OZQtOJbG3MS5Yy077xcZKl1LeCn+ZqII g+Mvh1g0R+N+tyhaPbcNCUqGoFSfH5d0iL6OIzJ4Q3o+R6mccRQ1/3WmlsKVzfwGKGx+ gXa9J6gau9KjxMuD+7vNRwUyl9u7ctwqhVluofT0tUTCdhqeagsocWinsAFcLpb0j4Po 3VdA==
X-Gm-Message-State: AOAM532/rfHIOvEm9ZoImXm6RRx/rqpxRKhpMoYu1dAeP5zokR3Mqpzl TdOE1K19GsBe4M/O1qdLX9AztxI6T/nJTIey72kJPA==
X-Google-Smtp-Source: ABdhPJxz5zl3/mkvmNsD3p3C07d0/X1H2hhCAJQ+KGMqI+vk0p92bBSQYUhsjKNWoWRgcHPlpKJEClB5OOUXlcaHqOE=
X-Received: by 2002:ac2:5f63:: with SMTP id c3mr301370lfc.451.1607463340066; Tue, 08 Dec 2020 13:35:40 -0800 (PST)
MIME-Version: 1.0
References: <CA+mwktL4Lio1FKD+20K0rvqb8De9GQomaJy1F+cct=pj_Ft4VQ@mail.gmail.com> <89140FFF-6B25-4ABC-8A25-92327B1313F3@gmail.com> <E59DC723-B9A9-4A03-A3A9-0036DE6F7940@gmail.com> <CANH0GbJEk-RS_QNM_ZM78KCRv+QRUcFK8=oBxQgNtbW1zLLAvA@mail.gmail.com> <FAB83C6B-C878-4ECC-B392-2261A2B70477@saxonica.com> <CA+mwktKCyuga6LBWDFON8tiUiCdyfo6ica1=QdtQftwY+pwgbA@mail.gmail.com> <4E655650-9595-4280-9F1B-0440CA12E12F@tzi.org>
In-Reply-To: <4E655650-9595-4280-9F1B-0440CA12E12F@tzi.org>
From: Tim Bray <tbray@textuality.com>
Date: Tue, 08 Dec 2020 13:35:28 -0800
Message-ID: <CAHBU6itpM6q3ZXtAi=X-tQz7m-6yyoBL0BKijDe9WqYDmnm80g@mail.gmail.com>
To: Carsten Bormann <cabo@tzi.org>
Cc: Daniel P <danielaparker@gmail.com>, jsonpath@ietf.org, Glyn Normington <glyn.normington.work@gmail.com>, Michael Kay <mike@saxonica.com>
Content-Type: multipart/alternative; boundary="0000000000005fe12705b5fab92c"
Archived-At: <https://mailarchive.ietf.org/arch/msg/jsonpath/AgIMxdQd43y6YPMBEJcZ0KciTGU>
Subject: Re: [Jsonpath] Remarks on the array slice operator described in https://jsonpath-standard.github.io/internet-draft/#name-array-selector-2
X-BeenThere: jsonpath@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: A summary description of the list to be included in the table on this page <jsonpath.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/jsonpath>, <mailto:jsonpath-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/jsonpath/>
List-Post: <mailto:jsonpath@ietf.org>
List-Help: <mailto:jsonpath-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/jsonpath>, <mailto:jsonpath-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 08 Dec 2020 21:35:52 -0000

I agree with Carmen.  One of the big problems we had at AWS is that
JSONPaths could be provided as arguments to our APIs and we really wanted
to give a helpful error if they were syntactically malformed and also if
they obviously could never produce a useful result.  The first was possible
(although we didn't do a very good job).  If Glyn's code (maybe it already
does?) included a JSONPath syntax checker and linter, that would be super
useful to the community.

On Tue, Dec 8, 2020 at 1:09 PM Carsten Bormann <cabo@tzi.org> wrote:

> On 2020-12-08, at 20:46, Daniel P <danielaparker@gmail.com> wrote:
> >
> > What about
> >
> > result = search(json_instance, "#$@&%*! is that?");
> >
> > If a JSONPath expression can't be parsed according to syntactical rules,
> would
> > "some kind of fallback behaviour" ever be helpful to a user?
>
> No.  This should break with a loud bang.
>
> > I can see
> > returning
> > "no results" if an otherwise valid expression cannot be evaluated
> against the
> > provided JSON instance, which many implementations do.
>
> That is what I meant, a query expression should be valid or invalid, but
> that should not depend on what argument you are using that against.
>
> An implementation should never silently accept a query expression it has
> found invalid.  (Importantly, I didn’t say it needs to implement every
> single validity test, just that it should break violently when one of those
> fails that it does implement.)
>
> Grüße, Carsten
>
> --
> Jsonpath mailing list
> Jsonpath@ietf.org
> https://www.ietf.org/mailman/listinfo/jsonpath
>