Struct salvo_oapi::operation::Operation
source · #[non_exhaustive]pub struct Operation {Show 13 fields
pub tags: Vec<String>,
pub summary: Option<String>,
pub description: Option<String>,
pub operation_id: Option<String>,
pub external_docs: Option<ExternalDocs>,
pub parameters: Parameters,
pub request_body: Option<RequestBody>,
pub responses: Responses,
pub callbacks: Option<String>,
pub deprecated: Option<Deprecated>,
pub securities: Vec<SecurityRequirement>,
pub servers: Servers,
pub extensions: Option<HashMap<String, Value>>,
}
Expand description
Implements OpenAPI Operation Object object.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.List of tags used for grouping operations.
When used with derive #[salvo_oapi::endpoint(...)]
attribute macro the default
value used will be resolved from handler path provided in #[openapi(paths(...))]
with
#[derive(OpenApi)]
macro. If path resolves to None
value crate
will
be used by default.
summary: Option<String>
Short summary what Operation
does.
When used with derive #[salvo_oapi::endpoint(...)]
attribute macro the value
is taken from first line of doc comment.
description: Option<String>
Long explanation of Operation
behaviour. Markdown syntax is supported.
When used with derive #[salvo_oapi::endpoint(...)]
attribute macro the
doc comment is used as value for description.
operation_id: Option<String>
Unique identifier for the API Operation
. Most typically this is mapped to handler function name.
When used with derive #[salvo_oapi::endpoint(...)]
attribute macro the handler function
name will be used by default.
external_docs: Option<ExternalDocs>
Additional external documentation for this operation.
parameters: Parameters
List of applicable parameters for this Operation
.
request_body: Option<RequestBody>
Optional request body for this Operation
.
responses: Responses
List of possible responses returned by the Operation
.
callbacks: Option<String>
Callback information.
deprecated: Option<Deprecated>
Define whether the operation is deprecated or not and thus should be avoided consuming.
securities: Vec<SecurityRequirement>
Declaration which security mechanisms can be used for for the operation. Only one
SecurityRequirement
must be met.
Security for the Operation
can be set to optional by adding empty security with
SecurityRequirement::default
.
servers: Servers
§extensions: Option<HashMap<String, Value>>
Optional extensions “x-something”
Implementations§
source§impl Operation
impl Operation
Add or change tags of the Operation
.
sourcepub fn add_tag<S: Into<String>>(self, tag: S) -> Self
pub fn add_tag<S: Into<String>>(self, tag: S) -> Self
Append tag to Operation
tags and returns Self
.
sourcepub fn summary<S: Into<String>>(self, summary: S) -> Self
pub fn summary<S: Into<String>>(self, summary: S) -> Self
Add or change short summary of the Operation
.
sourcepub fn description<S: Into<String>>(self, description: S) -> Self
pub fn description<S: Into<String>>(self, description: S) -> Self
Add or change description of the Operation
.
sourcepub fn operation_id<S: Into<String>>(self, operation_id: S) -> Self
pub fn operation_id<S: Into<String>>(self, operation_id: S) -> Self
Add or change operation id of the Operation
.
sourcepub fn parameters<I: IntoIterator<Item = P>, P: Into<Parameter>>(
self,
parameters: I,
) -> Self
pub fn parameters<I: IntoIterator<Item = P>, P: Into<Parameter>>( self, parameters: I, ) -> Self
Add or change parameters of the Operation
.
sourcepub fn add_parameter<P: Into<Parameter>>(self, parameter: P) -> Self
pub fn add_parameter<P: Into<Parameter>>(self, parameter: P) -> Self
Append parameter to Operation
parameters and returns Self
.
sourcepub fn request_body(self, request_body: RequestBody) -> Self
pub fn request_body(self, request_body: RequestBody) -> Self
Add or change request body of the Operation
.
sourcepub fn responses<R: Into<Responses>>(self, responses: R) -> Self
pub fn responses<R: Into<Responses>>(self, responses: R) -> Self
Add or change responses of the Operation
.
sourcepub fn add_response<S: Into<String>, R: Into<RefOr<Response>>>(
self,
code: S,
response: R,
) -> Self
pub fn add_response<S: Into<String>, R: Into<RefOr<Response>>>( self, code: S, response: R, ) -> Self
sourcepub fn deprecated<D: Into<Deprecated>>(self, deprecated: D) -> Self
pub fn deprecated<D: Into<Deprecated>>(self, deprecated: D) -> Self
Add or change deprecated status of the Operation
.
sourcepub fn securities<I: IntoIterator<Item = SecurityRequirement>>(
self,
securities: I,
) -> Self
pub fn securities<I: IntoIterator<Item = SecurityRequirement>>( self, securities: I, ) -> Self
Add or change list of SecurityRequirement
s that are available for Operation
.
sourcepub fn add_security(self, security: SecurityRequirement) -> Self
pub fn add_security(self, security: SecurityRequirement) -> Self
Append SecurityRequirement
to Operation
security requirements and returns Self
.