pub struct Operation { /* private fields */ }Available on crate feature
openapi only.Expand description
What a client needs to know about one operation beyond its method and
path. Schemas are JSON text, normally from JsonSchema.
Implementations§
Source§impl Operation
impl Operation
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
A longer description (CommonMark).
Sourcepub fn operation_id(self, id: impl Into<String>) -> Self
pub fn operation_id(self, id: impl Into<String>) -> Self
A unique operationId (client generators name methods after it).
Sourcepub fn deprecated(self) -> Self
pub fn deprecated(self) -> Self
Mark the operation deprecated.
Sourcepub fn path_param<T: JsonSchema + ?Sized>(self, name: &str) -> Self
pub fn path_param<T: JsonSchema + ?Sized>(self, name: &str) -> Self
Path parameter name holds a T (default: a string).
Sourcepub fn path_param_schema(
self,
name: &str,
schema: &str,
description: &str,
) -> Self
pub fn path_param_schema( self, name: &str, schema: &str, description: &str, ) -> Self
Path parameter name with an explicit schema and description.
Sourcepub fn query<T: JsonSchema + ?Sized>(self) -> Self
pub fn query<T: JsonSchema + ?Sized>(self) -> Self
Query parameters: one per property of T (a struct), required as the
struct requires them — the type a handler parses the query into.
Sourcepub fn query_param(self, name: &str, schema: &str, required: bool) -> Self
pub fn query_param(self, name: &str, schema: &str, required: bool) -> Self
One query parameter with an explicit schema.
Sourcepub fn body<T: JsonSchema + ?Sized>(self) -> Self
pub fn body<T: JsonSchema + ?Sized>(self) -> Self
A required application/json request body holding a T.
Sourcepub fn body_schema(
self,
content_type: &str,
schema: &str,
required: bool,
) -> Self
pub fn body_schema( self, content_type: &str, schema: &str, required: bool, ) -> Self
A request body of content_type with an explicit schema.
Sourcepub fn response<T: JsonSchema + ?Sized>(
self,
status: u16,
description: &str,
) -> Self
pub fn response<T: JsonSchema + ?Sized>( self, status: u16, description: &str, ) -> Self
Response status with an application/json body holding a T.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Operation
impl RefUnwindSafe for Operation
impl Send for Operation
impl Sync for Operation
impl Unpin for Operation
impl UnsafeUnpin for Operation
impl UnwindSafe for Operation
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more