-
Notifications
You must be signed in to change notification settings - Fork 11
Generated normalized paths #101
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
Conversation
12d49de
to
5d672e5
Compare
Updated after the review #100 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as on the other PR: my implementation is having trouble with escaping chars in name selectors. Otherwise passes.
tests/name_selector.json
Outdated
"A" | ||
], | ||
"result_paths": [ | ||
"$['\\\\/']" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the path be "$['/']"
here? I think solidus (/
, 0x2F) is "normal-unescaped".
Same for "single quotes, escaped solidus".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this seems to be a bug in my implementation. The document does not have backslashes, so why would they appear in the normalized path.
Thanks for catching all these things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought though, according to 2.3.1.1, the /
is escapable
name-selector = string-literal
string-literal = %x22 *double-quoted %x22 / ; "string"
%x27 *single-quoted %x27 ; 'string'
double-quoted = unescaped /
%x27 / ; '
ESC %x22 / ; \"
ESC escapable
single-quoted = unescaped /
%x22 / ; "
ESC %x27 / ; \'
ESC escapable
ESC = %x5C ; \ backslash
unescaped = %x20-21 / ; see RFC 8259
; omit 0x22 "
%x23-26 /
; omit 0x27 '
%x28-5B /
; omit 0x5C \
%x5D-D7FF /
; skip surrogate code points
%xE000-10FFFF
escapable = %x62 / ; b BS backspace U+0008
%x66 / ; f FF form feed U+000C
%x6E / ; n LF line feed U+000A
%x72 / ; r CR carriage return U+000D
%x74 / ; t HT horizontal tab U+0009
"/" / ; / slash (solidus) U+002F
"\" / ; \ backslash (reverse solidus) U+005C
(%x75 hexchar) ; uXXXX U+XXXX
I'll need to take a deeper look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought though, according to 2.3.1.1, the
/
is escapable
True, but 2.7 says
Certain characters are escaped in Normalized Paths in one and only one way; all other characters are unescaped.
And the grammar puts /
in the unescaped category.
normal-single-quoted = normal-unescaped /
ESC normal-escapable
normal-unescaped = ; omit %x0-1F control codes
%x20-26 /
; omit 0x27 '
%x28-5B /
; omit 0x5C \
%x5D-D7FF /
; skip surrogate code points
%xE000-10FFFF
normal-escapable = %x62 / ; b BS backspace U+0008
%x66 / ; f FF form feed U+000C
%x6E / ; n LF line feed U+000A
%x72 / ; r CR carriage return U+000D
%x74 / ; t HT horizontal tab U+0009
"'" / ; ' apostrophe U+0027
"\" / ; \ backslash (reverse solidus) U+005C
(%x75 normal-hexchar)
; certain values u00xx U+00XX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So does this mean that $['/']
is a correct normalized path (as per 2.7) but not a valid JSONPath query (as per 2.3.1.1)? @glyn @gregsdennis
But 2.7 also says that
a Normalized Path is a JSONPath query
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like it's worth clarifying in the RFC repo: ietf-wg-jsonpath/draft-ietf-jsonpath-base#526
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so this is indeed a bug in my implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So does this mean that
$['/']
is a correct normalized path (as per 2.7) but not a valid JSONPath query (as per 2.3.1.1)? @glyn @gregsdennis
(I think this question has been answered by ietf-wg-jsonpath/draft-ietf-jsonpath-base#526.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I incorrectly interpreted "escapable" as "must be escaped".
Comparing
And differs on the expected normalized path for:
Otherwise every test case matches perfectly. |
I have rerun my |
Whichever PR we go for, I'd like to see the schema changes included so that
normalized paths are mandatory.
…On Mon, 3 Feb 2025, 05:48 Greg Dennis, ***@***.***> wrote:
@jg-rp <https://github.com/jg-rp> @f3ath <https://github.com/f3ath> which
PR are we going for, this or #100
<#100>
?
—
Reply to this email directly, view it on GitHub
<#101 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAXF2M4TTCQXCYFBIL77RL2N37KXAVCNFSM6AAAAABV33AGMSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMZQGAZTEMBQGE>
.
You are receiving this because you were mentioned.Message ID:
<jsonpath-standard/jsonpath-compliance-test-suite/pull/101/c2630032001@
github.com>
|
This PR doesn't have the correct schema changes. PR #100 has the correct schema changes, but is missing some JSON and so the schema validation check fails. |
Indeed. Excluding an updated I get the impression that #101 is intended to aid comparison and is not to be merged, at least not in its current form. |
Yes, please. It should get overwritten with the same content by CI, but at least the schema validation should pass. (Aside: strange that it validates cts.json before overwriting it rather than after.)
Ok, let's close 101 to be crystal clear what's going on. |
Correct. This PR was to help cross check the paths. |
Generated normalized paths as suggested in #100 (comment)