Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Validate ¶
func Validate(dataType DataType, input []byte, opts ...ValidateOption) error
Validate validates the input provided in two phases:
- Validate the general structure of the resource or message based on the Type.
- Validate the specific structure of the resource or message based on the Kind.
A Kind can be optionally specified in order to fail early if the input's Kind does match what was provided. This is useful when the Kind is known ahead of time. If the Kind is not specified, validation will proceed to phase 2 using metadata.kind.
Note ¶
Kind-specific schemas are lazily loaded the first time they are needed and then cached for future use.
Types ¶
type DataType ¶
type DataType string
DataType represents the type of data being validated e.g. resource or message
type ValidateOption ¶
type ValidateOption func(*validateOptions)
ValidateOption is a function that sets an option for the Validate function
func WithKind ¶
func WithKind(kind string) ValidateOption
WithKind sets the kind option for the Validate function
Click to show internal directories.
Click to hide internal directories.