#json-schema #reflection #deserialize #serialization #json-parser

facet-jsonschema

Generate JSON Schema from Facet types. Provides a to_string function to get a JSON Schema representation as a string. Useful for reflection, introspection, serialization, and deserialization.

31 releases (8 breaking)

Uses new Rust 2024

new 0.23.21 Jun 17, 2025
0.23.15 May 31, 2025

#1284 in Encoding

Download history 232/week @ 2025-04-20 342/week @ 2025-04-27 436/week @ 2025-05-04 776/week @ 2025-05-11 490/week @ 2025-05-18 443/week @ 2025-05-25 561/week @ 2025-06-01 45/week @ 2025-06-08 238/week @ 2025-06-15

1,383 downloads per month

MIT/Apache

515KB
10K SLoC

Facet logo - a reflection library for Rust

Coverage Status free of syn crates.io documentation MIT/Apache-2.0 licensed Discord

Logo by Misiasart

Thanks to all individual and corporate sponsors, without whom this work could not exist:

Ko-fi GitHub Sponsors Patreon Zed Depot

JSON Schema generation for Facet

This module provides functionality to generate JSON Schema from Facet types.

The main function is to_string, which takes a Facet type and returns its JSON Schema representation as a string.

Example

use facet_jsonschema::to_string;
use facet::Facet;

#[derive(Facet)]
struct TestStruct {
    /// String field
    string_field: String,
    /// Integer field
    int_field: u32,
}

let schema = to_string::<TestStruct>();
println!("JSON Schema: {schema}");

License

Licensed under either of:

at your option.

Dependencies

~550KB
~10K SLoC