#validation #serde #json-schema

axum_serde_valid

Axum extractor sets of JSON validation

19 releases (4 breaking)

0.16.3 Jul 30, 2023
0.16.1 May 1, 2023
0.15.0 Mar 19, 2023
0.12.0-beta.10 Nov 3, 2022

#875 in Encoding

Download history 9/week @ 2023-08-13 7/week @ 2023-08-20 30/week @ 2023-08-27 60/week @ 2023-09-03 3/week @ 2023-09-10 3/week @ 2023-09-17 3/week @ 2023-09-24 5/week @ 2023-10-01 2/week @ 2023-10-08 11/week @ 2023-10-15 25/week @ 2023-10-22 20/week @ 2023-10-29 5/week @ 2023-11-05 23/week @ 2023-11-12 5/week @ 2023-11-19 60/week @ 2023-11-26

93 downloads per month

MIT license

210KB
4K SLoC

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.6"
axum_serde_valid = { version = "13", features = ["jsonschema"] }
jsonschema  = "^0.16"
schemars  = "0.8"

Feature Flags

Example

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

#[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

Dependencies

~17–27MB
~416K SLoC