pub struct Operation {
pub tags: Vec<String>,
pub summary: Option<String>,
pub description: Option<String>,
pub operation_id: Option<String>,
pub parameters: Vec<Parameter>,
pub request_body: Option<RequestBody>,
pub responses: BTreeMap<String, Response>,
pub deprecated: bool,
pub security: Vec<BTreeMap<String, Vec<String>>>,
}Expand description
A single API operation.
Fields§
Grouping tags.
summary: Option<String>One-line summary.
description: Option<String>Longer description.
operation_id: Option<String>Unique operation id.
parameters: Vec<Parameter>Parameters (path, query, header, cookie).
request_body: Option<RequestBody>Request body.
responses: BTreeMap<String, Response>Responses keyed by status code ("200") or "default".
deprecated: boolDeprecated flag.
security: Vec<BTreeMap<String, Vec<String>>>Security requirements.
Implementations§
Source§impl Operation
impl Operation
Sourcepub fn add_parameter(&mut self, parameter: Parameter)
pub fn add_parameter(&mut self, parameter: Parameter)
Add a parameter unless one with the same name and location exists.
Path parameters may be pushed with an empty name; the builder names
them positionally from the path template.
Sourcepub fn set_request_body(
&mut self,
media_type: &str,
schema: SchemaObject,
required: bool,
)
pub fn set_request_body( &mut self, media_type: &str, schema: SchemaObject, required: bool, )
Set the request body to schema with the given media type.
Sourcepub fn add_response(
&mut self,
status: impl Into<String>,
description: impl Into<String>,
content: Option<(&str, SchemaObject)>,
)
pub fn add_response( &mut self, status: impl Into<String>, description: impl Into<String>, content: Option<(&str, SchemaObject)>, )
Add (or replace) a response.
Sourcepub fn remap_response(&mut self, from: &str, to: &str)
pub fn remap_response(&mut self, from: &str, to: &str)
Move the response documented under from to to (status override).
Trait Implementations§
impl StructuralPartialEq for Operation
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