pub struct Operation {
pub tags: Option<Vec<String>>,
pub summary: Option<String>,
pub description: Option<String>,
pub operation_id: Option<String>,
pub parameters: Option<Vec<ParameterOrReference>>,
pub request_body: Option<RequestBodyOrReference>,
pub responses: BTreeMap<String, ResponseOrReference>,
pub callbacks: Option<BTreeMap<String, Callback>>,
pub deprecated: bool,
pub security: Option<Vec<SecurityRequirement>>,
pub servers: Option<Vec<Server>>,
pub external_docs: Option<ExternalDocumentation>,
}Expand description
操作定义
Fields§
操作标签
summary: Option<String>操作摘要
description: Option<String>操作描述
operation_id: Option<String>操作 ID
parameters: Option<Vec<ParameterOrReference>>参数列表
request_body: Option<RequestBodyOrReference>请求体
responses: BTreeMap<String, ResponseOrReference>响应定义
callbacks: Option<BTreeMap<String, Callback>>回调定义
deprecated: bool弃用标记
security: Option<Vec<SecurityRequirement>>安全要求
servers: Option<Vec<Server>>服务器列表
external_docs: Option<ExternalDocumentation>外部文档
Implementations§
Source§impl Operation
impl Operation
Sourcepub fn description(self, desc: impl Into<String>) -> Self
pub fn description(self, desc: impl Into<String>) -> Self
设置描述
Sourcepub fn operation_id(self, id: impl Into<String>) -> Self
pub fn operation_id(self, id: impl Into<String>) -> Self
设置操作 ID
Sourcepub fn parameter(self, param: ParameterOrReference) -> Self
pub fn parameter(self, param: ParameterOrReference) -> Self
添加参数
Sourcepub fn request_body(self, body: RequestBodyOrReference) -> Self
pub fn request_body(self, body: RequestBodyOrReference) -> Self
设置请求体
Sourcepub fn response(
self,
status: impl Into<String>,
resp: ResponseOrReference,
) -> Self
pub fn response( self, status: impl Into<String>, resp: ResponseOrReference, ) -> Self
添加响应
Sourcepub fn deprecated(self, deprecated: bool) -> Self
pub fn deprecated(self, deprecated: bool) -> Self
设置弃用
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Operation
impl<'de> Deserialize<'de> for Operation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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