Skip to content

Conversation

@q2w
Copy link

@q2w q2w commented Jan 21, 2024

Currently a function with no arguments is not parsed correctly. Given $.objects.keys().size(), after encountering keys (a function with no arguments) the position should move from $.objects.keys().size() to $.objects.keys().size(). But in current implementation read position moves from $.objects.keys().size() to $.objects.keys().size()

This pull request will fix the issue.

Currently a function parameter with no arguments is not parsed correctly. Given `$.objects.keys().size()`, after encountering keys (a function with no arguments) the position should move from $.objects.keys`(`).size() to $.objects.keys()`.`size(). But in current implementation read position moves from $.objects.keys`(`).size() to $.objects.keys(`)`.size()

This pull request will fix this issue.
@q2w q2w marked this pull request as ready for review January 21, 2024 16:33
@q2w
Copy link
Author

q2w commented Jan 23, 2024

@kallestenflo

@kallestenflo
Copy link
Contributor

Please provide a test in your PR that demonstrates a case.

@q2w
Copy link
Author

q2w commented Jan 29, 2024

@kallestenflo Thanks! I have added a test case for the same.

Json:

"{\"empty\": [], \"number-series\" : [[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [11, 12]]}"

JsonPath: "$.number-series.first().last()"

Before this change, the test case is failing with below error.

Expected to find an object with property [')'] in path $['number-series'] but found 'net.minidev.json.JSONArray'. This is not a json object according to the JsonProvider: 'com.jayway.jsonpath.spi.json.JsonSmartJsonProvider'.
com.jayway.jsonpath.PathNotFoundException: Expected to find an object with property [')'] in path $['number-series'] but found 'net.minidev.json.JSONArray'. This is not a json object according to the JsonProvider: 'com.jayway.jsonpath.spi.json.JsonSmartJsonProvider'.

@q2w
Copy link
Author

q2w commented Feb 5, 2024

@kallestenflo

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.

2 participants