pub trait Schema { }Expand description
Marker trait implemented by every #[derive(Schema)] type.
The derive macro auto-implements this trait, which is intentionally
empty — it carries no methods. Its purpose is to anchor the
compile-time leaf-type assertions emitted by #[derive(Schema)]:
for every field whose type is not a builtin OpenAPI primitive,
not serde_json::Value, and not marked #[schema(any)], the
derive emits a T: ::vespera::Schema bound assertion against the
field’s leaf type. An unbound leaf — typically a custom struct
that forgot its own #[derive(Schema)] — becomes a compile error
at the field site instead of silently emitting {type:object}
into the OpenAPI document.
Users normally never name this trait directly — #[derive(Schema)]
is the entire user surface. If you intentionally want a field to
stay as opaque {type:object} (arbitrary JSON), mark it with
#[schema(any)] to skip the assertion AND lock the schema to
object. serde_json::Value fields are allowlisted automatically.
The trait and the vespera::Schema derive macro share the same
name but live in different namespaces (trait vs. derive-macro), so
the existing #[derive(Schema)] syntax continues to work
unchanged.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".