Macro rocket_okapi::openapi_get_spec
source · [−]macro_rules! openapi_get_spec {
($settings:ident :
$($route:expr),* $(,)*) => { ... };
($($route:expr),* $(,)*) => { ... };
}
Expand description
Generate OpenApi
spec only, does not generate routes.
This can be used in cases where you are only interested in the openAPI spec, but not in the routes.
A use case could be inside of build.rs
scripts or where you want to alter OpenAPI object
at runtime.
Example:
ⓘ
use okapi::openapi3::OpenApi;
let settings = rocket_okapi::settings::OpenApiSettings::new();
let spec: OpenApi = openapi_get_spec![settings: create_message, get_message];
Or
ⓘ
use okapi::openapi3::OpenApi;
let spec: OpenApi = openapi_get_spec![create_message, get_message];