Valitron is an ergonomics, functional and configurable validation
In the future, modularization will be supported
Inspired by axum
Features
- Ergonomics validation
- Build-in rule, e.g. Required, StartWith ...
- Closure validate
- Related validate, e.g. password confirm
- Custom rule with other parameter
- Check / modify input data
- Custom error message type
- Support different error types convert, it can use both build-in rules and custom error type simultaneously
- Collect validate error messages
- Support all types data on
#[derive(Serialize, Deserialize)]( visitserdefor more info)
Examples
Rules Usage
| Usage | Description |
|---|---|
Required |
one rule |
Required.and(StartsWith("foo")) |
multi rules |
Required.and(StartsWith('a')).bail() |
multi rules and bail |
custom(my_handler) |
custom handler rule |
Required.custom(my_handler) |
rule and handler rule |
Not(StartsWith("foo")) |
negative rule |
Required.and(Not(StartsWith("foo"))) |
negative rule |