Skip to content

tamasfe/verify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Status

I don't have time to fully finish and maintain this library, and JSON schema validation in its current form is very limited and extremely inefficient.

I advise everyone not to use it if possible.

That being said, if anyone would like to continue it, I'll gladly grant maintainer access or even transfer ownership. I'm also open to giving up the name on crates.io if anyone wants it.

Verify

Latest Version Documentation

Verify is yet another validation library for Rust. Its main concept consists of validators that can validate values of any kind of structure. The idea is based on Serde's model, and there is even an optional wrapper for Serde-compatible types.

Basic Usage

The library itself without features doesn't do much, it only provides trait definitions and common types.

In order to use it you need to write or find a validator, or enable one of the implementation features of the library. There is official support only for Schemars at the moment.

This very basic example shows how to create a self-validating type with Verify and Schemars:

(Schemars doesn't yet provide a way to add additional rules during derive, but will in the future.)

#[derive(Default, Verify, Serialize, JsonSchema)]
#[verify(schemars, serde)]
struct ExampleStruct {
    example_value: i32,
}

fn main() {
    let example = ExampleStruct::default();
    
    // This will always return Ok(())
    assert!(example.verify().is_ok());
}

There are quite a few things happening behind the scenes. For more details, visit the documentation.

For more examples visit the examples directory.

Cargo Features

By default only the smallvec feature is enabled.

serde

Serde integration, it enables validating any value that implements Serialize.

smallvec

Use smallvec for some types instead of Vec in the library.

schemars

Enable Schemars integration by implementing Validator, Verifier and Verify for its schema types.

About

A Rust data validation library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages