pub trait FieldSchema {
// Required method
fn field_schema() -> RefOr<Schema>;
}Expand description
Helper trait that provides OpenAPI schema generation for types used as resource attribute fields.
This exists because utoipa::PartialSchema is a foreign trait, so we
can’t impl it for foreign types like uuid::Uuid due to orphan rules.
The extension macro generates calls to
<Type as cinderblock_json_api::FieldSchema>::field_schema() instead of
<Type as utoipa::PartialSchema>::schema().
Types that derive utoipa::ToSchema (which implies PartialSchema)
can use the blanket impl via the partial_schema_field_schema! macro.
Common built-in types (String, integers, bool, Uuid) have
explicit impls provided here.
Required Methods§
fn field_schema() -> RefOr<Schema>
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.