Skip to main content

spec_url

Function spec_url 

Source
pub fn spec_url() -> Option<String>
Expand description

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").

The playground plugin reads this at HTML-render time to inject the URL into the shell page as a JS global, so a re-mounted spec is auto-discovered by the SPA without the user having to also configure the playground.