Skip to main content

vld_rama/
lib.rs

1//! # vld-rama — Rama integration for the `vld` validation library
2//!
3//! Provides extractors and a [`ValidateJsonLayer`] that validate HTTP request
4//! data using `vld` schemas (no `serde::Deserialize` required):
5//!
6//! | API | Source |
7//! |---|---|
8//! | [`VldJson<T>`] | JSON request body |
9//! | [`VldQuery<T>`] | URL query parameters |
10//! | [`VldPath<T>`] | URL path parameters |
11//! | [`VldForm<T>`] | URL-encoded form body |
12//! | [`VldHeaders<T>`] | HTTP headers |
13//! | [`VldCookie<T>`] | Cookie values |
14//! | [`ValidateJsonLayer<T>`] | Middleware for Service stacks |
15//!
16//! All extractors return **422 Unprocessable Entity** on validation failure.
17//!
18//! Requires Rust **1.96+** (Rama MSRV).
19
20mod extract;
21mod layer;
22mod rejection;
23
24pub use extract::{VldCookie, VldForm, VldHeaders, VldJson, VldPath, VldQuery};
25pub use layer::{try_validated, validated, ValidateJsonLayer, ValidateJsonService, Validated};
26pub use rejection::VldRejection;
27
28/// Prelude — import everything you need.
29pub mod prelude {
30    pub use crate::{
31        try_validated, validated, ValidateJsonLayer, ValidateJsonService, Validated, VldCookie,
32        VldForm, VldHeaders, VldJson, VldPath, VldQuery, VldRejection,
33    };
34    pub use vld::prelude::*;
35}