Skip to main content

JsonSchema

Trait JsonSchema 

Source
pub trait JsonSchema {
    // Required method
    fn schema() -> Schema;

    // Provided method
    fn schema_name() -> Option<&'static str> { ... }
}
Expand description

Trait for types that can generate JSON Schema.

Required Methods§

Source

fn schema() -> Schema

Generate the JSON Schema for this type.

Provided Methods§

Source

fn schema_name() -> Option<&'static str>

Get the schema name for use in #/components/schemas/.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl JsonSchema for bool

Source§

impl JsonSchema for f64

Source§

impl JsonSchema for i32

Source§

impl JsonSchema for i64

Source§

impl JsonSchema for String

Source§

impl<T: JsonSchema> JsonSchema for Option<T>

Source§

impl<T: JsonSchema> JsonSchema for Vec<T>

Implementors§