axum_serde_valid

Crates.ioaxum_serde_valid
lib.rsaxum_serde_valid
version1.1.0
created_at2022-11-03 06:10:00.998945+00
updated_at2025-01-06 07:09:58.134744+00
descriptionAxum extractor sets of JSON validation.
homepage
repositoryhttps://github.com/yassun7010/axum_serde_valid.git
max_upload_size
id704065
size13,513
ya7010 (ya7010)

documentation

README

axum_serde_valid

Latest Version Documentation GitHub license

This crate is a Rust library for providing validation mechanism to axum with serde_valid crate.

More information about this crate can be found in the crate documentation.

Installation

This crate works with Cargo and can be found on crates.io with a Cargo.toml like:

[dependencies]
axum = "^0.8"
axum_serde_valid = "^1.1"
serde = "^1.0"
serde_valid = "^1.0"

Example

use axum::{routing::post, Router};
use axum_serde_valid::Json;
use serde::Deserialize;
use serde_valid::Validate;

#[derive(Deserialize, Validate)]
struct User {
    #[validate(max_length = 3)]
    name: String,
}

let app = Router::<()>::new().route("/json", post(|user: Json<User>| async move { "hello" }));

License: MIT

Commit count: 0

cargo fmt