-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Labels
FeatureNew feature or requestNew feature or request
Description
Feature description:
Add sum function for numeric lists.
Problem it solves or use case:
I want to limit the maximum total size of a repeated File files field, where the File message has a bytes contents field. Without a sum function (or a more general reduce macro), I can't.
I'd like to be able to write a rule like
this.map(file, file.contents.size()).sum() <= 52428800
Proposed implementation or solution:
Add a function to the CEL runtime
<list<T>>.sum() <T>, T must be a numeric type or a duration
Contribution:
I would be happy to help implement this.
Examples or references:
sum is implemented in Kubernetes' CEL extensions: https://pkg.go.dev/k8s.io/apiextensions-apiserver/pkg/apiserver/schema/cel/library#Lists
Metadata
Metadata
Assignees
Labels
FeatureNew feature or requestNew feature or request