Skip to main content

OpenApiRouteConfig

Struct OpenApiRouteConfig 

Source
pub struct OpenApiRouteConfig { /* private fields */ }
Expand description

Per-route OpenAPI metadata.

Implementations§

Source§

impl OpenApiRouteConfig

Source

pub fn with_tag(self, tag: impl Into<String>) -> Self

Adds a tag to the operation.

Source

pub fn with_tags<I, T>(self, tags: I) -> Self
where I: IntoIterator<Item = T>, T: Into<String>,

Adds multiple tags to the operation.

Source

pub fn with_doc(self, doc: impl Into<String>) -> Self

Binds the operation with a document

Source

pub fn with_docs<I, S>(self, docs: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Binds the operation with documents

Source

pub fn with_summary(self, summary: impl Into<String>) -> Self

Sets the operation summary.

Source

pub fn with_description(self, description: impl Into<String>) -> Self

Sets the operation description.

Source

pub fn with_operation_id(self, operation_id: impl Into<String>) -> Self

Sets the operation id.

Source

pub fn with_request_schema(self, schema: OpenApiSchema) -> Self

Sets the request body schema for this operation.

Source

pub fn with_response_schema( self, status: impl IntoStatusCode, schema: OpenApiSchema, ) -> Self

Sets the response schema for this operation.

Source

pub fn consumes_named_path<T: DeserializeOwned>(self) -> Self

Generates path parameters schema.

Source

pub fn consumes_query<T: DeserializeOwned>(self) -> Self

Generates query parameters schema.

Source

pub fn consumes_json<T: DeserializeOwned>(self) -> Self

Generates JSON request schema and example.

Source

pub fn consumes_form<T: DeserializeOwned>(self) -> Self

Generates form request schema and example.

Source

pub fn consumes_multipart(self) -> Self

Generates multipart request schema.

Source

pub fn consumes_stream(self) -> Self

Generates stream request schema.

Source

pub fn produces_text(self, status: impl IntoStatusCode) -> Self

Generates text/plain response schema.

Source

pub fn produces_no_schema(self, status: impl IntoStatusCode) -> Self

Generates a response without a schema.

Source

pub fn produces_json<T: Serialize + Default>( self, status: impl IntoStatusCode, ) -> Self

Generates JSON response schema and example from T::default().

Source

pub fn produces_empty_json(self, status: impl IntoStatusCode) -> Self

Generates empty JSON response schema.

Source

pub fn produces_form<T: Serialize + Default>( self, status: impl IntoStatusCode, ) -> Self

Generates form response schema and example from T::default().

Source

pub fn produces_empty_form(self, status: impl IntoStatusCode) -> Self

Generates empty form response schema.

Source

pub fn produces_stream(self, status: impl IntoStatusCode) -> Self

Generates stream response schema.

Source

pub fn produces_sse(self, status: impl IntoStatusCode) -> Self

Generates SSE stream response schema.

Source

pub fn produces_json_example<T: Serialize>( self, status: impl IntoStatusCode, example: T, ) -> Self

Generates JSON response schema and example.

Source

pub fn produces_form_example<T: Serialize>( self, status: impl IntoStatusCode, example: T, ) -> Self

Generates form response schema and example.

Source

pub fn merge(self, other: &Self) -> Self

Merges configurations.

Trait Implementations§

Source§

impl Clone for OpenApiRouteConfig

Source§

fn clone(&self) -> OpenApiRouteConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OpenApiRouteConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OpenApiRouteConfig

Source§

fn default() -> OpenApiRouteConfig

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

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.