axum_serde_valid/lib.rs
1//! [](https://crates.io/crates/axum_serde_valid)
2//! [](https://docs.rs/axum_serde_valid)
3//! [](https://github.com/Naereen/StrapDown.js/blob/master/LICENSE)
4//!
5//! This crate is a Rust library for providing validation mechanism
6//! to [axum](https://github.com/tokio-rs/axum) with [serde_valid](https://github.com/yassun7010/serde_valid) crate.
7//!
8//! More information about this crate can be found in the [crate documentation](https://docs.rs/axum_serde_valid).
9//!
10//! ## Installation
11//!
12//! This crate works with Cargo and can be found on [crates.io](https://crates.io/crates/axum_serde_valid) with a Cargo.toml like:
13//!
14//! ```toml
15//! [dependencies]
16//! axum = "^0.8"
17//! axum_serde_valid = "^1.1"
18//! serde = "^1.0"
19//! serde_valid = "^1.0"
20//! ```
21//!
22//! ## Example
23//!
24//! ```rust
25//! use axum::{routing::post, Router};
26//! use axum_serde_valid::Json;
27//! use serde::Deserialize;
28//! use serde_valid::Validate;
29//!
30//! #[derive(Deserialize, Validate)]
31//! struct User {
32//! #[validate(max_length = 3)]
33//! name: String,
34//! }
35//!
36//! let app = Router::<()>::new().route("/json", post(|user: Json<User>| async move { "hello" }));
37//! ```
38pub mod extract;
39mod json;
40
41pub use json::Json;