pub enum Message {
Message(String),
Expression(String),
}
Expand description
Message represents CEL validation message for the provided type
Variants§
Message(String)
Message represents the message displayed when validation fails. The message is required if the Rule contains line breaks. The message must not contain line breaks. Example: “must be a URL with the host matching spec.host”
Expression(String)
Expression declares a CEL expression that evaluates to the validation failure message that is returned when this rule fails. Since messageExpression is used as a failure message, it must evaluate to a string. If messageExpression results in a runtime error, the runtime error is logged, and the validation failure message is produced as if the messageExpression field were unset. If messageExpression evaluates to an empty string, a string with only spaces, or a string that contains line breaks, then the validation failure message will also be produced as if the messageExpression field were unset, and the fact that messageExpression produced an empty string/string with only spaces/string with line breaks will be logged. messageExpression has access to all the same variables as the rule; the only difference is the return type. Example: “x must be less than max (”+string(self.max)+“)”