Skip to main content

DocumentationController

Struct DocumentationController 

Source
pub struct DocumentationController;
Expand description

Serves the OpenAPI document and the Swagger UI for the service.

Mounts GET /docs (OpenAPI 3.1 JSON) and a GET /* handler for the bundled UI assets. In production the routes are skipped unless the documentation mode is External.

Implementations§

Source§

impl DocumentationController

Source

pub const DOCS_PATH: &'static str = "/docs"

Path of the OpenAPI JSON document.

Source

pub const TEST_CLIENT_HEADER: &'static str = "X-Moovable-Test-Client"

Request header naming the test client to execute.

Source

pub const TEST_PARAMS_HEADER: &'static str = "X-Moovable-Test-Params"

Request header carrying the JSON-encoded test parameters.

Source

pub const SWAGGER_UI_DIR: &'static str = assets::FS_DIR

Filesystem fallback directory for the Swagger UI distribution (see assets::FS_DIR). The same files are embedded in the binary via assets, so resolution never depends on the process-working directory.

Source

pub fn build_specs()

Builds and caches the OpenAPI document once.

Call after all controllers are mounted so every registered route is included. Later requests reuse the cached JSON string.

Trait Implementations§

Source§

impl RouteController for DocumentationController

Source§

fn base_path(&self) -> &str

Base path prefix for every route registered by this controller.
Source§

fn register_routes<'life0, 'life1, 'async_trait>( &'life0 self, router: &'life1 mut Router, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Registers this controller’s routes on router, typically via RouteControllerExt.
Source§

fn version(&self) -> u32

API version prefix; 0 means no /v{version} segment is added.
Source§

fn full_path(&self, path: &str) -> String

Resolves a relative path to its full mounted path including base path and version.
Source§

fn register<'life0, 'life1, 'async_trait>( &'life0 self, router: &'life1 mut Router, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Default registration entry point; delegates to RouteController::register_routes.
Source§

fn type_name(&self) -> &'static str

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> CompatExt for T

Source§

fn compat(self) -> Compat<T>
where T: Sized,

Applies the Compat adapter by value. Read more
Source§

fn compat_ref(&self) -> Compat<&T>

Applies the Compat adapter by shared reference. Read more
Source§

fn compat_mut(&mut self) -> Compat<&mut T>

Applies the Compat adapter by mutable reference. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> RouteControllerExt for T
where T: RouteController,

Source§

fn mount_get<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a GET handler with no required body at path.
Source§

fn mount_post<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a POST handler; requires a declared request body or file parameter.
Source§

fn mount_put<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a PUT handler; requires a declared request body or file parameter.
Source§

fn mount_patch<T, F, Fut>( &self, router: &mut Router, path: &str, has_body: bool, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a PATCH handler; has_body selects whether a request body is required.
Source§

fn mount_patch_with_body<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a PATCH handler that requires a request body.
Source§

fn mount_patch_without_body<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a PATCH handler that requires no request body.
Source§

fn mount_delete<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a DELETE handler with no required body at path.
Source§

fn mount_options<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts an OPTIONS handler with no required body at path.
Source§

fn mount_head<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a HEAD handler with no required body at path.
Source§

fn mount_trace<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a TRACE handler with no required body at path.
Source§

fn mount_connect<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a CONNECT handler with no required body at path.
Source§

fn mount_copy<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a WebDAV COPY handler with no required body at path.
Source§

fn mount_move<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a WebDAV MOVE handler with no required body at path.
Source§

fn mount_lock<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a WebDAV LOCK handler; requires a declared request body or file parameter.
Source§

fn mount_unlock<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a WebDAV UNLOCK handler with no required body at path.
Source§

fn mount_propfind<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a WebDAV PROPFIND handler; requires a declared request body or file parameter.
Source§

fn mount_mkcol<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a WebDAV MKCOL handler with no required body at path.
Mounts a WebDAV SEARCH handler; requires a declared request body or file parameter.
Source§

fn mount_report<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a WebDAV REPORT handler; requires a declared request body or file parameter.
Source§

fn mount_checkin<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a versioning CHECKIN handler with no required body at path.
Source§

fn mount_checkout<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a versioning CHECKOUT handler with no required body at path.
Source§

fn mount_uncheckout<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a versioning UNCHECKOUT handler with no required body at path.
Source§

fn mount_merge<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a WebDAV MERGE handler; requires a declared request body or file parameter.
Source§

fn mount_acl<T, F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a WebDAV ACL handler; requires a declared request body or file parameter.
Source§

fn mount_custom<T, F, Fut>( &self, router: &mut Router, path: &str, method: Method, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where T: Serialize + Send + Sync + 'static, F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<ServiceResult<T>, ErrorResult>> + Send + 'static,

Mounts a handler for an arbitrary method with no required body at path.
Source§

fn mount_static( &self, router: &mut Router, path: &str, fs_path: String, middlewares: Vec<Middleware>, )

Serves files under fs_path at this controller’s base path plus path.
Source§

fn mount_typed<F, Fut>( &self, router: &mut Router, path: &str, method: Method, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Box<dyn TypedServiceResult>, ErrorResult>> + Send + 'static,

Mounts a handler returning Box<dyn TypedServiceResult> for heterogeneous payloads.
Source§

fn mount_get_typed<F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Box<dyn TypedServiceResult>, ErrorResult>> + Send + 'static,

Mounts a boxed-result GET handler returning heterogeneous payloads.
Source§

fn mount_post_typed<F, Fut>( &self, router: &mut Router, path: &str, description: RouteDescription, handler: F, middlewares: Vec<Middleware>, )
where F: Fn(CorrelationContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Box<dyn TypedServiceResult>, ErrorResult>> + Send + 'static,

Mounts a boxed-result POST handler returning heterogeneous payloads.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more