Skip to main content

build_spec

Function build_spec 

Source
pub fn build_spec(config: &OpenApiConfig, routes: &[RouteInfo]) -> String
Available on crate feature openapi only.
Expand description

Builds an OpenAPI 3.1 JSON document from routes and the operations in config.

Routes sharing a path (different methods) are merged into one paths entry. :name and *name segments both become {name} with a parameters entry — OpenAPI has no “rest of the path” parameter, so *name is represented like :name.