You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feature description:
A to_unique() -> list (or equivalent) function to accompany the unique() -> bool CEL helper function.
Supported today:
[1, 1, 2, 3, 3 ].unique() # false
Proposal:
[1, 1, 2, 3, 3 ].to_unique() # [1, 2, 3]
.to_unique().unique() is always true.
Problem it solves or use case: unique() is a helpful protovalidate addition for something you can't do in CEL otherwise. I want the intermediate form, i.e. the set of unique values, exposed to do even more!
Contribution:
I can likely contribute the PR for this - just let me know re: to_unique() naming at least if no other major concerns.
Examples or references: Example: Ensure all items in a collection are all siblings
Example: Ensure all structpb.Value items are of the same type
google.protobuf.Value value = 1 [
(buf.validate.field).cel = {
id: "repeated.same_type",
message: "all values must be of same type",
expression: "type(this) != list || this.map(v, type(v)).to_unique().size() <= 1"
// ^^^^^^^^^^^^^
// my hopes & dreams
}
];
(can you guess this is the specific use case I have in mind? 😉)
The text was updated successfully, but these errors were encountered:
Feature description:
A
to_unique() -> list
(or equivalent) function to accompany theunique() -> bool
CEL helper function.Supported today:
Proposal:
.to_unique().unique()
is always true.Problem it solves or use case:
unique()
is a helpful protovalidate addition for something you can't do in CEL otherwise. I want the intermediate form, i.e. the set of unique values, exposed to do even more!Contribution:
I can likely contribute the PR for this - just let me know re:
to_unique()
naming at least if no other major concerns.Examples or references:
Example: Ensure all items in a collection are all siblings
Example: Ensure all
structpb.Value
items are of the same type(can you guess this is the specific use case I have in mind? 😉)
The text was updated successfully, but these errors were encountered: