-
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
bracket notation #92
Comments
... leaving out the parenthesis in |
+1 |
A few things. First,
I don't think we should shortcut notation in our discussions. Doing so will end up with shortcutted notation becoming actual notation. Please use the full notation intended. Second, I think there are multiple syntaxes being discussed;
These should each have their own issues. Since the first two are pretty basic and agreed upon, let's focus on the last two. We can keep this one for the path-as-index (we should edit the title). I'll create a new issue for the latter. |
You are right with demanding always complete syntax. My points were:
I don't think, we need another issue for bracket notation ... |
What does { "address": { "city": "Dallas" } }
{ "address.city": "Austin" }
{
"address": { "city": "Dallas" },
"address.city": "Austin"
} My point is to say that the dot syntax as an index bears discussion. We don't have agreement on it. The I think a way around this would to use a |
Empty nodelist, "Austin", "Austin".
So far the agreement appears to be that there is no such special syntax. |
But
What is a "door syntax" ?
Letting the lack of
Result of both
But then come with Except that referencing trick I see no other use case of Even index arithmetic ala @danielaparker writes in #57 (comment)
So I pragmatically propose to disallow the use of To be clear: filter expressions are a completely other beast and need to be discussed in the following. |
@danielaparker & @bettio haven't commented here. Of those who have been involved, I'd expect one of them to disagree.
Sorry. Autocorrect. Dotted syntax. I've fixed it.
See #93 where I explain the usefulness of this syntax. I also suggest we take conversation of this syntax to that issue and focus on |
Omitting the You never address the syntax This syntax would be equivalent to just having Given the data {
"name": "Greg",
"address": {
"city": "Auckland"
}
} The union path |
Ahh ... I see ... this would be different indeed, a complete other thing. So this must be allowed also for single bracket expressions
when accepting the singularization principle. Consequently we would have to allow then constructs like I think I made my point sufficiently precise. Others should decide regarding use of |
I think we've already discussed allowing this level of complexity elsewhere for |
... but now we have three different syntaxes ...
which can be combined arbitrarily, where Of course we can add that to the spec. I simply would like to discuss effort to benefit ratio before. |
Agreed. And I'm concerned about the end user complexity/benefit ratio too as I've mentioned elsewhere. My personal preference is to focus on the core/common features or at least to get them nailed down first. |
Worth mentioning: a StackOverflow question just came in regarding nested query expressions. |
I can't find anything actionable in here any more. |
Also addressing Glyn's point
from #78 here, obviously common agreement exists about the "bracket child operator", selecting a child value
"name"
index
.So in
$..[<expr>]
the result of expression<expr>
will be interpreted as a member name or element index depending on the parent value type. While accepting this important statement, let's have a look at @danielaparker's JSON example in #88:Applying following queries gives us
$.firstName
["John"]
$['firstName']
["John"]
$[@.firstName] === $['John']
[]
$.address.city
["Nara"]
$['address']['city']
["Nara"]
$['address.city']
[]
$[@.address.city] === $['Nara']
[]
according to the member name or element index interpretation principle.
In general any query expression ala
$.x[@.a.b.c]
means:"Find member name or element index of JSON value named
"x"
as the value of its descendant node location'@.a.b.c'
".From my point of view it is of very low practical use to bury member name or element index of any JSON value deep down in its subtree.
My
[@.length-1]
index arithmetic is also generally commented of being of low practical use.Using root value symbol
$
in$.x[$.id]
meaning member name or element index referencing might be of some practical use, but potentially leads to security issues.As a consequence of this I propose to completely dispense use of
$
and@
in other expressions than filter expressions.The text was updated successfully, but these errors were encountered: