Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Satisfies ¶ added in v0.13.0
func Satisfies(a, b apiext.JSONSchemaProps) error
Satisfies checks that "a" satisfies "b" structurally Does not validate all possible apiextensionsv1 json schema extensions. Only does a loose property evaluation.
func SchemaFor ¶ added in v0.19.6
func SchemaFor[T any]() *apiext.JSONSchemaProps
SchemaFor is a utility function for calling SchemaFrom generically without providing a reflect.Type.
func SchemaFrom ¶
func SchemaFrom(typ reflect.Type) *apiext.JSONSchemaProps
SchemaFrom builds an openapi schema for a given type as described by the kubernetes apiextensions server. These schema's are used to translate Go types to openapi to be consumed by CustomResourceDefinitions.
The following JSON Tags are supported and will add their properties to the resulting schema for a given field: "Enum", "XValidations", "Maximum", "Minimum", "MaxLength", "MinLength", "MaxItems", "MinItems", "UniqueItems", "Pattern", "ExclusiveMaximum", "ExclusiveMinimum", "MultipleOf", "Format"
JSON Tags with an improper value (Say a string where an int is expected for example: `MaxLenghth:"hello"`) will cause a panic.
Types ¶
This section is empty.