validator

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: Apache-2.0 Imports: 39 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplySchemaPatches

func ApplySchemaPatches(k8sVersion int, gv schema.GroupVersion, defName string, schema *spec.Schema) *spec.Schema

func NewStructuralSchemaFactory

func NewStructuralSchemaFactory(components map[string]*spec.Schema) structuralSchemaFactory

Types

type DeferredStructural

type DeferredStructural struct {
	*structuralschema.Structural
	Properties map[string]*structuralschema.Structural
	// contains filtered or unexported fields
}

DEPRECATED This was a dirty hack to try out using StructuralSchemas against the recursive CRD schema. It actually works pretty well. But k8s doesnt expect recursive schemas and loops forever, so this was dropped. I'm sure it can be simplified a lot, but its complexity does afford some cool properties.

A pointer-based structural schema to workaround the value-typed properties field

type SchemaPatch

type SchemaPatch struct {
	Slug        string
	Description string

	// (Inclusive) version range for which this patch applies
	MinMinorVersion int
	MaxMinorVersion int

	// Nil is wildcard
	AppliesToGV         func(schema.GroupVersion) bool
	AppliesToDefinition func(string) bool
	Transformer         utils.SchemaVisitor
}

type UnstructuredObjectTyper

type UnstructuredObjectTyper struct {
	Delegate          runtime.ObjectTyper
	UnstructuredTyper runtime.ObjectTyper
}

func (UnstructuredObjectTyper) ObjectKinds

func (UnstructuredObjectTyper) Recognizes

type Validator

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

func New

func New(client openapi.Client) (*Validator, error)

func (*Validator) Parse

Parse parses JSON or YAML text and parses it into unstructured.Unstructured. Unset fields with defaults in their schema will have the defaults populated.

It will return errors when there is an issue parsing the object, or if it contains fields unknown to the schema, or if the schema was recursive.

func (*Validator) Validate

func (s *Validator) Validate(obj *unstructured.Unstructured) error

Validate takes a parsed resource as input and validates it against its schema.

Jump to

Keyboard shortcuts

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