pub struct RouteDescription {Show 17 fields
pub group: String,
pub name: String,
pub description: String,
pub request_body: Option<DtoEntity>,
pub response_examples: HashMap<u16, DtoEntity>,
pub headers: HashMap<String, String>,
pub path_parameters: HashMap<String, String>,
pub path_parameter_defaults: HashMap<String, String>,
pub query_parameters: HashMap<String, String>,
pub query_parameter_defaults: HashMap<String, String>,
pub file_parameters: HashMap<String, FileParameter>,
pub rate_limit: Option<u32>,
pub authentication_required: bool,
pub authentication_comment: Option<String>,
pub summary: String,
pub tags: Vec<String>,
pub is_deprecated: bool,
}Expand description
Declarative metadata for one route: documentation, validation, and policy.
A description is registered for docs generation, declares the expected request
body (required when has_body is set on mount), response examples, params,
file parts, rate limit, and auth notes. Build with the new constructor and
the group / with_body / response / header / query_param builders.
Fields§
§group: StringDocumentation group this route belongs to; also seeds the default tag.
name: StringRoute name; kept in sync with summary by RouteDescription::name.
description: StringLong-form description shown in documentation.
request_body: Option<DtoEntity>Declared request-body DTO schema and example, if the route takes a body.
response_examples: HashMap<u16, DtoEntity>Response examples keyed by HTTP status code.
headers: HashMap<String, String>Documented request headers as name-to-description pairs.
path_parameters: HashMap<String, String>Documented path parameters as name-to-description pairs.
path_parameter_defaults: HashMap<String, String>Default values for documented path parameters.
query_parameters: HashMap<String, String>Documented query parameters as name-to-description pairs.
query_parameter_defaults: HashMap<String, String>Default values for documented query parameters.
file_parameters: HashMap<String, FileParameter>Declared multipart file parameters keyed by part name.
rate_limit: Option<u32>Per-route request cap; None means no route-level limit is installed.
authentication_required: boolWhether callers must authenticate; enforced by middleware, not by this struct.
authentication_comment: Option<String>Optional note explaining the authentication requirement.
summary: StringShort summary shown in documentation; defaults to the name.
Documentation tags used for grouping; defaults to the group name.
is_deprecated: boolMarks the route as deprecated in documentation.
Implementations§
Source§impl RouteDescription
impl RouteDescription
Sourcepub fn new(summary: impl Into<String>) -> Self
pub fn new(summary: impl Into<String>) -> Self
Creates a description with the given summary; group and tags default to "Default".
Sourcepub fn group(self, group: impl Into<String>) -> Self
pub fn group(self, group: impl Into<String>) -> Self
Sets the documentation group and resets the tag list to that group.
Sourcepub fn name(self, name: impl Into<String>) -> Self
pub fn name(self, name: impl Into<String>) -> Self
Sets the route name and copies it into the summary.
Sourcepub fn description(self, desc: impl Into<String>) -> Self
pub fn description(self, desc: impl Into<String>) -> Self
Sets the long-form description shown in documentation.
Sourcepub fn with_rate_limit(self, limit: u32) -> Self
pub fn with_rate_limit(self, limit: u32) -> Self
Sets the per-route request cap enforced by the router’s rate-limit middleware.
Sourcepub fn rate_limit(self, limit: u32) -> Self
pub fn rate_limit(self, limit: u32) -> Self
Sets the per-route request cap (alias for RouteDescription::with_rate_limit).
Sourcepub fn with_body<T>(self) -> Selfwhere
T: DocumentableDTO + Validate,
pub fn with_body<T>(self) -> Selfwhere
T: DocumentableDTO + Validate,
Declares the request-body DTO type T: records its JSON Schema and example.
Required when the route is mounted with has_body; T must also be validatable.
Sourcepub fn authentication(self, required: bool) -> Self
pub fn authentication(self, required: bool) -> Self
Records whether callers must authenticate (informational; enforced by middleware).
Sourcepub fn response<T>(self, code: u16) -> Selfwhere
T: DocumentableDTO,
pub fn response<T>(self, code: u16) -> Selfwhere
T: DocumentableDTO,
Records a response example for code using DTO type T’s schema and example.
Sourcepub fn authentication_required(self, required: bool) -> Self
pub fn authentication_required(self, required: bool) -> Self
Records whether callers must authenticate (alias for RouteDescription::authentication).
Sourcepub fn authentication_comment(self, comment: impl Into<String>) -> Self
pub fn authentication_comment(self, comment: impl Into<String>) -> Self
Attaches an explanatory note about the authentication requirement.
Sourcepub fn header(self, k: impl Into<String>, v: impl Into<String>) -> Self
pub fn header(self, k: impl Into<String>, v: impl Into<String>) -> Self
Documents one expected request header as a name-to-description entry.
Sourcepub fn path_param(self, k: impl Into<String>, v: impl Into<String>) -> Self
pub fn path_param(self, k: impl Into<String>, v: impl Into<String>) -> Self
Documents one path parameter as a name-to-description entry.
Sourcepub fn path_param_with_default(
self,
k: impl Into<String>,
v: impl Into<String>,
default: impl Into<String>,
) -> Self
pub fn path_param_with_default( self, k: impl Into<String>, v: impl Into<String>, default: impl Into<String>, ) -> Self
Documents one path parameter together with its default value.
Sourcepub fn query_param(self, k: impl Into<String>, v: impl Into<String>) -> Self
pub fn query_param(self, k: impl Into<String>, v: impl Into<String>) -> Self
Documents one query parameter as a name-to-description entry.
Sourcepub fn query_param_with_default(
self,
k: impl Into<String>,
v: impl Into<String>,
default: impl Into<String>,
) -> Self
pub fn query_param_with_default( self, k: impl Into<String>, v: impl Into<String>, default: impl Into<String>, ) -> Self
Documents one query parameter together with its default value.
Sourcepub fn file_param(
self,
name: impl Into<String>,
description: impl Into<String>,
file_type: FileParameterType,
) -> Self
pub fn file_param( self, name: impl Into<String>, description: impl Into<String>, file_type: FileParameterType, ) -> Self
Declares an accepted multipart file part without total send caps.
Sourcepub fn file_param_with_limit(
self,
name: impl Into<String>,
description: impl Into<String>,
file_type: FileParameterType,
limit: u32,
count: u32,
) -> Self
pub fn file_param_with_limit( self, name: impl Into<String>, description: impl Into<String>, file_type: FileParameterType, limit: u32, count: u32, ) -> Self
Declares an accepted multipart file part with sending limits.
Panics if limit or count is zero; a count overrun rejects the request with a 400.
Sourcepub fn deprecated(self, deprecated: bool) -> Self
pub fn deprecated(self, deprecated: bool) -> Self
Marks the route as deprecated (true) or not (false) in documentation.
Trait Implementations§
Source§impl Clone for RouteDescription
impl Clone for RouteDescription
Source§fn clone(&self) -> RouteDescription
fn clone(&self) -> RouteDescription
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RouteDescription
impl Debug for RouteDescription
Auto Trait Implementations§
impl Freeze for RouteDescription
impl RefUnwindSafe for RouteDescription
impl Send for RouteDescription
impl Sync for RouteDescription
impl Unpin for RouteDescription
impl UnsafeUnpin for RouteDescription
impl UnwindSafe for RouteDescription
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more