Struct validation backed by go-playground/validator/v10 with xerrors integration and pluggable i18n message providers. What's included: - Validator interface with Struct(v any) error method - New(...Option) constructor with WithMessageProvider functional option - MessageProvider interface for i18n; DefaultMessages (EN) and SpanishMessages (ES) built in - ValidationErrors mapped to xerrors.ErrInvalidInput with field and tag context keys - InvalidValidationError (non-struct input) mapped to xerrors.ErrInternal - Full playground.ValidationErrors attached via WithError for callers needing all failures Tested-via: todo-api POC integration Reviewed-against: docs/adr/
19 lines
500 B
Modula-2
19 lines
500 B
Modula-2
module code.nochebuena.dev/go/valid
|
|
|
|
go 1.25
|
|
|
|
require (
|
|
code.nochebuena.dev/go/xerrors v0.9.0
|
|
github.com/go-playground/validator/v10 v10.30.1
|
|
)
|
|
|
|
require (
|
|
github.com/gabriel-vasile/mimetype v1.4.12 // indirect
|
|
github.com/go-playground/locales v0.14.1 // indirect
|
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
|
github.com/leodido/go-urn v1.4.0 // indirect
|
|
golang.org/x/crypto v0.46.0 // indirect
|
|
golang.org/x/sys v0.39.0 // indirect
|
|
golang.org/x/text v0.32.0 // indirect
|
|
)
|