Json Schema Derive
This crate provides a #[derive(JsonSchema)]
macro that generates a JSON Schema for your types. It supports custom schema attributes via #[json_schema(...)]
and optionally integrates with common serde
attributes when the serde-compat
feature is enabled.
Installation
Add to your Cargo.toml
:
[]
= { = "0.0.1", = ["serde-compat"] }
Usage
Basic Usage
use JsonSchema;
let schema = json_schema;
Custom Attributes
Use json_schema
to add arbitrary JSON Schema metadata:
Serde Compatibility
When the serde-compat
feature is enabled, the following serde
attributes are supported for schema generation:
,
Cat ,
}
Features
serde-compat
: Enables compatibility with serde attributes for schema generation
License
MIT License