-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add max, min, and sum functions for dynamic badges #6071
Comments
Could we clarify the scope of what, if anything, is being requested of Shields here? For example, I would assume this is specifically targeted at the json/yaml badges, but the title is a little ambiguous. My sense is that this is largely just a tracking issue to get clarity on whether the functions are supported upstream and what the corresponding query syntax would be, but that there's no action to be taken for Shields. |
Yes, this is not an issue with Shields, but with the package Additionally, this issue could encourage the maintainers of jsonpath to add these methods if people who view this issue upvote the issue I opened in the jsonpath repo. |
I think this could be fixed easier by switching to a different JSONPath library, such as This JSONPath comparator website seems to indicate that no javascipt implementation has a For example I tried creating a query for the latest successful run of a github workflow: $.workflow_runs[(@.findIndex(run => run.conclusion == "success"))].updated_at That could be adapted to find the smallest, instead of first $.workflow_runs[(@.findIndex(run => run.run_number == Math.min(...@.map(run => run.run_number))))].run_number Rather tedious to write, but that is inherent to how JSONPath works. Note that with
$.workflow_runs[(@.findIndex(function(run) { return (run || {"conclusion": "failure"}).conclusion == "success" }))].updated_at
|
You’re right, I’ve found out the “spec” is pretty poorly defined and pretty much every implementation has its own variants. Here are the 36 / 246 features listed on the comparison page where both
However it seems the differences in the |
The biggest concern for us, given the context of where we are today, is not breaking our existing users. As such I think for the very foreseeable future using a Custom Endpoint will remain the best option for those needing more transformation power on dynamic values |
Are you experiencing an issue with...
🪲 Description
.max()
,.sum()
,.min()
functions in dynamic badge queries don't work.Support for
.max()
,.sum()
,.min()
would be a great help and improve the flexibility of dynamic badges.Examples:
$.numbers.sum()
,$.numbers.min()
,$.numbers.max()
,$.sum($.numbers.max())
🔗 Example badges
Doesn't work when
.sum()
is present:Works when
.sum()
is not present:💡 Possible Solution
I think this is a problem with the upstream
jsonpath
library, and I have filed an issue in that repo as well. I thought informing the maintainers of this project as well would be a good idea.Thanks!
The text was updated successfully, but these errors were encountered: