primitives

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

This is a test package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterValidations

func RegisterValidations(scheme *testscheme.Scheme) error

RegisterValidations adds validation functions to the given scheme. Public to allow building arbitrary schemes.

func Validate_T1

func Validate_T1(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *T1) (errs field.ErrorList)

func Validate_T2

func Validate_T2(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *T2) (errs field.ErrorList)

Types

type T1

type T1 struct {
	TypeMeta int

	// +k8s:validateFalse="field T1.S"
	S string `json:"s"`
	// +k8s:validateFalse="field T1.I"
	I int `json:"i"`
	// +k8s:validateFalse="field T1.B"
	B bool `json:"b"`
	// +k8s:validateFalse="field T1.F"
	F float64 `json:"f"`

	// +k8s:validateFalse="field T1.T2"
	T2 T2 `json:"t2"`

	// No internal validations.
	T3 T3 `json:"t3"`

	// Duplicate types with no validation.
	AnotherS  string  `json:"anothers"`
	AnotherI  int     `json:"anotheri"`
	AnotherB  bool    `json:"anotherb"`
	AnotherF  float64 `json:"anotherf"`
	AnotherT2 T2      `json:"anothert2"`
}

type T2

type T2 struct {
	// +k8s:validateFalse="field T2.S"
	S string `json:"s"`
	// +k8s:validateFalse="field T2.I"
	I int `json:"i"`
	// +k8s:validateFalse="field T2.B"
	B bool `json:"b"`
	// +k8s:validateFalse="field T2.F"
	F float64 `json:"f"`
}

Note: This has validations and is linked into the type-graph of T1.

type T3

type T3 struct {
	S string  `json:"s"`
	I int     `json:"i"`
	B bool    `json:"b"`
	F float64 `json:"f"`
}

Note: This has no validations and is linked into the type-graph of T1.

type T4

type T4 struct {
	// +k8s:validateFalse="field T4.S"
	S string `json:"s"`
	// +k8s:validateFalse="field T4.I"
	I int `json:"i"`
	// +k8s:validateFalse="field T4.B"
	B bool `json:"b"`
	// +k8s:validateFalse="field T4.F"
	F float64 `json:"f"`
}

Note: This has validations and is not linked into the type-graph of T1.

type T5

type T5 struct {
	S string  `json:"s"`
	I int     `json:"i"`
	B bool    `json:"b"`
	F float64 `json:"f"`
}

Note: This has no validations and is not linked into the type-graph of T1.

Jump to

Keyboard shortcuts

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