Documentation
¶
Index ¶
- Variables
- func ConvertJSONSchemaPropsToSpecSchema(props *extv1.JSONSchemaProps) (*spec.Schema, error)
- func DeepCopySchema(schema *spec.Schema) (*spec.Schema, error)
- func GenerateSchemaFromCELTypes(typeMap map[string]*cel.Type, provider *krocel.DeclTypeProvider) (*extv1.JSONSchemaProps, error)
- func GenerateSchemaFromEvals(evals map[string][]ref.Val) (*extv1.JSONSchemaProps, error)
- func WrapSchemaAsList(itemSchema *spec.Schema) *spec.Schema
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidEvaluationTypes is returned when the evaluation types are not valid // for generating a schema. ErrInvalidEvaluationTypes = errors.New("invalid evaluation type") )
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 ¶
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 ¶
Types ¶
This section is empty.