facet-jsonschema

Crates.iofacet-jsonschema
lib.rsfacet-jsonschema
version0.28.0
created_at2025-04-25 15:28:26.333167+00
updated_at2025-07-25 13:13:08.613879+00
descriptionGenerate 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.
homepage
repositoryhttps://github.com/facet-rs/facet-jsonschema
max_upload_size
id1649128
size35,576
Amos Wenger (fasterthanlime)

documentation

README

Facet logo - a reflection library for Rust

Coverage Status 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

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.

Commit count: 0

cargo fmt