Closed gregsdennis closed 1 year ago
If we extend the use of the type system in this way (any logical-expr
would be of type LogicalType
, possibly after implicit conversion from NodesType
), we should also roll out the other types across the spec.
Then any filter-query
would have type NodesType
and any comparable
would have type ValueType
.
This fixes a bug in the current spec which I've only just noticed. The match()
and search()
functions are assumed to be able to take Singular Queries, but as the spec is currently written, these would need converting to ValueType
using the value()
function.
Thanks. Updating jpt to the new semantics and running it over the spec to find inconsistencies was what I wanted to do over the weekend...
I can next work on implementing this issue on Saturday.
On Thu, 16 Mar 2023, 21:02 cabo, @.***> wrote:
Thanks. Updating jpt to the new semantics and running it over the spec to find inconsistencies was what I wanted to do over the weekend...
— Reply to this email directly, view it on GitHub https://github.com/ietf-wg-jsonpath/draft-ietf-jsonpath-base/issues/436#issuecomment-1472734958, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAXF2LQRLS3MNXRVJM2BSDW4N5XTANCNFSM6AAAAAAV5WBGJ4 . You are receiving this because you commented.Message ID: @.*** com>
PR #437 attempts to implement this issue using a point solution rather than attempting to roll out the type system across the whole spec.
Ref: https://github.com/ietf-wg-jsonpath/draft-ietf-jsonpath-base/pull/432#discussion_r1138257111
Currently
$[?bar(1==1)]
is not allowed. The argument is that we've not defined1==1
as resulting in aLogicalType
instance (an artifact of not extending the type system to the whole expression), but I don't really see a problem with allowing it. It's pretty intuitive.I can see applications where you'd want an argument to a function to be whether a location in a path is a certain value, e.g.
$[?bar(@.a==1)]
. Anif(condition, value-if-true, value-if-false)
function could work this way.