Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Validate ¶
Validate evaluates all x-deckhouse-validations CEL rules attached to schema and its nested properties recursively without any previous-value context. Rules that reference oldSelf (transition rules) are skipped.
It is equivalent to ValidateTransition(schema, values, nil) and is preserved as a thin wrapper for callers that don't have access to the previous values.
func ValidateTransition ¶ added in v1.20.10
ValidateTransition evaluates all x-deckhouse-validations CEL rules attached to schema and its nested properties recursively, exposing the current value as "self" and the previous value as "oldSelf" inside expressions.
Rules referencing oldSelf are treated as transition rules: they are evaluated only when an old value is available at the same level (i.e. on updates) and silently skipped otherwise (e.g. on create or for newly added properties). This mirrors the semantics of x-kubernetes-validations and allows expressing immutability with a rule like:
x-deckhouse-validations:
- expression: "self == oldSelf"
message: "field is immutable"
It returns validation errors for every rule that evaluated to false, and a non-nil error for configuration or evaluation failures.
Types ¶
This section is empty.