Re: [Jsonpath] Robert Wilton's Discuss on draft-ietf-jsonpath-base-19: (with DISCUSS and COMMENT)
Greg Dennis <gregsdennis@yahoo.com> Wed, 27 September 2023 19:43 UTC
Return-Path: <gregsdennis@yahoo.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 C23FCC151556 for <jsonpath@ietfa.amsl.com>; Wed, 27 Sep 2023 12:43:23 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.104
X-Spam-Level:
X-Spam-Status: No, score=-2.104 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_BLOCKED=0.001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jHM9bbEzG_EQ for <jsonpath@ietfa.amsl.com>; Wed, 27 Sep 2023 12:43:19 -0700 (PDT)
Received: from sonic309-14.consmr.mail.bf2.yahoo.com (sonic309-14.consmr.mail.bf2.yahoo.com [74.6.129.124]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 949B8C14CEED for <jsonpath@ietf.org>; Wed, 27 Sep 2023 12:43:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1695843798; bh=oqaWKzjXi92w5iGp75vNctXosP2hlIibWA8HrZb4IZs=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From:Subject:Reply-To; b=tEDQvmGkOiuRNu09F2l3W2G+w2GDdeKGiZyy7p2YYLnOHKMerHUErt2vzEktul1K5r/tDM7GiAgdY6tulfhNeP8W426pnLCqfC6MSkEvLlEQBrpSKjcM3G5gvVYa3JYxpa+kNHWpSWCgZE5GV1hhwRqsNTff95G+c0DXtYqCiMZpmgaorakctt+28DLV8/WHM9WCDStbbncfC4CzuQGt7BI5k2/vQRt0F9nyMgJvxjQ6X03S/jfRm3aGJmKHsuAdDndmCgoBV18xbefyYnlYn/Yetj3o0k76F3sruysXvKZ+QkYYTdDhiJpDQ68b05LJRjSZMS7vS/uq3f8ew5zoMA==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1695843798; bh=I5VGPf+K5RG5aoBGqzOROgaAQDlDMe5AYbhkB8/+jw6=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=MRfk9CmHc9sy7u7LEa4Oeq87rbizgwhU+AUqG3W6P9HRl21lTPKULJjlVodNSs95LFKS3aFnS0eVmNhnylOhWQLljdu6wrOQnpQhHjVYVw/pUMNLL2Pnu4SdubGd/jwFG5cv9TA9xS/irginE9FCWVwVR1lxooD8SOAvIanSHXej/P0YGvDZZabDU7t5gXygRQyfTZQvND/K9yRmHonEKHhrZzyBR6JfeXK2YqbMWZSr97L1eA4nISpCKjhXMHOaLojHF/b7OIhrg1MdQniVJDJ75QKTnywxhM8rnS/9rKhgBOkVt2FF7lwmX3CNMdJ3kJR0F7efQccZKBmdt2qj7g==
X-YMail-OSG: _AGkRpc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uFePsjYNotTRNAdeuaqWof YPZ3WhEA8N39EoT6ez03PodBE.aErzR3aKF5BqMrlMYIUzalpI6gVIXP_ZVLwIKT1MposhvoubjV OWTJSVYBtdq69rFc6A23rHt_fKoRuvLxaUg--
X-Sonic-MF: <gregsdennis@yahoo.com>
X-Sonic-ID: ea01ca61-dd5b-41fa-bd94-f541164325ba
Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.bf2.yahoo.com with HTTP; Wed, 27 Sep 2023 19:43:18 +0000
Date: Wed, 27 Sep 2023 19:33:12 +0000
From: Greg Dennis <gregsdennis@yahoo.com>
To: Carsten Bormann <cabo@tzi.org>, "Rob Wilton (rwilton)" <rwilton@cisco.com>
Cc: The IESG <iesg@ietf.org>, "draft-ietf-jsonpath-base@ietf.org" <draft-ietf-jsonpath-base@ietf.org>, "jsonpath-chairs@ietf.org" <jsonpath-chairs@ietf.org>, "jsonpath@ietf.org" <jsonpath@ietf.org>, "tbray@textuality.com" <tbray@textuality.com>
Message-ID: <122205421.296943.1695843192551@mail.yahoo.com>
In-Reply-To: <BY5PR11MB4196096266BEEB2C76B85AF1B5C2A@BY5PR11MB4196.namprd11.prod.outlook.com>
References: <169287504874.28876.10595482216565365548@ietfa.amsl.com> <3B4C1E84-447F-4531-BC3C-402C6885E6EB@tzi.org> <BY5PR11MB41960432ABDC3B2666E59CB9B5EDA@BY5PR11MB4196.namprd11.prod.outlook.com> <AB52A02E-822C-47CD-8EF1-D51F73944C71@tzi.org> <1072726550.1115052.1695333880837@mail.yahoo.com> <BY5PR11MB4196096266BEEB2C76B85AF1B5C2A@BY5PR11MB4196.namprd11.prod.outlook.com>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----=_Part_296942_1015735094.1695843192542"
X-Mailer: WebService/1.1.21797 YMailNorrin
Archived-At: <https://mailarchive.ietf.org/arch/msg/jsonpath/ToJEd-RcCuJ_KX-D-xZOKNlqe3I>
Subject: Re: [Jsonpath] Robert Wilton's Discuss on draft-ietf-jsonpath-base-19: (with DISCUSS and COMMENT)
X-BeenThere: jsonpath@ietf.org
X-Mailman-Version: 2.1.39
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: Wed, 27 Sep 2023 19:43:23 -0000
The implicit cast doesn't have to do with the exists() function, but with the implications of what @.foo would mean if not an existence test.
In your "strict mode" which requires the use of exists() for existence testing, $[@.foo] would consider whether "foo" contains a "truthy" value. (It would have to be truthiness of some kind, whether that means any "non-empty"/non-zero value or only specifically JSON "true".) We explicitly opted against truthiness. We didn't have functions or the type system when we made that decision, but in hindsight, truthiness is basically an implicit cast from a ValueType to a LogicalType. (My experience, across multiple JSON extensions, is that trying to deal with truthiness just results in multiple headaches.)
More importantly, though, having an option on the implementation means that the same path could operate two different ways, which complicates determinism. $[@.foo] in strict mode returns a different result from the same path in non-strict mode. I think this would be frustrating for users. Carsten addressed this with
> My knee jerk reaction is that this splits JSONPath up a bit, into the strict version and a non-strict version, adding the need to constantly think about which version one addresses etc.
Greg
On Thursday, September 28, 2023 at 03:17:46 AM GMT+13, Rob Wilton (rwilton) <rwilton@cisco.com> wrote:
Hi Greg,
I’m not sure that I follow. I think that the only extra bit that would need to defined is the exists() function call. Wouldn’t this end up being defined as something:
exists() Function Extension:
Parameters:
- Nodelist
Result: LogicalType
Returns LogicalFalse if the nodelist parameter is empty, or LogicalFalse otherwise. The function is an explicit function equivalent to the implicit behaviour defined in section 2.3.5.2.1.
What is the implicit cast that would need to be defined?
Regards,
Rob
From: Greg Dennis <gregsdennis@yahoo.com>
Sent: Thursday, September 21, 2023 11:05 PM
To: Rob Wilton (rwilton) <rwilton@cisco.com>; Carsten Bormann <cabo@tzi.org>
Cc: The IESG <iesg@ietf.org>; draft-ietf-jsonpath-base@ietf.org; jsonpath-chairs@ietf.org; jsonpath@ietf.org; tbray@textuality.com
Subject: Re: [Jsonpath] Robert Wilton's Discuss on draft-ietf-jsonpath-base-19: (with DISCUSS and COMMENT)
> This would mean that tools could have a switch to enable or require a strict mode that requires the explicit exists() calls, or smart text editors could optionally put in the implicit strict() function call conversion.
It would also mean that we would have to define implicit casts from ValueType to LogicalType (which we have already explicitly decided against) to support "strict mode" evaluation of a path that contains implicit existence checks.
Greg
On Friday, September 22, 2023 at 09:13:28 AM GMT+12, Carsten Bormann <cabo@tzi.org> wrote:
Hi Rob,
Thank you for clearing the DISCUSS, and apologies for being mostly offline for another week.
>From the remaining items below, we have removed items that we think you indicated are covered.
> On 8. Sep 2023, at 16:17, Rob Wilton (rwilton) <rwilton=40cisco.com@dmarc.ietf.org> wrote:
>
> Hi Carsten, all,
>
> Sorry for the delay, your response collided with a week of PTO and then the IESG telechat.
>
> I will clear my discuss based on your proposed resolution below, but still have a couple of comments that I think that it would be good to discuss a bit further please.
>
> Please see inline …
>
> […]
>
>>> […]
>>> (1) p 12, sec 2.1. Overview
>>>
>>> Specifically, if a valid JSONPath query is evaluated
>>> against a structured value whose size does not fit in the range of
>>> exact values, interfering with the correct interpretation of the
>>> query, the implementation MUST provide an indication of overflow.
>>>
>>> I found this paragraph to be not particularly clear. Is this saying that using
>>> a value larger than 2^53 as an integer will cause problems?
>>
>> Now in PR #508:
>>
>>https://github.com/ietf-wg-jsonpath/draft-ietf-jsonpath-base/pull/508
>>
>> We hope this is now more readable.
> [Rob Wilton (rwilton)]
>
> This change resolves my discuss comment, but as a further comment (that you are free to ignore if you wish) possibly "exact integer values" might be even clearer and more precise.
Indeed. Added section reference to the I-JSON reference, too.
Now in PR #510:
https://github.com/ietf-wg-jsonpath/draft-ietf-jsonpath-base/pull/510
>>> ----------------------------------------------------------------------
>>> COMMENT:
>>> ----------------------------------------------------------------------
>>>
>>> Minor level comments:
>>>
>>> (4) p 10, sec 1.5. JSONPath Examples
>>>
>>> Table 2 shows some JSONPath queries that might be applied to this
>>> example and their intended results.
>>>
>>> Here, and in the table title below, it wasn't clear to me why it is "intended
>>> results" rather than just "results".
>>
>> Well, the result of the query is not "the authors of all books in the store”, but
>> probably more like
>>
>> "Nigel Rees"
>> "Evelyn Waugh"
>> "Herman Melville"
>> "J. R. R. Tolkien”
>>
>> So the “intended” was supposed to describe the intention that might be
>> behind this query, not the actual query result.
> [Rob Wilton (rwilton)]
>
> Okay. I had sort of read "intended results" as "hopefully your implementation returns something like", rather than the "your implementation must return something like", but it doesn't really matter.
We are happy with the way this is being said now.
>>> (7) p 18, sec 2.3.1.3. Examples
>>>
>>> Table 5: Name selector examples
>>>
>>> Various table list "Result Paths", but I presume that these are only intended
>>> to help make the specification clear, and are not returned (by a standard
>>> implementation). Would this be worth stating or clarifying?
>>
>> 2.1.2 Semantics (in 2.1 Overview) says about query results:
>>
>>>> Depending on the specific API, it might be presented as an array of the JSON
>> values at the nodes, an array of Normalized Paths referencing the nodes, or
>> both — or some other representation as desired by the implementation. Note:
>> an empty nodelist is a valid query result.
> [Rob Wilton (rwilton)]
>
> Ah, so this is an interesting comment, because I didn't get that from when reading the specification. When I read the specification, I got the impression that it is only the values that are returned and not the paths. Hence, please consider whether adding text to help clarify this would be worthwhile.
We believe this is covered in #section-2.1.2-4 [1], the first place that discusses how JSONPath query results might be presented in a specific API.
[1]:https://www.ietf.org/archive/id/draft-ietf-jsonpath-base-20.html#section-2.1.2-4
>>> (11) p 30, sec 2.3.5.2.1. Existence Tests
>>>
>>> * they work with queries that select structured values.
>>> To examine the value of a node selected by a query, an explicit
>>> comparison is necessary. For example, to test whether the node
>>> selected by the query @.foo has the value null, use @.foo == null
>>> (see Section 2.6) rather than the negated existence test!@.foo
>>> (which yields false if @.foo selects a node, regardless of the node's
>>> value).
>>>
>>> I presume that there is no way to change this, but from a correctness
>>> perspective, I wish that the existance check had to be explicit, (e.g., perhaps
>>> by a function call),
>>
>> The WG discussed several different ways to skin this cat, and what you see is
>> the result that slowly emerged.
>> We could replace existence tests with a function extension such as
>> exists(NodesType) that works similar to count(NodesType), but returns a
>> LogicalType.
>> People would then probably complain about the verbosity, now having to
>> write $.a[?exists(@.b)] instead of $.a[?@.b]
> [Rob Wilton (rwilton)]
>
> One suggestion here could to be define the exists() function, but still allow the existing implicit exists check. This would mean that tools could have a switch to enable or require a strict mode that requires the explicit exists() calls, or smart text editors could optionally put in the implicit strict() function call conversion.
>
> Would the authors/WG be amenable to that? Note - this isn't part of m discuss (because I hadn't raised it), but I think that this would be a good thing to do.
My knee jerk reaction is that this splits JSONPath up a bit, into the strict version and a non-strict version, adding the need to constantly think about which version one addresses etc. So I think this would indeed require discussion in the WG. I think that, since this function can easily be added later (function extensions are an extension point with a registry), we don’t have to complete such a discussion before moving forward with the document.
>>> to avoid the likely common mistake you describe above,
>>> particularly if the test is against a boolean value. Possibly giving the
>>> example for the boolean value case may also be helpful to be explicit here.
>>
>> A bit of an example is already in the text you cited above.
> [Rob Wilton (rwilton)]
>
> I was actually meaning to give an example for the problem case where the behaviour is not intuitive.
>
> E.g., in many programming languages the expressions "if (x) ..." and "if (x == true) ... " mean the same thing, but my understanding is that inboth XPath and JsonPath they don't, and hence having an example to highlight the necessity of an explicit boolean check will probably be helpful to folks surprised by the behaviour.
Not sure the example isn’t detracting a bit from the flow of 2.3.5.2.1, but I have added a short sentence to the end of #section-2.3.5.2.1-4
Now in PR #511:
https://github.com/ietf-wg-jsonpath/draft-ietf-jsonpath-base/pull/511
Grüße, Carsten
--
JSONpath mailing list
JSONpath@ietf.org
https://www.ietf.org/mailman/listinfo/jsonpath
- [Jsonpath] Robert Wilton's Discuss on draft-ietf-… Robert Wilton via Datatracker
- Re: [Jsonpath] Robert Wilton's Discuss on draft-i… Carsten Bormann
- Re: [Jsonpath] Robert Wilton's Discuss on draft-i… Rob Wilton (rwilton)
- Re: [Jsonpath] Robert Wilton's Discuss on draft-i… Carsten Bormann
- Re: [Jsonpath] Robert Wilton's Discuss on draft-i… Carsten Bormann
- Re: [Jsonpath] Robert Wilton's Discuss on draft-i… Greg Dennis
- Re: [Jsonpath] Robert Wilton's Discuss on draft-i… Rob Wilton (rwilton)
- Re: [Jsonpath] Robert Wilton's Discuss on draft-i… Rob Wilton (rwilton)
- Re: [Jsonpath] Robert Wilton's Discuss on draft-i… Carsten Bormann
- Re: [Jsonpath] Robert Wilton's Discuss on draft-i… Rob Wilton (rwilton)
- Re: [Jsonpath] Robert Wilton's Discuss on draft-i… Greg Dennis