Skip to main content

Module doc

Module doc 

Source
Expand description

Documentation registry and OpenAPI 3.1 specification generator.

Collects route metadata in DocumentationRegistrant (a process-wide registry) and renders it to an OpenAPI 3.1 JSON document with OpenApi3Generator. DocumentableDTO marks request/response types that can supply a schema and an example value.

Key types: DocumentationRegistrant for collecting routes and global settings, OpenApi3Generator for rendering the spec, DocumentableDTO for describable payloads, DocHttpClient for the test-execution clients, and RegisteredRoute / RouteDoc as route records.

Use this module when serving API docs: register each route on the global registrant, then call OpenApi3Generator::generate(&registrant) to get the JSON served by the documentation controller.

let spec = {
    let registrant = crate::doc::DocumentationRegistrant::get_instance();
    crate::doc::OpenApi3Generator::generate(&registrant)
};
assert_eq!(spec["openapi"], "3.1.0");

Re-exports§

pub use crate::controller::FileParameter;
pub use crate::controller::FileParameterType;
pub use crate::controller::RouteDescription;

Modules§

assets
Bundled Swagger UI assets served by the documentation controller.
controller
Documentation endpoints: OpenAPI JSON at GET /docs and the Swagger UI.

Structs§

BurstHttpClient
HTTP client with a short 5-second timeout and no artificial delay.
ClassicHttpClient
Default HTTP client with a 30-second request timeout.
DocExampleHttpClient
Minimal HTTP helper used in documentation examples.
DocHttpResponse
HTTP response returned by a DocHttpClient test execution.
DocumentationRegistrant
Process-wide registry of routes and documentation settings.
OpenApi3Generator
Renders the registry contents as an OpenAPI 3.1 JSON document.
RegisteredRoute
One registered route: its path, HTTP method, owning controller name, and metadata.
RouteDoc
Compact route record kept for backwards compatibility.
ThrottledHttpClient
HTTP client that waits 100ms before sending, with a 30-second timeout.

Enums§

DocumentationMode
Controls when the documentation endpoints are served.

Traits§

DocHttpClient
A named HTTP client usable from the documentation test hook.
DocumentableDTO
A request or response type that can describe itself for documentation.

Type Aliases§

LegacyDocHttpClient
Backwards-compatible alias for DocExampleHttpClient.