syntax = "proto2";
package validate_custom_predefined;
import "buf/validate/validate.proto";
import "google/protobuf/wrappers.proto";
extend buf.validate.StringRules {
optional bool string_not_bad = 1000 [(buf.validate.predefined).cel = {
id: "string.not_bad"
expression: "!rule || this != 'bad'"
message: "must not be bad"
}];
}
extend buf.validate.Int64Rules {
repeated google.protobuf.Int64Value int64_abs_in = 1000 [(buf.validate.predefined).cel = {
id: "int64.abs_in"
expression: "this in rule || this in rule.map(n, -n)"
message: "must be in absolute value of list"
}];
}
message CustomPredefinedRules {
optional string value = 1 [(buf.validate.field).string.(string_not_bad) = true];
repeated string items = 2 [(buf.validate.field).repeated.items.string.(string_not_bad) = true];
optional int64 count = 3 [(buf.validate.field).int64.(int64_abs_in) = {value: -2}];
}