-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Error when resolving .length()
expression in 2.5.0
#650
Comments
This regression was intoduced by #377. @mgreenwood1001, interested in taking a look? |
@kallestenflo I'll take a look at this issue |
mgreenwood1001
pushed a commit
to mgreenwood1001/JsonPath
that referenced
this issue
Dec 16, 2020
… translated to $.length($..book) its really taking the length of the structure pointed at by the result set $..book not $..book.* (children of book). This was caused when the CompiledPath#invertScannerFunctionRelationship was introduced, effectively in the graph of CompiledPath translating the $..book.length() to $.length($..book) but what it should have done (for length only) is translated it to $.length($..book.*). Rather than make this bugfix in the CompiledPath source code I've made it to the Length source as this shouldn't be an issue for any other routine - length is specific in that its asking about the children (hence the .length() the dot there indicates next node(s)). This addresses ticket 650 - json-path#650 and adds unit tests for the same.
@kallestenflo please see the bugfix for length() |
kallestenflo
pushed a commit
that referenced
this issue
Dec 23, 2020
… translated to $.length($..book) its really taking the length of the structure pointed at by the result set $..book not $..book.* (children of book). (#651) This was caused when the CompiledPath#invertScannerFunctionRelationship was introduced, effectively in the graph of CompiledPath translating the $..book.length() to $.length($..book) but what it should have done (for length only) is translated it to $.length($..book.*). Rather than make this bugfix in the CompiledPath source code I've made it to the Length source as this shouldn't be an issue for any other routine - length is specific in that its asking about the children (hence the .length() the dot there indicates next node(s)). This addresses ticket 650 - #650 and adds unit tests for the same. Co-authored-by: Matt Greenwood <61432137+mgreenwood1-chwy@users.noreply.github.com>
@kallestenflo @mgreenwood1001 Thanks for the fix. |
Fixed in 2.6.0 |
Binary-Ninja-007
pushed a commit
to Binary-Ninja-007/JsonPath
that referenced
this issue
Aug 13, 2023
… translated to $.length($..book) its really taking the length of the structure pointed at by the result set $..book not $..book.* (children of book). (#651) This was caused when the CompiledPath#invertScannerFunctionRelationship was introduced, effectively in the graph of CompiledPath translating the $..book.length() to $.length($..book) but what it should have done (for length only) is translated it to $.length($..book.*). Rather than make this bugfix in the CompiledPath source code I've made it to the Length source as this shouldn't be an issue for any other routine - length is specific in that its asking about the children (hence the .length() the dot there indicates next node(s)). This addresses ticket 650 - json-path/JsonPath#650 and adds unit tests for the same. Co-authored-by: Matt Greenwood <61432137+mgreenwood1-chwy@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After upgrading to 2.5.0, this code started to return strange results
In 2.4.0 it returns an array containing number 4, in 2.5.0 it returns 2.
The text was updated successfully, but these errors were encountered: