Skip to main content

infrastructure_routes

Function infrastructure_routes 

Source
pub fn infrastructure_routes() -> Vec<ProjectionRoute>
Expand description

The routes that are the projection’s own rather than capabilities, read from the surfaces that declare them: where each answers, what it is, and whether a publication can carry it.

It was a constant list, and a constant list is how /docs came to mean Swagger UI in three files and documentation in a fourth. The declarations in crate::web::discover are the one place a mount is written; crate::web::projection_routes reads them, and the document, the site dataset, the generated reference and the Cockpit all read that. A reader of this document is often a published page with no server behind it, so the availability travels with the route.

use majordomus_cli::http::openapi::infrastructure_routes;
use majordomus_cli::web::Availability;
let routes = infrastructure_routes();
let swagger = routes.iter().find(|r| r.path == "/swagger").unwrap();
assert_eq!(swagger.availability, Availability::ServedOnly);
assert!(routes.iter().all(|r| !r.what.is_empty()));
assert!(!routes.iter().any(|r| r.path.starts_with("/api/v1/")), "a capability route is not infrastructure");