pub trait Schema {
// Required method
fn schema(registry: &mut SchemaRegistry) -> SchemaObject;
// Provided method
fn schema_name() -> Option<&'static str> { ... }
}Expand description
Types that can describe themselves as JSON Schema.
Required Methods§
Sourcefn schema(registry: &mut SchemaRegistry) -> SchemaObject
fn schema(registry: &mut SchemaRegistry) -> SchemaObject
The schema definition of this type. Use
SchemaRegistry::subschema for nested types.
Provided Methods§
Sourcefn schema_name() -> Option<&'static str>
fn schema_name() -> Option<&'static str>
Stable component name. Named types are emitted once under
components.schemas and referenced with $ref.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl Schema for String
impl Schema for String
fn schema(_: &mut SchemaRegistry) -> SchemaObject
Source§impl Schema for Value
Any JSON value: the empty schema.
impl Schema for Value
Any JSON value: the empty schema.