Struct utoipa::openapi::OpenApiBuilder
source · pub struct OpenApiBuilder { /* private fields */ }
Expand description
Builder for OpenApi
with chainable configuration methods to create a new OpenApi
.
Examples
Create OpenApi
using OpenApiBuilder
.
let openapi = OpenApiBuilder::new()
.info(Info::new("My api", "1.0.0"))
.paths(Paths::new())
.components(Some(
Components::new()
))
.build();
Implementations§
source§impl OpenApiBuilder
impl OpenApiBuilder
sourcepub fn new() -> OpenApiBuilder
pub fn new() -> OpenApiBuilder
Constructs a new OpenApiBuilder
.
source§impl OpenApiBuilder
impl OpenApiBuilder
sourcepub fn servers<I: IntoIterator<Item = Server>>(self, servers: Option<I>) -> Self
pub fn servers<I: IntoIterator<Item = Server>>(self, servers: Option<I>) -> Self
Add iterator of Server
s to configure target servers.
sourcepub fn paths<P: Into<Paths>>(self, paths: P) -> Self
pub fn paths<P: Into<Paths>>(self, paths: P) -> Self
Add Paths
to configure operations and endpoints of the API.
sourcepub fn components(self, components: Option<Components>) -> Self
pub fn components(self, components: Option<Components>) -> Self
Add Components
to configure reusable schemas.
sourcepub fn security<I: IntoIterator<Item = SecurityRequirement>>(
self,
security: Option<I>
) -> Self
pub fn security<I: IntoIterator<Item = SecurityRequirement>>(
self,
security: Option<I>
) -> Self
Add iterator of SecurityRequirement
s that are globally available for all operations.
Add iterator of Tag
s to add additional documentation for operations tags.
sourcepub fn external_docs(self, external_docs: Option<ExternalDocs>) -> Self
pub fn external_docs(self, external_docs: Option<ExternalDocs>) -> Self
Add ExternalDocs
for referring additional documentation.
Trait Implementations§
source§impl Default for OpenApiBuilder
impl Default for OpenApiBuilder
source§impl From<OpenApi> for OpenApiBuilder
impl From<OpenApi> for OpenApiBuilder
source§impl From<OpenApiBuilder> for OpenApi
impl From<OpenApiBuilder> for OpenApi
source§fn from(value: OpenApiBuilder) -> Self
fn from(value: OpenApiBuilder) -> Self
Converts to this type from the input type.