Documentation
¶
Overview ¶
Package validation provides neutral primitives for domain-local validation.
Each domain (notifications, etc.) defines its own Code constants and validation functions that return []Issue. Adapters at each call site map those issues to the error shape required by the caller (config-path message, API field name, runtime sentinel-wrapped error, etc.).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Issue ¶
type Issue struct {
Field string
Code string
// Value carries the offending input when useful to the message.
// Most issues leave it empty.
Value string
}
Issue describes one validation failure.
Codes are owned by the calling domain. Domains define stable string constants for each rule (for example "url_required") and place them directly into Code. The Field name is domain-local (for example "url"); adapters prefix it when formatting messages for a specific context.
type Issues ¶
type Issues []Issue
Issues is a slice of Issue. Defined as a named type so future helpers can hang off it without disturbing call sites.
type Mode ¶
type Mode int
Mode controls whether a mode-aware domain validator tolerates an empty configuration. Per-domain semantics are documented at each Validate function.
const ( // AllowEmpty accepts a fully empty configuration. Each domain defines what // "empty" means (all fields blank, no activation field set, etc.) and what // follows when the configuration is non-empty. AllowEmpty Mode = iota // RequireComplete requires all fields needed to perform the action. RequireComplete )