model

package
v0.27.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaxCardinality

func MaxCardinality(minSize int64) uint64

MaxCardinality returns the maximum number of times data conforming to the minimum size given could possibly exist in an object serialized to JSON. For cases where a schema is contained under map or array schemas of unbounded size, this can be used as an estimate as the worst case number of times data matching the schema could be repeated. Note that this only assumes a single comma between data elements, so if the schema is contained under only maps, this estimates a higher cardinality that would be possible. DeclType.MinSerializedSize is meant to be passed to this function.

func SchemaDeclType

func SchemaDeclType(s *schema.Structural, isResourceRoot bool) *apiservercel.DeclType

SchemaDeclType converts the structural schema to a CEL declaration, or returns nil if the structural schema should not be exposed in CEL expressions. Set isResourceRoot to true for the root of a custom resource or embedded resource.

Schemas with XPreserveUnknownFields not exposed unless they are objects. Array and "maps" schemas are not exposed if their items or additionalProperties schemas are not exposed. Object Properties are not exposed if their schema is not exposed.

The CEL declaration for objects with XPreserveUnknownFields does not expose unknown fields.

func WithTypeAndObjectMeta

func WithTypeAndObjectMeta(s *schema.Structural) *schema.Structural

WithTypeAndObjectMeta ensures the kind, apiVersion and metadata.name and metadata.generateName properties are specified, making a shallow copy of the provided schema if needed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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