Skip to main content

DocOperationSecurity

Trait DocOperationSecurity 

Source
pub trait DocOperationSecurity {
    // Required method
    fn describe(op: &mut Operation);
}
Expand description

Extractor-side contribution of per-operation security/permission metadata. Implemented by per-route guards (e.g. a permission extractor that names the action it requires) so the resulting OpenAPI operation documents the requirement.

Prefer this over crate::DocumentedLayer when the requirement varies per handler — DocumentedLayer stamps the same contribution on every operation a layer covers, which is the right tool for blanket “must be authenticated” declarations but the wrong tool for per-route permissions.

Implementations typically emit both a standard SecurityRequirement (so OpenAPI codegen sees the required scope) and an x-required-permissions extension (so doc UIs surface a human-readable badge). The crate::record_required_permission helper does the dual write in one call.

Required Methods§

Source

fn describe(op: &mut Operation)

Append this extractor’s security/permission metadata to op.

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.

Implementors§