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(®istrant) to get the
JSON served by the documentation controller.
ⓘ
let spec = {
let registrant = crate::doc::DocumentationRegistrant::get_instance();
crate::doc::OpenApi3Generator::generate(®istrant)
};
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 /docsand the Swagger UI.
Structs§
- Burst
Http Client - HTTP client with a short 5-second timeout and no artificial delay.
- Classic
Http Client - Default HTTP client with a 30-second request timeout.
- DocExample
Http Client - Minimal HTTP helper used in documentation examples.
- DocHttp
Response - HTTP response returned by a
DocHttpClienttest execution. - Documentation
Registrant - Process-wide registry of routes and documentation settings.
- Open
Api3 Generator - Renders the registry contents as an OpenAPI 3.1 JSON document.
- Registered
Route - One registered route: its path, HTTP method, owning controller name, and metadata.
- Route
Doc - Compact route record kept for backwards compatibility.
- Throttled
Http Client - HTTP client that waits 100ms before sending, with a 30-second timeout.
Enums§
- Documentation
Mode - Controls when the documentation endpoints are served.
Traits§
- DocHttp
Client - A named HTTP client usable from the documentation test hook.
- DocumentableDTO
- A request or response type that can describe itself for documentation.
Type Aliases§
- Legacy
DocHttp Client - Backwards-compatible alias for
DocExampleHttpClient.