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 undescribed_inputs(&self) -> &[UndescribedInput]

Returns the handler inputs this operation describes without their fields, because they cannot be inferred - see UndescribedInput.

Source

pub fn described_parameters(&self) -> usize

Returns how many parameters this operation already describes.

Taken before an extractor is described and handed back through ConstraintTarget, so its constraints reach its own parameters and no others.

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.

This is how a body whose fields cannot be inferred is described - see UndescribedInput.

Source

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

Describes the query parameters by hand: one for each property of schema, required when its required list names it - the way a Query<T> extractor describes the fields of T.

This is how a query whose fields cannot be inferred is described - see UndescribedInput. A parameter this operation already describes under the same name is replaced.

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_multipart(self, status: impl IntoStatusCode) -> Self

Generates default multipart/form-data 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 with_constraints( self, target: ConstraintTarget, constraints: &[FieldConstraint], ) -> Self

Publishes the constraints of the extractor that declared them, on the one thing in this operation that extractor describes.

The target matters: handler arguments are described one after another, so a body and a query struct sharing a field name would otherwise hand each other their bounds. A field the target does not describe is ignored.

Source

pub fn merge_outer(self, outer: &Self) -> Self

Merges the configuration of an enclosing scope - a route group - into this one.

Whatever the route describes for itself wins, exactly as in merge; the difference is the order of the tags, which read outermost first no matter when the group’s configuration was registered.

Source

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

Merges configurations.

Trait Implementations§

Source§

impl Clone for OpenApiRouteConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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() -> Self

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.