cel

package
v1.20.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(schema *spec.Schema, values any) ([]error, error)

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

func ValidateTransition(schema *spec.Schema, values, oldValues any) ([]error, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL