// Package valid wraps github.com/go-playground/validator/v10 behind a minimal // Validator interface, returning xerrors-typed errors with stable codes. // // The backend library is fully hidden — callers interact only with Validator // and *xerrors.Err. Swapping the backend in the future requires no API changes. // // Usage: // // v := valid.New() // if err := v.Struct(req); err != nil { // // err is *xerrors.Err with Code() == xerrors.ErrInvalidInput // // err.Fields()["field"] contains the failing field name // } // // // Spanish messages // v := valid.New(valid.WithMessageProvider(valid.SpanishMessages)) // // Struct tags follow go-playground/validator conventions: // // type CreateUserReq struct { // Email string `json:"email" validate:"required,email"` // Age int `json:"age" validate:"min=18"` // } package valid