-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Issue #191 fixes both $..allTheThings.max() and $.max($..allTheThings) #377
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
… as $.max($..allTheNumberThings) $.max($.foo, $.bar) is already supported - consiquently $.max($..allTheNumberThings) should also work.
| * Shows aggregation across fields rather than within a single entity. | ||
| * | ||
| */ | ||
| public class Issue191 extends com.jayway.jsonpath.internal.function.BaseFunctionTest { |
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.
IntelliJ was having a bad day I guess, its in the same package, ugh - I'll fix this...
…t the function takes a parameter which is the scanner expression
|
the original question raised by #191 wanted to use the notation: $..pathWithResultSetOutput.function() so I've added support for that as well. Normally, this won't work unless you make the graph stateful or introduce a pre-aggregation function (or emulate this in the evaluation steps) -- aggregate the results as a collection and passes it along to the function, i.e. $..path.group().min() -- I'm not fond of this approach. Instead, The CompilePath function now recognizes the condition where you're scanning the elements and introducing a collection as a the result set and attempting to pass that along as input into the function, since that won't work (functions are stateless and require parameters that can be lazy evaluated or passed) the CompilePath now inverts the graph making the function the root token and the parameter to the function the original path which makes the whole thing sane such that we can lazy evaluate the path get the result then evaluate the function. So now: $..path.sum() and Since this CompilePath trick is in the constructor, its recursive, so do what you'd hope it would do... |
Issue json-path#191 fixes both $..allTheThings.max() and $.max($..allTheThings)
|
@kallestenflo Could you make a new release? We would like to have this functionality. |
Change-Id: I605fe8fd74bb2a7d0a01edfe42b31e62480e4b97
|
@mgreenwood1001 @kallestenflo Hey, guys, I just stumbled upon fact that this is really weird.. Why is it that many useful commits are on master but the artifact is still not released (for more than a year)? Anyone? |
|
@kallestenflo should you need anything from me for a release please let me know. |
|
I've made pr with |
|
@kallestenflo @mgreenwood1001 this feature would be really useful. It was merged in a year and a half ago. Is there a release planned soon? |
|
+1 Really useful to have this released, thanks! |
|
This would be really useful. Any plans to release it? |
Issue #191 is an unintentional side-effect of the collection processing for parameters passed to functions. This change supports result set functions via patterns such as:
will work too now with this change.