pub struct ResponseContribution {
pub status: String,
pub description: String,
pub schema_ref: Option<String>,
}Expand description
One extra response status the layer can return (e.g. 401 from auth middleware, 429 from a rate limiter). Skipped on operations that already declare a response with the same status — handler-level declarations always win.
Fields§
§status: StringStatus code as a string (e.g. "401", "default").
description: StringHuman description rendered in the docs UI.
schema_ref: Option<String>Optional $ref path for the response body schema (e.g.
"#/components/schemas/ApiErrorBody"). Set via
ResponseContribution::with_schema_ref.
Implementations§
Source§impl ResponseContribution
impl ResponseContribution
Sourcepub fn new(status: impl Into<String>, description: impl Into<String>) -> Self
pub fn new(status: impl Into<String>, description: impl Into<String>) -> Self
Build a response contribution with the given status and description.
Convenience constructor for the standard 401 Unauthorized response.
Sourcepub fn with_schema_ref(self, ref_path: impl Into<String>) -> Self
pub fn with_schema_ref(self, ref_path: impl Into<String>) -> Self
Set the $ref path for the response body schema.
Trait Implementations§
Source§impl Clone for ResponseContribution
impl Clone for ResponseContribution
Source§fn clone(&self) -> ResponseContribution
fn clone(&self) -> ResponseContribution
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ResponseContribution
impl RefUnwindSafe for ResponseContribution
impl Send for ResponseContribution
impl Sync for ResponseContribution
impl Unpin for ResponseContribution
impl UnsafeUnpin for ResponseContribution
impl UnwindSafe for ResponseContribution
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more