| Crates.io | facet-json-schema |
| lib.rs | facet-json-schema |
| version | 0.43.2 |
| created_at | 2025-12-31 12:33:37.99805+00 |
| updated_at | 2026-01-23 18:06:23.014198+00 |
| description | Generate JSON Schema from facet type metadata |
| homepage | https://facet.rs |
| repository | https://github.com/facet-rs/facet |
| max_upload_size | |
| id | 2014615 |
| size | 52,197 |
Generate JSON Schema from facet type metadata.
This crate uses facet's reflection capabilities to generate JSON Schema definitions
from any type that implements Facet. The generated schemas can be used for:
use facet::Facet;
use facet_json_schema::to_schema;
#[derive(Facet)]
struct User {
name: String,
age: u32,
email: Option<String>,
}
let schema = to_schema::<User>();
println!("{}", schema);
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"name": { "type": "string" },
"age": { "type": "integer", "minimum": 0, "maximum": 4294967295 },
"email": { "type": "string" }
},
"required": ["name", "age"]
}
Thanks to all individual sponsors:
...along with corporate sponsors:
...without whom this work could not exist.
The facet logo was drawn by Misiasart.
Licensed under either of:
at your option.