validator

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WarningSeverity represents a validation warning
	WarningSeverity = "warning"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Rule

type Rule struct {
	Expr     string `yaml:"expr"`
	Desc     string `yaml:"desc"`
	Severity string `yaml:"severity"` // "error" or "warning", defaults to "error"
	Name     string `yaml:"name,omitempty"`
}

Rule represents a single CEL validation rule with severity and name

type ValidationError

type ValidationError struct {
	Description string
	Expression  string
	Value       interface{}
	Path        string
}

ValidationError represents a validation failure

func (*ValidationError) Error

func (e *ValidationError) Error() string

func (*ValidationError) Warning added in v1.0.0

func (e *ValidationError) Warning() string

type ValidationResult added in v1.0.0

type ValidationResult struct {
	Errors   []*ValidationError
	Warnings []*ValidationError
}

ValidationResult represents the outcome of validation

func (*ValidationResult) Error added in v1.0.0

func (vr *ValidationResult) Error() string

func (*ValidationResult) HasErrors added in v1.0.0

func (vr *ValidationResult) HasErrors() bool

type ValidationRules

type ValidationRules struct {
	Rules       []Rule            `yaml:"rules"`
	Expressions map[string]string `yaml:"expressions,omitempty"`
}

ValidationRules contains all CEL validation rules and named expressions

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

Validator handles the validation of Helm values using CEL

func New

func New() *Validator

New creates a new Validator instance

func (*Validator) ValidateChart

func (v *Validator) ValidateChart(chartPath string) (*ValidationResult, error)

ValidateChart validates the values.yaml file against CEL rules in values.cel.yaml.

Jump to

Keyboard shortcuts

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