This crate implements necessary boiler plate code to serve Swagger UI via web server. It works as a bridge for serving the OpenAPI documetation created with utoipa libarary in the Swagger UI.
Currently implemented boiler plate for:
version >= 4
version >=0.5.0-rc.1
Serving Swagger UI is framework independant thus this crate also supports serving the Swagger UI with other frameworks as well. With other frameworks there is bit more manual implementation to be done. See more details at serve or examples.
Use only the raw types without any boiler plate implementation. ```text [dependencies] utoipa-swagger-ui = "1.0.0"
Enable actix-web framework with Swagger UI you could define the dependency as follows.
text
[dependencies]
utoipa-swagger-ui = { version = "1.0.0", features = ["actix-web"] }
```
Note! Also remember that you already have defined utoipa
dependency in your Cargo.toml
Serve Swagger UI with api doc via actix-web.
rust
HttpServer::new(move || {
App::new()
.service(
SwaggerUi::new("/swagger-ui/{_:.*}")
.url("/api-doc/openapi.json", ApiDoc::openapi()),
)
})
.bind((Ipv4Addr::UNSPECIFIED, 8989)).unwrap()
.run();
actix-web feature need to be enabled.
Serve Swagger UI with api doc via rocket. ```rust
fn rocket() -> Rocket
Licensed under either of Apache 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, shall be dual licensed, without any additional terms or conditions.