validation

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DNS1123LabelMaxLength int = 63

DNS1123LabelMaxLength is a label's max length in DNS (RFC 1123)

View Source
const DNS1123SubdomainMaxLength int = 253

DNS1123SubdomainMaxLength is a subdomain's max length in DNS (RFC 1123)

View Source
const LabelValueMaxLength int = 63

LabelValueMaxLength is a label's max length

Variables

View Source
var IsQualifiedName = IsLabelKey

IsQualifiedName tests whether the value passed is what Kubernetes calls a "qualified name", which is the same as a label key.

Deprecated: use IsLabelKey instead.

Functions

func EmptyError

func EmptyError() string

EmptyError returns a string explanation of an "empty string" validation.

func IsDNS1123Label

func IsDNS1123Label(value string) []string

IsDNS1123Label tests for a string that conforms to the definition of a label in DNS (RFC 1123).

func IsDNS1123Subdomain

func IsDNS1123Subdomain(value string) []string

IsDNS1123Subdomain tests for a string that conforms to the definition of a subdomain in DNS (RFC 1123) lowercase.

func IsDNS1123SubdomainCaseless deprecated

func IsDNS1123SubdomainCaseless(value string) []string

IsDNS1123SubdomainCaseless tests for a string that conforms to the definition of a subdomain in DNS (RFC 1123).

Deprecated: API validation should never be caseless. Caseless validation is a vector for bugs and failed uniqueness assumptions. For example, names like "foo.com" and "FOO.COM" are both accepted as valid, but they are typically not treated as equal by consumers (e.g. CSI and DRA driver names). This fails the "least surprise" principle and can cause inconsistent behaviors.

Note: This allows uppercase names but is not caseless — uppercase and lowercase are treated as different values. Use IsDNS1123Subdomain for strict, lowercase validation instead.

func IsLabelKey

func IsLabelKey(value string) []string

IsLabelKey tests whether the value passed is a valid label key. This format is used to validate many fields in the Kubernetes API. Label keys consist of an optional prefix and a name, separated by a '/'. If the value is not valid, a list of error strings is returned. Otherwise, an empty list (or nil) is returned.

func IsLabelValue

func IsLabelValue(value string) []string

IsLabelValue tests whether the value passed is a valid label value. If the value is not valid, a list of error strings is returned. Otherwise an empty list (or nil) is returned.

func MaxLenError

func MaxLenError(length int) string

MaxLenError returns a string explanation of a "string too long" validation failure.

func RegexError

func RegexError(msg string, re string, examples ...string) string

RegexError returns a string explanation of a regex validation failure.

Types

This section is empty.

Jump to

Keyboard shortcuts

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