Wrong result paths in examples
mcatanzariti opened this issue · comments
Hi,
There are wrong result paths in some examples:
§2.5.5 Filter selector
$.a[?(@.b == $.x)]
should have result paths:
$['a'][0]
$['a'][1]
$['a'][2]
$['a'][3]
$['a'][4]
$['a'][5]
§2.7.2 Descendant Segment
$.a..[0, 1]
should have result paths:
$['a'][0]
$['a'][1]
$['a'][2][0]
$['a'][2][1]
I'm actually porting JSONPath to CBORPath based on the JSONPath specs:
https://github.com/dahomey-technologies/cborpath-rs
And I found the errors by writing unit tests based on the examples in the JSONPath specs.
For the first error (2.5.5), you can see, by reading the example table, that there is a mismatch between the number of nodes:
3
5
1
2
4
6
and the number of paths:
$['a'][0]
$['a'][1]
$['a'][2]
$['a'][3]
$['a'][4]
Then by analyzing the problem, it becomes obvious that $['a'][5]
is missing.
Sadly, I could not reproduce the problem in any JSONPath online because paths with no values within filters are not well supported...
Thank you! Now PR #399
We definitely need to add checking the examples (not just for ABNF compliance) to the CI.
Do you already have a reference implementation of the draft in any language ?
Awesome!
I have JsonPath.Net as part of https://github.com/gregsdennis/json-everything. You can test its latest at https://json-everything.net/json-path.
To my knowledge, this is the only lib that implements the full current doc (aside from a few minor open discussions), including functions.