Struct OpenApiBuilder

Source
pub struct OpenApiBuilder<S: State = Empty> { /* private fields */ }
Expand description

Use builder syntax to set the inputs and finish with build().

Implementations§

Source§

impl<S: State> OpenApiBuilder<S>

Source

pub fn build(self) -> OpenApi
where S: IsComplete,

Finish building and return the requested object

Source

pub fn openapi( self, value: impl Into<OpenApiVersion>, ) -> OpenApiBuilder<SetOpenapi<S>>
where S::Openapi: IsUnset,

Optional (Some / Option setters). Default: <OpenApiVersion as Default>::default().

OpenAPI document version.

Source

pub fn maybe_openapi( self, value: Option<impl Into<OpenApiVersion>>, ) -> OpenApiBuilder<SetOpenapi<S>>
where S::Openapi: IsUnset,

Optional (Some / Option setters). Default: <OpenApiVersion as Default>::default().

OpenAPI document version.

Source

pub fn info(self, value: impl Into<Info>) -> OpenApiBuilder<SetInfo<S>>
where S::Info: IsUnset,

Optional (Some / Option setters). Default: <Info as Default>::default().

Provides metadata about the API.

See more details at https://spec.openapis.org/oas/latest.html#info-object.

Source

pub fn maybe_info( self, value: Option<impl Into<Info>>, ) -> OpenApiBuilder<SetInfo<S>>
where S::Info: IsUnset,

Optional (Some / Option setters). Default: <Info as Default>::default().

Provides metadata about the API.

See more details at https://spec.openapis.org/oas/latest.html#info-object.

Source

pub fn servers( self, value: impl Into<Vec<Server>>, ) -> OpenApiBuilder<SetServers<S>>
where S::Servers: IsUnset,

Optional (Some / Option setters).

Optional list of servers that provides the connectivity information to target servers.

This is implicitly one server with url set to /.

See more details at https://spec.openapis.org/oas/latest.html#server-object.

Source

pub fn maybe_servers( self, value: Option<impl Into<Vec<Server>>>, ) -> OpenApiBuilder<SetServers<S>>
where S::Servers: IsUnset,

Optional (Some / Option setters).

Optional list of servers that provides the connectivity information to target servers.

This is implicitly one server with url set to /.

See more details at https://spec.openapis.org/oas/latest.html#server-object.

Source

pub fn paths(self, value: impl Into<Paths>) -> OpenApiBuilder<SetPaths<S>>
where S::Paths: IsUnset,

Optional (Some / Option setters). Default: <Paths as Default>::default().

Available paths and operations for the API.

See more details at https://spec.openapis.org/oas/latest.html#paths-object.

Source

pub fn maybe_paths( self, value: Option<impl Into<Paths>>, ) -> OpenApiBuilder<SetPaths<S>>
where S::Paths: IsUnset,

Optional (Some / Option setters). Default: <Paths as Default>::default().

Available paths and operations for the API.

See more details at https://spec.openapis.org/oas/latest.html#paths-object.

Source

pub fn components( self, value: impl Into<Components>, ) -> OpenApiBuilder<SetComponents<S>>
where S::Components: IsUnset,

Optional (Some / Option setters).

Holds various reusable schemas for the OpenAPI document.

Few of these elements are security schemas and object schemas.

See more details at https://spec.openapis.org/oas/latest.html#components-object.

Source

pub fn maybe_components( self, value: Option<impl Into<Components>>, ) -> OpenApiBuilder<SetComponents<S>>
where S::Components: IsUnset,

Optional (Some / Option setters).

Holds various reusable schemas for the OpenAPI document.

Few of these elements are security schemas and object schemas.

See more details at https://spec.openapis.org/oas/latest.html#components-object.

Source

pub fn security( self, value: impl Into<Vec<SecurityRequirement>>, ) -> OpenApiBuilder<SetSecurity<S>>
where S::Security: IsUnset,

Optional (Some / Option setters).

Declaration of global security mechanisms that can be used across the API. The individual operations can override the declarations. You can use SecurityRequirement::default() if you wish to make security optional by adding it to the list of securities.

See more details at https://spec.openapis.org/oas/latest.html#security-requirement-object.

Source

pub fn maybe_security( self, value: Option<impl Into<Vec<SecurityRequirement>>>, ) -> OpenApiBuilder<SetSecurity<S>>
where S::Security: IsUnset,

Optional (Some / Option setters).

Declaration of global security mechanisms that can be used across the API. The individual operations can override the declarations. You can use SecurityRequirement::default() if you wish to make security optional by adding it to the list of securities.

See more details at https://spec.openapis.org/oas/latest.html#security-requirement-object.

Source

pub fn tags(self, value: impl Into<Vec<Tag>>) -> OpenApiBuilder<SetTags<S>>
where S::Tags: IsUnset,

Optional (Some / Option setters).

Optional list of tags can be used to add additional documentation to matching tags of operations.

See more details at https://spec.openapis.org/oas/latest.html#tag-object.

Source

pub fn maybe_tags( self, value: Option<impl Into<Vec<Tag>>>, ) -> OpenApiBuilder<SetTags<S>>
where S::Tags: IsUnset,

Optional (Some / Option setters).

Optional list of tags can be used to add additional documentation to matching tags of operations.

See more details at https://spec.openapis.org/oas/latest.html#tag-object.

Source

pub fn external_docs( self, value: impl Into<ExternalDocs>, ) -> OpenApiBuilder<SetExternalDocs<S>>
where S::ExternalDocs: IsUnset,

Optional (Some / Option setters).

Optional global additional documentation reference.

See more details at https://spec.openapis.org/oas/latest.html#external-documentation-object.

Source

pub fn maybe_external_docs( self, value: Option<impl Into<ExternalDocs>>, ) -> OpenApiBuilder<SetExternalDocs<S>>
where S::ExternalDocs: IsUnset,

Optional (Some / Option setters).

Optional global additional documentation reference.

See more details at https://spec.openapis.org/oas/latest.html#external-documentation-object.

Source

pub fn schema(self, value: impl Into<String>) -> OpenApiBuilder<SetSchema<S>>
where S::Schema: IsUnset,

Optional (Some / Option setters). Default: "".

Schema keyword can be used to override default $schema dialect which is by default “https://spec.openapis.org/oas/3.1/dialect/base”.

All the references and individual files could use their own schema dialect.

Source

pub fn maybe_schema( self, value: Option<impl Into<String>>, ) -> OpenApiBuilder<SetSchema<S>>
where S::Schema: IsUnset,

Optional (Some / Option setters). Default: "".

Schema keyword can be used to override default $schema dialect which is by default “https://spec.openapis.org/oas/3.1/dialect/base”.

All the references and individual files could use their own schema dialect.

Source

pub fn extensions( self, value: impl Into<Extensions>, ) -> OpenApiBuilder<SetExtensions<S>>
where S::Extensions: IsUnset,

Optional (Some / Option setters).

Optional extensions “x-something”.

Source

pub fn maybe_extensions( self, value: Option<impl Into<Extensions>>, ) -> OpenApiBuilder<SetExtensions<S>>
where S::Extensions: IsUnset,

Optional (Some / Option setters).

Optional extensions “x-something”.

Auto Trait Implementations§

§

impl<S> Freeze for OpenApiBuilder<S>

§

impl<S> RefUnwindSafe for OpenApiBuilder<S>

§

impl<S> Send for OpenApiBuilder<S>

§

impl<S> Sync for OpenApiBuilder<S>

§

impl<S> Unpin for OpenApiBuilder<S>

§

impl<S> UnwindSafe for OpenApiBuilder<S>

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.