-
Notifications
You must be signed in to change notification settings - Fork 4
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
Reconcile JEP-12 and raw-string grammar rule #133
Comments
jmespath-community/jmespath.test#11 (comment)
|
I do not understand you point regarding a mode-switch. In my mind, the current JMESPath Community specification aligns with the current official specification. Please, can you elaborate? |
I'm not sure what it means to be considered "standards-compliant", but at least jmespath.py and jmespath.js and jmespath.rb parse So resolution of this issue should not prohibit support for the fallback behavior, nor should it require support. And I see two reasonable options for how to specify that variability:
|
I agree that:
But I fail to see why there should be any change to the spec at all. With regards to I refer to syntax that follow those specifications as standards compliant. I think we can both agree that JEP-12 is the proposal that ultimately changed the specification from whatever it was before to what it now states. Of course, my view is that the implementations you refer to predate JEP-12 and therefore already supported legacy literal strings. I think it was reasonable for James to design a migration path. The JMESPath.Net implementation, on the other hand, never supported the old syntax as I was not even aware of this old syntax from reading the spec when I started implementing it. In my view, JEP-12 supports both syntaxes in the sense that it allows for a migration path. However I'm absolutely convinced that, in order to stay standards compliant, an implementation absolutely has to support the new - as currently specified - syntax. I think it's perfectly valid for an implementation to choose not to support syntax that is not specified. Basically, I think about the deprecation process that James started. At the end of the deprecation process, my view is that:
|
To be clear this issue is not about updating the spec. Although I'm not comfortable changing a JEP once accepted, we can both agree that the current JEP-12 does not reflect the current official spec. You already proved that and pointed to subsequent commits to the spec. This suggests a missing JEP-12.5 or, an addendum to JEP-12. |
Right now, the spec does prohibit support for the fallback behavior, because e.g. |
In a way you are right, but I’d rather think about it differently:
Likewise, I would rather qualify legacy syntax with elided double quotes as being undefined input rather than invalid input. For a minute let’s forget about this community project and focus on the current situation. The official specification at jmespath.org does not specify legacy syntax. However, jmespath.py and jmespath.js and jmespath.rb implementations do parse the legacy syntax. We now understand that this is as per JEP-12. JEP-12 must be understood as initiating a deprecation process that may eventually lead to legacy syntax being abandoned. You can view those implementations as violated standards compliance with respect to the official specification – which I sort of agree with – but as there is not compliance tests that mandate such syntax to raise a Basically, the current compliance test suite does not contain support for the legacy syntax. The Python implementation does contain support for legacy syntax in a However we appreciate the situation, if we think about parsing legacy syntax as being non-compliant, then jmespath.py, jmespath.js, and jmespath.rb have been non-compliant with respect to the official specification for more than five years now. The objective of this community effort is to draw a line and fully deprecate legacy syntax. We do not want to bring back those implementations as being standards compliant. As part of the deprecation process I’m taking the following steps:
That is why I’m rather opposed to updating the grammar specifically related to legacy syntax. |
Ah, I would disagree very strongly with that. If implementations are not required to reject use of syntax not covered by the formal grammar, then multiple problems emerge:
If it is undefined, then how is anyone to know whether e.g.
I support this, but "deprecated" does not mean "completely removed"—it is instead a transitional step towards that. The process should maintain a definition for correct behavior while making the behavior itself optional and discouraged.
Doesn't this contradict your claim above? If you want those implementations to be considered noncompliant right now, then it seems like you're claiming the deprecation process to already be complete.
Thank you, this perspective is very helpful. I would say that documenting the discouraged syntax and its corresponding semantics in the specification would be at minimum a similar level of good citizenship, but my opinion is actually a bit stronger than that. I suspect that use of the fallback is still so prevalent that any implementation is effectively required to be aware of it, even if the choice is ultimately made to reject it, and therefore absence from the specification is detrimental. What was your experience in developing the JMESPath.Net implementation—how did you become aware of the legacy syntax, and what did you decide to do upon discovering it? If I'm reading LiteralStringToken.cs correctly, it does reject attempts to use it. |
I became aware of the legacy syntax by users trying to replicate some expressions using it with jmespath.net. When first reading about JEP-12, I understood that syntax was being deprecated and chose never to support it.
I’m completely aligned with that. In fact, the Python implementation was raising a
I would not be opposed to documenting – as in, adding some notes to the specification text – the very existence of a legacy syntax. Perhaps outlining the deprecation process and such. Basically, an explicit reference to JEP-12 were users would find the original portion of the specification grammar for the legacy syntax there.
Well, I think that you are technically right, but that is an impossible ideal to attain. Before JEP-12, the grammar was ambiguous to begin with. Even after JEP-12, implementations vary in subtle details as you have outlined. So one has to study the compliance test suite as a secondary viewpoint for interpreting the specification. Take this PR for instance.
Then later in the text,
However, there is no compliance tests that contradicts the original description about evaluating a To summarize, I think we broadly agree although maybe not in details. I will open a separate issue to mention / document the existence of legacy syntax and refer to JEP-12. Now focusing on this issue, however, what would be your position for best reconciling JEP-12 and the specification? We have a few options:
Do you see others? |
I would prefer a new JEP that obsoletes JEP-12 and is linked to from JEP-12, which is basically how the IETF RFC process handles normative changes (the errata system is for fixing typos and other editorial issues, but this seems more substantial than that). |
While JEP-12 Raw String Literals has been accepted, it has subsequently fallen behind and no longer matches the official grammar.
For instance, this test/literal.json test is not compliant with JEP-12 that does not allow backslash characters explicitely. On the other hand, it is not compliant with the official grammar either because
\\
is expected to be a valid escape sequence for a single\
character.https://github.com/jmespath-community/jmespath.test/blob/aa6fb5f942e852af1781d1f208c4069a15794a80/tests/literal.json#L194-L196
Please, consider updating JEP-12 to align with the grammar and the updated tests.
The text was updated successfully, but these errors were encountered: