A Go library for validating request data with simple, Laravel-inspired rules.
Govalidator is a Go package for validating HTTP request data, including form data, query parameters, and JSON payloads. It provides a simple, declarative way to define validation rules and custom messages, making it easier to ensure data integrity in web applications.
Go developers building web applications or APIs that need to validate incoming HTTP request data from various sources like forms, query strings, and JSON payloads.
Developers choose Govalidator for its intuitive, Laravel-inspired rule syntax and comprehensive built-in validation rules, which simplify data validation without sacrificing flexibility through custom rules and localized error messages.
Validate Golang request data with simple rules. Highly inspired by Laravel's request validation.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The syntax uses simple strings like 'required' and 'between:3,8', making it easy to learn, especially for developers familiar with Laravel's validation system.
It validates form data, query parameters, JSON payloads, and Go structs directly, as demonstrated in the various examples, covering most HTTP request types.
The AddCustomRule function allows for custom validation logic, and custom messages support localization, shown in the multilingual error example.
Includes over 30 rules for diverse data types such as credit cards, coordinates, and UUIDs, reducing the need for external validation packages.
Defining rules as strings can lead to typos and runtime errors that aren't caught during compilation, unlike more type-safe Go validation libraries.
While possible with custom rules, built-in validation for nested arrays or complex data structures requires additional setup, as noted in the documentation.
Documentation is split into separate markdown files for different features, which can make it less accessible than a single, comprehensive guide.