Skip to main content

JsonSchema

Derive Macro JsonSchema 

Source
#[derive(JsonSchema)]
{
    // Attributes available to this derive:
    #[schema]
}
Expand description

Derive JSON Schema for OpenAPI.

§Example

#[derive(JsonSchema)]
struct Item {
    id: i64,
    name: String,
    #[schema(nullable)]
    description: Option<String>,
}