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

source

pub fn new() -> OpenApiBuilder

Constructs a new OpenApiBuilder.

source

pub fn build(self) -> OpenApi

Constructs a new OpenApi taking all fields values from this object.

source§

impl OpenApiBuilder

source

pub fn info<I: Into<Info>>(self, info: I) -> Self

Add Info metadata of the API.

source

pub fn servers<I: IntoIterator<Item = Server>>(self, servers: Option<I>) -> Self

Add iterator of Servers to configure target servers.

source

pub fn paths<P: Into<Paths>>(self, paths: P) -> Self

Add Paths to configure operations and endpoints of the API.

source

pub fn components(self, components: Option<Components>) -> Self

Add Components to configure reusable schemas.

source

pub fn security<I: IntoIterator<Item = SecurityRequirement>>( self, security: Option<I>, ) -> Self

Add iterator of SecurityRequirements that are globally available for all operations.

source

pub fn tags<I: IntoIterator<Item = Tag>>(self, tags: Option<I>) -> Self

Add iterator of Tags to add additional documentation for operations tags.

source

pub fn external_docs(self, external_docs: Option<ExternalDocs>) -> Self

Add ExternalDocs for referring additional documentation.

Trait Implementations§

source§

impl Default for OpenApiBuilder

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl From<OpenApi> for OpenApiBuilder

source§

fn from(value: OpenApi) -> Self

Converts to this type from the input type.
source§

impl From<OpenApiBuilder> for OpenApi

source§

fn from(value: OpenApiBuilder) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.