Validation

18 projects

Validation libraries check that input such as decoded JSON, form values or configuration meets your rules before it reaches business logic. In Go they fall into two styles: struct tag validators, where rules live in tags like validate:"required,email", and code-based validators, where you declare rules with function calls. A newer group builds schemas that parse and validate in one step, similar to Zod in TypeScript.

go-playground/validator is the dominant tag-based library and the one Gin uses for request binding; it supports cross-field checks, slices, maps and custom validators. asaskevich/govalidator provides string checks and sanitizers plus tag validation. ozzo-validation takes the code-based route, so rules are ordinary Go that the compiler checks and that can depend on runtime values. gookit/validate validates maps, structs and HTTP requests with filtering. Zog follows Zod's schema-builder approach, and govy uses generics for strongly typed rules. checkdigit implements Luhn and other check digit algorithms.

If you already use Gin or tags elsewhere, validator keeps everything in one place. If rules depend on context or you dislike logic in strings, ozzo-validation or a generics-based library reads better and fails at compile time rather than at runtime. Either way, validate at the boundary where data enters, and return field-level errors your API clients can act on.

validatorby go-playground

Go Struct and Field validation, including Cross Field, Cross Struct, Map, Slice and Array diving.

github.com/go-playground/validator/v10Go 1.26+ 7 dependenciesv10.30.6updated today

20.2k

govalidatorby asaskevich

Validators and sanitizers for strings, numerics, slices and structs.

github.com/asaskevich/govalidator/v12Go 1.13+ No dependencies v11.0.1updated 1d ago

6.2k

ozzo-validationby go-ozzo

Supports validation of various data types (structs, strings, maps, slices, etc.) with configurable and extensible validation rules specified in usual code constructs instead of struct tags.

github.com/go-ozzo/ozzo-validation/v4Go 1.13+ 2 dependenciesv4.5.0updated 6d ago

4.2k

govalidatorby thedevsaddam

Validate Golang request data with simple rules. Highly inspired by Laravel's request validation.

v1.9.9updated 2y ago

1.3k

Zogby Oudwins

A Zod inspired schema builder for runtime value parsing and validation. ⬆ back to top

github.com/Oudwins/zogGo 1.23+ 3 dependenciesv0.23.0updated 2mo ago

1.2k

validateby gookit

Go package for data validation and filtering. support validate Map, Struct, Request(Form, JSON, url.Values, Uploaded Files) data and more features.

github.com/gookit/validate/v2Go 1.21+ 2 dependenciesv2.0.2updated today

1.2k

godyby guiferpa

Balloon: A lightweight struct validator for Go.

github.com/guiferpa/gody/v2Go 1.23+ No dependencies v2.2.0updated 1y ago

179

jioby faceair

Jio is a json schema validator similar to joi.

updated 2y ago

126

govalidby twharmon

Fast, tag-based validation for structs.

github.com/twharmon/govalidGo 1.26+ No dependencies v1.6.2updated 5mo ago

121

checkdigitby osamingo

Provide check digit algorithms (Luhn, Verhoeff, Damm) and calculators (ISBN, EAN, JAN, UPC, etc.).

github.com/osamingo/checkdigitGo 1.24+ No dependencies v1.1.0updated 1y ago

114

validateby gobuffalo

This package provides a framework for writing validations for Go applications.

github.com/gobuffalo/validate/v3Go 1.16+ 3 dependenciesv3.3.3updated 4y ago

94

checkerby cinar

Zero-dependency input validation and in-place normalization with struct tags, 23 locales, and JSON Schema generation.

github.com/cinar/checker/v2Go 1.23+ No dependencies v2.0.10updated 1mo ago

55

govyby nobl9

Strongly-typed validation rules over functional interface, powered by generics and reflection free with heavy focus on crafting clear and information-rich error messages.

github.com/nobl9/govyGo 1.25+ 2 dependenciesv0.30.0updated 3d ago

55

go-validatorby tiendc

Validation library using Generics.

github.com/tiendc/go-validatorGo 1.20+ 5 dependenciesv1.2.0updated 1y ago

34

valixby marrow16

Go package for validating requests

github.com/marrow16/valixGo 1.19+ 5 dependenciesv1.13.4updated 1y ago

32

hvalidby lyonnee

Hvalid is a lightweight validation library written in Go language. It provides a custom validator interface and a series of common validation functions to help developers quickly implement data validation.

github.com/lyonnee/hvalidGo 1.20+ 1 dependencyv0.1.0updated 13d ago

14

Validatorby go-the-way

A lightweight model validator written in Go.Contains VFs:Min, Max, MinLength, MaxLength, Length, Enum, Regex.

github.com/go-the-way/validatorGo 1.13+ 1 dependencyv1.1.1updated 2y ago

7

vxby sevlyar

Validation built from small, composable checks with zero dependencies and a reconstructable error path.

github.com/sevlyar/vxGo 1.24+ No dependencies v1.0.1updated 1mo ago

1
Esc

Type to search every entry. ↑↓ to move, Enter to open.