Versions in this module Expand all Collapse all v1 v1.1.0 Sep 6, 2026 Changes in this version + type ContextError struct + func (e *ContextError) Error() string + func (e *ContextError) Report() Report + func (e *ContextError) Unwrap() []error type Report + func ContextReport(validationContext Context, ctx context.Context) Report + func (r Report) ContextError() error v1.0.0 Aug 25, 2026 Changes in this version + var ErrInvalid = errors.New("validation failed") + var ErrInvalidLimit = errors.New("invalid validation limit") + var ErrInvalidViolation = errors.New("invalid validation diagnostic") + var ErrLimitExceeded = errors.New("validation limit exceeded") + var ErrValidatorPanic = errors.New("validator panicked") + type AsyncValidator interface + ValidateAsync func(context.Context, Context, T) Report + func IsolateAsyncPanics[T any](validator AsyncValidator[T]) AsyncValidator[T] + type AsyncValidatorFunc func(context.Context, Context, T) Report + func (f AsyncValidatorFunc[T]) ValidateAsync(ctx context.Context, validationContext Context, value T) (report Report) + type Context struct + func NewContext(limits Limits, options ...ContextOption) (Context, error) + func (c Context) Limits() Limits + func (c Context) Locale() string + func (c Context) Metadata(key string) (string, bool) + func (c Context) Operation() string + func (c Context) Path() Path + func (c Context) WithPath(segment Segment) Context + type ContextOption func(*contextConfig) + func WithLocale(locale string) ContextOption + func WithMetadata(key, value string) ContextOption + func WithOperation(operation string) ContextOption + type InvalidError struct + func (e *InvalidError) Error() string + func (e *InvalidError) Report() Report + func (e *InvalidError) Unwrap() error + type Limits struct + MaxCollectionSize int + MaxCompiledPlans int + MaxCustomConcurrency int + MaxDepth int + MaxMetadataEntries int + MaxMetadataKeyLength int + MaxMetadataValueLength int + MaxPathLength int + MaxRegexPatternLength int + MaxStringLength int + MaxStructFields int + MaxTagLength int + MaxViolations int + func DefaultLimits() Limits + type Mode uint8 + const CollectAll + const ShortCircuit + type Path struct + func RootPath() Path + func (p Path) Append(segment Segment) Path + func (p Path) JSONPointer() string + func (p Path) Segments() []Segment + func (p Path) String() string + type Presence uint8 + const MissingState + const NullState + const PresentState + type Report struct + func AsyncAll[T any](ctx context.Context, validationContext Context, value T, ...) Report + func NewReport(limits Limits) Report + func (r Report) Add(violation Violation) Report + func (r Report) Empty() bool + func (r Report) Err() error + func (r Report) HasCode(code string) bool + func (r Report) HasErrors() bool + func (r Report) Len() int + func (r Report) Merge(other Report) Report + func (r Report) String() string + func (r Report) Truncated() bool + func (r Report) Violations() []Violation + type Segment struct + func Field(name string) Segment + func Index(index int) Segment + func Item() Segment + func Key(key string) Segment + func (s Segment) Kind() SegmentKind + func (s Segment) Value() string + type SegmentKind uint8 + const FieldSegment + const IndexSegment + const ItemSegment + const KeySegment + type Severity uint8 + const Error + const Warning + type Validator interface + Validate func(Context, T) Report + func All[T any](mode Mode, validators ...Validator[T]) Validator[T] + func Any[T any](mode Mode, validators ...Validator[T]) Validator[T] + func Dependent[T any](prerequisite, dependent Validator[T]) Validator[T] + func IsolatePanics[T any](validator Validator[T]) Validator[T] + func Not[T any](validator Validator[T]) Validator[T] + func When[T any](predicate func(T) bool, then, otherwise Validator[T]) Validator[T] + type ValidatorFunc func(Context, T) Report + func (f ValidatorFunc[T]) Validate(ctx Context, value T) (report Report) + type Value struct + func Missing[T any]() Value[T] + func Null[T any]() Value[T] + func Present[T any](value T) Value[T] + func (v Value[T]) Get() (T, bool) + func (v Value[T]) IsEmpty() bool + func (v Value[T]) IsPresent() bool + func (v Value[T]) IsZero() bool + func (v Value[T]) Presence() Presence + type Violation struct + func NewViolation(path Path, code string, severity Severity, parameters map[string]string, ...) Violation + func (v Violation) Cause() error + func (v Violation) Code() string + func (v Violation) Parameters() map[string]string + func (v Violation) Path() Path + func (v Violation) Severity() Severity + func (v Violation) String() string