#validation #flexible #credit-card #uuid #ip #internationalization #axum #json-validation #json-parser

no-std skp-validator

The most advanced, flexible and modular validation library for Rust

1 unstable release

Uses new Rust 2024

0.1.0 Jan 17, 2026

#11 in #credit-card


Used in skp-validator-jsonschema

MIT license

220KB
4.5K SLoC

skp-validator

The most advanced, flexible, and high-performance validation library for Rust.

Features

  • Declarative: Use attributes on your structs.
  • Modern: Fully optimized for Rust 2024 Edition.
  • Fast: Capable of validating millions of fields per second.
  • Extensible: Add custom rules and framework adapters easily.

For full documentation and examples, please visit the main repository.


lib.rs:

skp-validator

The most advanced, flexible and modular validation library for Rust.

Features

  • Declarative Validation: Use derive macros with powerful attributes
  • 30+ Built-in Validators: email, url, ip, uuid, phone, credit_card, etc.
  • Nested Validation: Automatic validation of nested structs
  • Collection Validation: Dive into Vec, HashMap, Option
  • Field Dependencies: Conditional validation based on other fields
  • Field Transformations: uppercase, lowercase, trim
  • Structured Errors: Nested, JSON-serializable error format
  • Runtime JSON Validation: Validate JSON without deserialization
  • i18n Support: Localized error messages
  • Framework Adapters: Axum, Actix integration

Quick Start

use skp_validator::Validate;

#[derive(Validate)]
struct User {
    #[validate(required, length(min = 3, max = 50))]
    name: String,

    #[validate(required, email)]
    email: String,

    #[validate(range(min = 18, max = 120))]
    age: Option<u32>,

    #[validate(nested)]
    address: Address,

    #[validate(dive, length(min = 1, max = 20))]
    tags: Vec<String>,
}

let user = User { /* ... */ };
match user.validate() {
    Ok(()) => println!("Valid!"),
    Err(errors) => println!("Errors: {}", errors),
}

Dependencies

~0.3–4.5MB
~49K SLoC