Skip to main content

Crate umbral_openapi

Crate umbral_openapi 

Source
Expand description

umbral-openapi — auto-generated OpenAPI 3.0 schema + Swagger UI.

Register OpenApiPlugin on App::builder() alongside RestPlugin. The plugin walks the migration registry, drops the tables umbral-rest hides by default, and emits an OpenAPI 3.0 document describing every remaining model’s REST surface.

Default mount point is /openapi/:

  • GET /openapi/openapi.json — the JSON spec
  • GET /openapi/ — Swagger UI loaded from unpkg

Override via OpenApiPlugin::new().at("/api/docs") to put the UI under /api/docs/ and the JSON under /api/docs/openapi.json.

§Scope

v1 only describes umbral-rest’s auto-generated endpoints. Hand- written routes the user added on the builder are not in scope. The spec emits a components.securitySchemes block populated from the REST layer’s registered auth schemes (via umbral_rest::registered_security_schemes()). List endpoints include the pagination query parameters that match the configured backend — page/page_size for umbral_rest::PageNumberPagination, limit/offset for umbral_rest::LimitOffsetPagination, none for umbral_rest::NoPagination (the default).

Structs§

OpenApiPlugin
The OpenAPI plugin.

Functions§

spec_url
Public read of the configured spec URL — the path the JSON document is served at after App::build() runs. Returns None when OpenApiPlugin isn’t installed (the OnceLock hasn’t been populated by Plugin::routes() yet); returns Some("/openapi/openapi.json") for the default mount and Some("/api/docs/openapi.json") when the user calls OpenApiPlugin::default().at("/api/docs").