schema

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidEvaluationTypes is returned when the evaluation types are not valid
	// for generating a schema.
	ErrInvalidEvaluationTypes = errors.New("invalid evaluation type")
)
View Source
var ObjectMetaSchema spec.Schema

ObjectMeta holds the k8s ObjectMeta schema, populated once at startup.

Functions

func ConvertJSONSchemaPropsToSpecSchema

func ConvertJSONSchemaPropsToSpecSchema(props *extv1.JSONSchemaProps) (*spec.Schema, error)

ConvertJSONSchemaPropsToSpecSchema converts an extv1.JSONSchemaProps to a spec.Schema.

NOTE(a-hilaly): there must be an upstream library that does this conversion, but life is too short to find it. So I'm just going to write this function here.

nolint:gocyclo // TODO(jakobmoellerdev): Revisit and kill this function

func DeepCopySchema

func DeepCopySchema(schema *spec.Schema) (*spec.Schema, error)

DeepCopySchema creates a deep copy of a spec.Schema. This is useful when you need to modify a schema without affecting the original.

func GenerateSchemaFromCELTypes

func GenerateSchemaFromCELTypes(typeMap map[string]*cel.Type, provider *krocel.DeclTypeProvider) (*extv1.JSONSchemaProps, error)

GenerateSchemaFromCELTypes generates a JSONSchemaProps from a map of CEL types. The provider is used to recursively introspect struct types and extract all fields.

func GenerateSchemaFromEvals

func GenerateSchemaFromEvals(evals map[string][]ref.Val) (*extv1.JSONSchemaProps, error)

func WrapSchemaAsList

func WrapSchemaAsList(itemSchema *spec.Schema) *spec.Schema

WrapSchemaAsList wraps an OpenAPI schema as an array schema. This is used for collection resources which are typed as list(ResourceType) so other resources can reference them with CEL list functions.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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