π§© Valida β Modular Validation Library for Rust
Valida is a robust and extensible validation system for Rust, designed for flexibility, clarity, and internationalization. It supports both synchronous and asynchronous validators, custom rule injection, nested structures, and ergonomic error handling.
β¨ Features
β Sync & Async Support Mix traditional and async validation with ease β ideal for scenarios involving databases, APIs, or file systems.
π Custom Validators Implement your own logic: both sync and async rules are supported via traits.
π Built-in i18n (Internationalization) Comes with out-of-the-box support for 10 major languages (en, es, de, fr, uk, etc.) and can be easily extended or overridden using rust-i18n.
π§± Nested Validation Support Validate deeply nested fields inside Option, Vec, Arc, HashMap and custom structs.
π§ͺ DSL or Macro-Based Configuration Choose your style: configure validators declaratively using a fluent DSL or use Rust macros for brevity β or combine both approaches.
π§ Precise Error Separation Validation errors are clearly separated from system-level failures (e.g. DB connection issues), simplifying custom error management and debugging.
π Flexible Output Formats Validation errors can be rendered as structured messages in formats like JSON, tree views, or localized text.
π§ Debug-Friendly Nested Error Tree
profile:
age: age.too_young
device:
name: Minimum length is 2 characters
email: Minimum length is 5 characters
optional:
age: age.too_young
device:
name: Minimum length is 2 characters
devices:
0:
device:
name: Minimum length is 2 characters
age: age.too_young
π§ Simple Example Macro style
use *;
async
π§ Simple Example DSL style
use *;
;
;
async
π Documentation
For extended documentation and advanced guides:
#StandForUkraine πΊπ¦
This project aims to show support for Ukraine and its people amidst a war that has been ongoing since 2014. This war has a genocidal nature and has led to the deaths of thousands, injuries to millions, and significant property damage. We believe that the international community should focus on supporting Ukraine and ensuring security and freedom for its people.