Rule represents a validation rule written in the Common Expression
Language (CEL) syntax. Each Rule includes a unique identifier, an
optional error message, and the CEL expression to evaluate. For more
information, see our documentation.
message Foo {
option (buf.validate.message).cel = {
id: "foo.bar"
message: "bar must be greater than 0"
expression: "this.bar > 0"
};
int32 bar = 1;
}
Rule represents a validation rule written in the Common Expression
Language (CEL) syntax. Each Rule includes a unique identifier, an
optional error message, and the CEL expression to evaluate. For more
information, see our documentation.
message Foo {
option (buf.validate.message).cel = {
id: "foo.bar"
message: "bar must be greater than 0"
expression: "this.bar > 0"
};
int32 bar = 1;
}
Optional[customReturns a safe value for JSON logs.
Returns a safe value for JSON logs.
Optional[unknownPreserves protobuf fields that this SDK version does not recognize.
Contains the fully qualified protobuf type name.
Optionalexpressionexpression is the actual CEL expression that will be evaluated for
validation. This string must resolve to either a boolean or a string
value. If the expression evaluates to false or a non-empty string, the
validation is considered failed, and the message is rejected.
Optionalidid is a string that serves as a machine-readable name for this Rule.
It should be unique within its scope, which could be either a message or a field.
Optionalmessagemessage is an optional field that provides a human-readable error message
for this Rule when the CEL expression evaluates to false. If a
non-empty message is provided, any strings resulting from the CEL
expression evaluation are ignored.
Rulerepresents a validation rule written in the Common Expression Language (CEL) syntax. Each Rule includes a unique identifier, an optional error message, and the CEL expression to evaluate. For more information, see our documentation.