Skip to content
Node: zod, joigithub.com/sahilkhaire/gox/validate

ValidationError

Overview

ValidationError holds human-readable validation messages.

Part of the validate package — Node.js analog: zod, joi.

ValidationError is a type exported by gox. Methods on this type are documented separately.

Signature

go
type ValidationError struct {
	Messages []string
}

Compare: Node.js · Standard Go · gox

js
// Typical zod, joi pattern in Node.js
go
// use github.com/go-playground/validator struct tags or manual checks
go
import "github.com/sahilkhaire/gox/validate"

var verr validate.ValidationError
if errors.As(err, &verr) {
	fmt.Println(verr.Error())
}

Example

go
import "github.com/sahilkhaire/gox/validate"

var verr validate.ValidationError
if errors.As(err, &verr) {
	fmt.Println(verr.Error())
}

Tips

Browse methods on this type in the sidebar for handler-style APIs and options structs.

Standard library alternative

gox wraps the Go standard library or a trusted dependency with Node-familiar naming. You can use the underlying library directly — see the package overview for escape hatches.

Back to validate package overview

MIT Licensed · Built for Node.js developers moving to Go