markers

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Kubebuilder marker used in comments
	Kubebuilder = "+kubebuilder:"
)

Variables

View Source
var AllDefinitions []*definitionWithHelp

AllDefinitions contains all marker definitions for this package.

View Source
var ValidationMarkers = mustMakeAllWithPrefix("kubebuilder:validation", markers.DescribesField,
	XValidation{},
	Type(""),
)

Functions

func Register

func Register(reg *markers.Registry) error

Register registers all definitions for CRD generation to the given registry.

Types

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry() (*Registry, error)

func (*Registry) ApplyRulesToSchema

func (r *Registry) ApplyRulesToSchema(
	rules []string,
	o *openapi3.Schema,
	target markers.TargetType,
) error

func (*Registry) GetSchemaType

func (r *Registry) GetSchemaType(
	rules []string,
) Type

func (*Registry) MustApplyRulesToSchema

func (r *Registry) MustApplyRulesToSchema(
	rules []string,
	o *openapi3.Schema,
	target markers.TargetType,
)

type SchemaMarker

type SchemaMarker interface {
	ApplyToSchema(o *openapi3.Schema)
}

type Type

type Type string

Type is a marker that specifies the type of a field in the schema It only supports the following types: - object: an opaque object - value: an opauqe value

const (
	TypeObject Type = "object"
	TypeValue  Type = "value"
)

func (Type) ApplyToSchema

func (Type) ApplyToSchema(o *openapi3.Schema)

func (Type) Help

func (Type) Help() *markers.DefinitionHelp

type XValidation

type XValidation struct {
	Rule              string `json:"rule"`
	Message           string `marker:",optional" json:"message,omitempty"`
	MessageExpression string `marker:",optional" json:"messageExpression,omitempty"`
}

XValidation marks a field as requiring a value for which a given expression evaluates to true.

This marker may be repeated to specify multiple expressions, all of which must evaluate to true.

func (XValidation) ApplyToSchema

func (x XValidation) ApplyToSchema(o *openapi3.Schema)

func (XValidation) Help

Jump to

Keyboard shortcuts

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