Skip to content
V

Validator

Go Struct and Field validation, including Cross Field, Cross Struct, Map

by go-playgroundFree

#237in Utilities
0In stores

Description

validator is a Go package that validates struct fields and values based on tags. It supports cross-field and cross-struct validations, both…

Highlights

  • Struct and field validation by tags
  • Cross-field and cross-struct checks
  • Dives into slices, arrays and maps
  • Custom tag aliases and error field names
  • Translatable error messages

Ratings & Reviews

No ratings yet

Be the first to rate Validator.

People also visit

G

Govalid

Up to 45x faster. Auto generate type-safe validation code

Developer Tools
Launch
G

golang-error-handling

Idiomatic Golang error handling

AI Skills
Get
F

Form

A Form Encoding & Decoding Package for Go

Productivity
Launch
G

golang-design-patterns

Idiomatic Golang design patterns

AI Skills
Get
G

go-code-review

Reviewing Go code or checking code against community style standards

AI Skills
Get
G

golang-security

Security best practices and vulnerability prevention for Golang

AI Skills
Get

Validator FAQ

What does validator do?

It validates Go structs and fields based on struct tags, including cross-field checks and checks inside slices, arrays and maps.

How do I install it?

Run go get github.com/go-playground/validator/v10 and import it.

Is it used by Gin?

Yes. It is the default validator for the Gin web framework.

Can I customize error messages?

Yes. Error messages are customizable and i18n aware, according to the README.

Where is the usage reference?

On pkg.go.dev, linked from the README.

What are the best Validator alternatives?

Popular alternatives to Validator include Zog and Go Webapp Sample. See all Validator alternatives

Developer Stuff

Badges