Skip to content
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

Updated Pr 98 (selectors reworked) #99

Closed
wants to merge 3 commits into from
Closed

Updated Pr 98 (selectors reworked) #99

wants to merge 3 commits into from

Conversation

cabo
Copy link
Member

@cabo cabo commented Jun 10, 2021

mit Fix für den YAML-nit

@gregsdennis
Copy link
Collaborator

gregsdennis commented Jun 11, 2021

@cabo/@goessner can you rename the PR to better reflect what it's trying to do, please? Also a summary of changes would be kind.

@cabo
Copy link
Member Author

cabo commented Jun 11, 2021

This PR (actually PR #98) reverts all the fixes in 9be270d
Is this intentional?

@goessner
Copy link
Collaborator

goessner commented Jun 11, 2021 via email

@glyn
Copy link
Collaborator

glyn commented Jun 11, 2021

I understood that multiple small PR's are preferrable, which was not so easy with the complete rewrite of selectors. I can do that from now on.

@goessner Do you mean you will now break this PR into multiple small PRs? (That would be great!)

Notes:

* Parenthesis can be used with `boolean-expr` for grouping. So filter selection syntax in the original proposal `'[?(<expr)]'` is naturally contained in the current lean syntax `'[?<expr]'` as a special case.
* Comparisons are restricted to primitive values `number`, `string`, `true`, `false`, `null`. Comparisons with complex values will fail, i.e. no selection occurs.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than fail silently, another option would be to avoid this situation in the syntax. Then failures will produce a syntax error, which is much clearer to the user. Have you checked for consensus of current implementations? This issue comment is relevant.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would actually like to be able to say @.foo == [1,2]. I think this is a valid use case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it appears we need a new issue.

  • Comparison with structured values
  • Should comparison with structured values (e.g., @.foo == [1, 2]) be supported?
  • If it is not supported, should this silently fail or the attempt cause a syntax error (in Updated Pr 98 (selectors reworked) #99, it causes a syntax error, but then the text says something else).

Copy link
Member Author

@cabo cabo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few initial impressions.

@@ -97,6 +97,13 @@ informative:
seriesinfo:
ISO/IEC 22537:2006
date: 2006
E4X-overview:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this -- this seems to be a remnant from an older revision.

There are several such remnants, which make it hard to review this PR.

draft-ietf-jsonpath-base.md Show resolved Hide resolved
It also selects all the elements of any array node.
It selects no nodes from
number, string, or literal nodes.
The Argument &mdash; the root JSON value &ndash; is anonymous by nature. By getting assigned the universal name `'$'` it becomes the root node.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Writing the actual characters instead of HTML entity references is preferred.

The same dashes should be used at the start and at the end of an interjection.

draft-ietf-jsonpath-base.md Show resolved Hide resolved
HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
; case insensitive hex digit
~~~~ abnf
quoted-member-name = %x22 *double-quoted %x22 / ; "string"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have a separate set of definitions for literals. This is particular important because JSONPath literals have a more permissive syntax than that of JSON. (Should they?)
Literals should never be confused with the data themselves (i.e., we never should say "string" when we mean "string literal").

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Literals should never be confused with the data themselves (i.e., we never should say "string" when we mean "string literal").

What? When was this discussed? Do we now have to say "boolean literal" or "numeric literal?" Where does JSON Path ever use strings that AREN'T a string literal?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Literals should never be confused with the data themselves (i.e., we never should say "string" when we mean "string literal").

What? When was this discussed?

I wasn't there. Must have been before 1972, but I'm pretty sure after 1960.

Do we now have to say "boolean literal" or "numeric literal?"

If we mean the literal, yes. If we mean the value, no.
The important part is to make the distinction.

Where does JSON Path ever use strings that AREN'T a string literal?

The strings in the argument are no longer literals at the time we get them.
Also, as soon as a string literal in the query is parsed, it is the resulting value that is then used; different literals for the same value are not distinguishable for the purposes of the language.

Of course, all this can be done differently, but that is the way it has been done in language design for approximately half a century.

@goessner
Copy link
Collaborator

goessner commented Jun 11, 2021 via email

@goessner
Copy link
Collaborator

goessner commented Jun 11, 2021 via email

@cabo
Copy link
Member Author

cabo commented Jun 11, 2021 via email

@cabo
Copy link
Member Author

cabo commented Jun 14, 2021

– is not accessible per keyboard.

It sure is.
This probably should be an &mdash;, however.

If you are using Windows:
https://softwareaccountant.com/em-dash-in-word/

@cabo cabo changed the title Pr 98 Updated Pr 98 (selectors reworked) Jun 14, 2021
@goessner
Copy link
Collaborator

goessner commented Jun 14, 2021 via email

@cabo
Copy link
Member Author

cabo commented Jun 14, 2021 via email

@glyn
Copy link
Collaborator

glyn commented Jun 14, 2021

@cabo please rebase

@cabo cabo mentioned this pull request Jun 14, 2021
@cabo
Copy link
Member Author

cabo commented Jun 16, 2021

Covered by #102 now.

@cabo cabo closed this Jun 16, 2021
@cabo cabo deleted the pr-98 branch March 16, 2023 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants