rustapi-validate
Lens: "The Gatekeeper"
Philosophy: "Data validation should happen at the edges of your system, before invalid data ever reaches your business logic."
Declarative, type-safe request validation for RustAPI.
Unified Validation System
RustAPI provides a unified validation system that supports:
- Legacy Validator: The classic
validatorcrate (via#[derive(validator::Validate)]) - V2 Engine: The new native engine (via
#[derive(rustapi_macros::Validate)]) with async support - Async Validation: Database checks, API calls, and other IO-bound validation rules
Synchronous Validation
use Validate;
use Deserialize;
The ValidatedJson Extractor
use *;
async
Asynchronous Validation
For database checks (e.g., "is this email unique?"), use Async Validation:
use Validate;
The AsyncValidatedJson Extractor
use *;
async
Supported Validators
email,url,length,rangecontains,regexcustom(sync functions)custom_async(async functions)async_unique(database uniqueness)