macro_rules! openapi_get_routes {
    ($settings:ident :
     $($route:expr),* $(,)*) => { ... };
    ($($route:expr),* $(,)*) => { ... };
}
Expand description

A replacement macro for rocket::routes. This also takes a optional settings object.

The key differences are that this macro will add an additional element to the resulting Vec<rocket::Route>, which serves a static file called openapi.json. This file can then be used to display the routes in the Swagger/RapiDoc UI.

Example:

use okapi::openapi3::OpenApi;
let settings = rocket_okapi::settings::OpenApiSettings::new();
let routes: Vec<rocket::Route> =
    openapi_get_routes![settings: create_message, get_message];

Or

use okapi::openapi3::OpenApi;
let routes: Vec<rocket::Route> =
    openapi_get_routes![create_message, get_message];