-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
key missing vs key present with null #118
Comments
I think the corresponding test in the comparison project is https://cburgmer.github.io/json-path-comparison/results/filter_expression_with_equals_null.html. Currently no consensus exists. |
I think this is related to #74. Or, what does the left hand side of For JSONPath implementations in interpreted languages such as JavaScript, Python or PHP, and whose filter expressions are these languages, In Javascript,
For implementations such as Jayway, jsoncons, and JsonCons.JsonPath, where In JMESPath, for comparison, evaluating an object with a missing key is specified to return a null value, so
returns
In JSONiq, for another comparison, evaluating an object with a missing key results in an empty sequence, viz.
|
Yes, it does relate to that as well! I interpret literals as JSON values. |
That and #64 (comment) |
In any case, it's impossible to talk about what
means without first defining what Daniel |
@danielaparker you're getting a little ahead of yourself. Operators and relative paths in expressions are discussed in other issues that deal with expressions themselves. These are quite well-defined in those issues. |
@gregsdennis, just noting that the answer to this issue you raised follows immediately once the meaning of |
Indeed, so the discussion here should inform the decisions we make for empty |
The latest draft seems to be pretty clear about that.
Problem here is, that JSON lacks
Using new Most of discussions were done in this pull request Am I missing something here? -- sg |
What's missing, and what's missing generally in the draft, is any survey and analysis of prior experience in the great physical tarpit that is JSONPath. And if the purpose of this IETF effort really is to standardize existing practice, I think that's important. Of course, if that's not the purpose, than it doesn't matter, but everybody says that's the purpose. It's not that the rules you've sketched here cannot be motivated by some prior experience, see e.g my analysis here. 11 of 42 implementations, including two that may be considered important, do follow this rule: [?(@.foo)] ... selected, if member foo exists. But Goessner Javascript doesn't follow that rule. Nor do a significant number of others. If the draft really is about standardizing existing behaviour, it seems to me that it needs to justify its choices with reference to prior experience. Not just with what "we" (a handful of people) "agreed". |
hmm ... in my original proposal I included (as already someone mentioned):
It seems to be, this was of no significant relevance for existing implementations. |
@goessner would your implementation match on |
of course it would ... as I reused the Javascript engine for simplicity then. |
@goessner, maybe I've misunderstood Greg's question, but I think you meant to reply "of course it wouldn't". Using Goessner Javascript, and given the JSON document
the query
returns nothing. This is what we expect from JavaScript, and is consistent with the results reported here. Jayway (Java), on other other hand, returns
|
I don't think any of the JSONPath implementations that use a dynamic language for evaluation, whether JavaScript, PHP, Python, Ruby or Lua, evaluate On the other hand a significant number of (not all) implementations that implemented their own expression evaluators do evaluate |
The charter is quite specific:
Since we do have those differences here, we are asked to consider what is "technically best", but "with an aim toward minimizing disruption". This seems clear to me, and I think our charter writers did a very good job here. |
I think it's hard to make a case that the draft is doing much to minimize disruption. On the one hand, it's becoming incompatible with all of the implementations that use a dynamic language such as Javascript, PHP, Python, Ruby or Lua for evaluating expressions. For users of such implementations, having an expression language in their familiar language, with all of the functions that that language provides, is part of the appeal of these implementations. The users of these implementations all have a On the other hand, the WG is sketching out an expression language that is different from the expression languages that were developed by other implementations mostly following Jayway Java. These expression languages specified It seems to me that the draft is departing from both streams of JSONPath that evolved from the original article. I don't see anything in the draft that suggests that the editors consider prior experience important. There is no text in the draft that discusses the important implementations, and which features were motivated by one, which from another, and which are new or refinements. Anyway, I realize that nobody here is interested in this topic, no doubt for the obvious reason :-) |
Daniel wrote:
I don't see anything in the draft that suggests that the editors consider
prior experience important. There is no text in the draft that discusses
the important implementations,
and which features were motivated by one, which from another, and which
are new or refinements.
I consider prior experience to be very important and I'm sure Stefan does
too. However, I am not sure to what extent the spec should reference
particular implementations since such references will not necessarily stand
the test of time. Perhaps an appendix is the way to do it, in which case,
please feel free to submit a PR to help lead the way forward. Editors need
not be the only authors.
Anyway, I realize that nobody here is interested in this topic, no doubt
for the obvious reason :-)
Not so.
…On Thu, 16 Sept 2021 at 20:48, Daniel Parker ***@***.***> wrote:
Since we do have those differences here, we are asked to consider what is
"technically best", but "with an aim toward minimizing disruption". This
seems clear to me, and I think our charter writers did a very good job here.
I think it's hard to make a case that the draft is doing much to minimize
disruption.
On the one hand, it's becoming incompatible with all of the
implementations that use a dynamic language such as Javascript, PHP,
Python, Ruby or Lua for evaluating expressions. For users of such
implementations, having an expression language in their familiar language,
with all of the functions that that language provides, is part of the
appeal of these implementations.
On the other hand, the WG is sketching out an expression language that is
different from the expression languages that were developed by other
implementations mostly following Jayway. These expression languages
specified @.relative-path as a JSONPath expression, with rules for
"ExecuteSingle" to produce a single value for use in comparisons. @.
means something different in the draft, where it's not a JSONPath
expression.
It seems to me that the draft is departing from both streams of JSONPath
that evolved from the original article. I don't see anything in the draft
that suggests that the editors consider prior experience important. There
is no text in the draft that discusses the important implementations, and
which features were motivated by one, which from another, and which are new
or refinements.
Anyway, I realize that nobody here is interested in this topic, no doubt
for the obvious reason :-)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#118 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAXF2OMWFKBT5DNTHL3FULUCJCXHANCNFSM5DPUZ5FA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I agree that such references do not belong in the main text of the spec. An appendix is okay. I'd I had my way, if have a separate companion doc that summarized individual decisions and the reasoning behind them. Such a document would be a natural place to include references to behaviors in existing implementations. |
@glyn wrote
If the purpose of the WG is to standardize existing behavior, as they say it is, I think it's up to the authors to justify how their choices relate to prior experience. For example, there is plenty of prior experience with specifying filter expressions, starting with Jayway, the second most important and influential implementation after Goessner. Jayway, for example, has answers to all the questions like #118, #119 and #123. But the WG take on expressions appears to be inconsistent with that prior experience in significant respects. I think the authors should explain why. That is, if the authors really mean it when they say that their intent is to standardize existing behavior. |
Sent from mobile, sorry for terse
On 24. Sep 2021, at 14:53, Daniel Parker ***@***.***> wrote:
If the purpose of the WG is to standardize existing behavior
It’s not. Please reread the charter.
RFC 2418 talks more about the role of authors (ie to implement the directions of the WG), and I’m certain the authors will do that. If the WG wants to have a big rationale section to document their decisions beyond what feels natural for the authors, all I can say is “send text”…
|
Thanks for the clarification. |
Fixed in 76789d8 |
Can you summarize the resolution, please? |
Since 76789d8, Section 3.5.9 now says:
|
A new StackOverflow question highlights the need to define whether these two cases are the same or different:
null
as a valueI would expect that Javascript would handle these cases differently, but .Net generally wouldn't (it seems Newtonsoft has some special handling for this).
Posed in a more direct, testable way, given the data
would
return any results?
(related to #64 and #47)
The text was updated successfully, but these errors were encountered: