pub struct OpenApiDoc {
pub openapi: String,
pub info: OpenApiInfo,
pub paths: BTreeMap<String, PathItem>,
pub components: Option<Components>,
pub servers: Option<Vec<Server>>,
pub tags: Option<Vec<Tag>>,
pub external_docs: Option<ExternalDocumentation>,
pub security: Option<Vec<SecurityRequirement>>,
}Expand description
OpenAPI 文档
Fields§
§openapi: StringOpenAPI 版本
info: OpenApiInfoAPI 信息
paths: BTreeMap<String, PathItem>路径定义
components: Option<Components>组件定义
servers: Option<Vec<Server>>服务器列表
标签列表
external_docs: Option<ExternalDocumentation>外部文档
security: Option<Vec<SecurityRequirement>>安全要求
Implementations§
Source§impl OpenApiDoc
impl OpenApiDoc
Sourcepub fn description(self, desc: impl Into<String>) -> Self
pub fn description(self, desc: impl Into<String>) -> Self
设置描述
Sourcepub fn security_scheme(
self,
name: impl Into<String>,
scheme: SecurityScheme,
) -> Self
pub fn security_scheme( self, name: impl Into<String>, scheme: SecurityScheme, ) -> Self
添加安全方案组件
Sourcepub fn request_body(self, name: impl Into<String>, body: RequestBody) -> Self
pub fn request_body(self, name: impl Into<String>, body: RequestBody) -> Self
添加请求体组件
Sourcepub fn external_docs(
self,
url: impl Into<String>,
description: Option<String>,
) -> Self
pub fn external_docs( self, url: impl Into<String>, description: Option<String>, ) -> Self
设置外部文档
Sourcepub fn security(self, security: SecurityRequirement) -> Self
pub fn security(self, security: SecurityRequirement) -> Self
设置安全要求
Trait Implementations§
Source§impl Clone for OpenApiDoc
impl Clone for OpenApiDoc
Source§fn clone(&self) -> OpenApiDoc
fn clone(&self) -> OpenApiDoc
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 moreSource§impl Debug for OpenApiDoc
impl Debug for OpenApiDoc
Source§impl<'de> Deserialize<'de> for OpenApiDoc
impl<'de> Deserialize<'de> for OpenApiDoc
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 OpenApiDoc
impl RefUnwindSafe for OpenApiDoc
impl Send for OpenApiDoc
impl Sync for OpenApiDoc
impl Unpin for OpenApiDoc
impl UnsafeUnpin for OpenApiDoc
impl UnwindSafe for OpenApiDoc
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