validate

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package validate implements the value checks Apple's device-management schema declares on payload keys: closed value sets (rangelist), numeric bounds (range), regular-expression formats, array cardinality (repetition) and string subtypes (<url>, <hostname>, <email>).

Generated Validate() methods call these helpers; they are exported so hand-written code can reuse the same semantics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Email

func Email(field, v string) error

Email checks the <email> subtype.

func FloatRange

func FloatRange(field string, v float64, min, max *float64) error

FloatRange checks real-number bounds from the spec's range block.

func Format

func Format(field, v, pattern string) error

Format checks v against the spec's regular-expression format. Patterns are anchored to the full value, matching the spec's intent.

func Hostname

func Hostname(field, v string) error

Hostname checks the <hostname> subtype (RFC 1123 labels).

func InList

func InList[T comparable](field string, v T, allowed []T) error

InList checks membership of v in the spec's rangelist.

func Indexed

func Indexed(field string, i int, err error) error

Indexed wraps an array item's validation error with its position.

func IntRange

func IntRange(field string, v int64, min, max *int64) error

IntRange checks integer bounds from the spec's range block.

func Nested

func Nested(field string, err error) error

Nested wraps a nested dictionary's validation error with its key.

func Repetition

func Repetition(field string, n, min, max int) error

Repetition checks array cardinality from the spec's repetition block.

func Required

func Required(field string) error

Required reports a missing required key.

func URL

func URL(field, v string) error

URL checks the <url> subtype: an absolute URL with a scheme and host.

Types

This section is empty.

Jump to

Keyboard shortcuts

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