schema

package
v1.76.1 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func YAMLDocLoader

func YAMLDocLoader(path string, opts ...loading.Option) (json.RawMessage, error)

YAMLDocLoader loads a yaml document from either http or a file and converts it to json.

Types

type Storage

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

Storage holds compiled OpenAPI schemas for a package, keyed by Type. All schemas are pre-processed and ready for repeated validation calls.

func NewStorage

func NewStorage(settings, values []byte) (*Storage, error)

NewStorage parses settings and values YAML schema documents, applies the required transformations, and returns a Storage ready for use.

func (*Storage) GetSchema

func (s *Storage) GetSchema(schemaType Type) *spec.Schema

GetSchema returns schema by Type

func (*Storage) Validate

func (s *Storage) Validate(valuesType Type, root string, values utils.Values) error

Validate validates values against the schema registered for valuesType. It extracts the value under root and runs both CEL rule checks and JSON-Schema validation. Transition rules referencing oldSelf are skipped because no previous values are provided; use ValidateTransition for that. Returns nil if no schema is registered for valuesType.

func (*Storage) ValidateTransition

func (s *Storage) ValidateTransition(valuesType Type, root string, values, oldValues utils.Values) error

ValidateTransition is like Validate but additionally accepts the previously stored values, enabling x-deckhouse-validations transition rules (rules that reference oldSelf) to fire on updates. Pass oldValues=nil for the initial create / when previous values are not available.

type Type

type Type string

Type identifies which schema variant is used for a given validation context.

const (
	// TypeSettings is the schema for user-supplied configuration values (config.yaml).
	TypeSettings Type = "config"
	// TypeValues is the schema for the full set of internal module values.
	TypeValues Type = "values"
	// TypeHelm is derived from TypeValues with x-required-for-helm fields promoted to
	// required, making those fields mandatory during Helm chart rendering.
	TypeHelm Type = "helm"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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