pub trait AuthSchemaMetadata {
// Required method
fn requirements() -> &'static [(&'static str, &'static str)];
}Expand description
Compile-time metadata about which fields or variants require capabilities.
This trait is generated by #[derive(AuthSchema)] from the
mcp-authorization-macros crate. Each #[requires("capability")]
annotation on a struct field or enum variant produces an entry in the
returned static slice.
You can also implement this manually:
use mcp_authorization::AuthSchemaMetadata;
struct MyInput {
pub name: String,
pub secret_field: Option<String>,
}
impl AuthSchemaMetadata for MyInput {
fn requirements() -> &'static [(&'static str, &'static str)] {
&[("secret_field", "admin")]
}
}Required Methods§
Sourcefn requirements() -> &'static [(&'static str, &'static str)]
fn requirements() -> &'static [(&'static str, &'static str)]
Returns (field_or_variant_name, capability_name) pairs.
For structs, the first element is the field name (matching the JSON property name). For enums, the first element is the variant name.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".