Skip to content

Commit

Permalink
Swagger UI debug embed (#534)
Browse files Browse the repository at this point in the history
Add explanation of Swagger UI not being embedded on debug builds

---------

Co-authored-by: Daniél Kerkmann <daniel@kerkmann.dev>
  • Loading branch information
juhaku and kerkmann authored Mar 21, 2023
1 parent 323b155 commit 39ef61f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,19 @@ This would produce api doc something similar to:
- More about OpenAPI security in [security documentation](https://docs.rs/utoipa/latest/utoipa/openapi/security/index.html).
- Dump generated API doc to file at build time. See [issue 214 comment](https://github.com/juhaku/utoipa/issues/214#issuecomment-1179589373).

## General Pitfalls

#### Swagger UI returns 404 Not Found from build binary

This is highly probably due to `RustEmbed` not embedding the Swagger UI to the executable. This is natural since the `RustEmbed`
library **does not** by default embed files on debug builds. To fix this you can do one of the following.

1. Build your executable in `--release` mode
2. or add `debug-embed` feature flag to your `Cargo.toml` for `utoipa-swagger-ui`. This will enable the debug emebed feature flag for
`RustEmbed` as well. Read more about this [here](https://github.com/juhaku/utoipa/issues/527#issuecomment-1474219098) and [here](https://github.com/juhaku/utoipa/issues/268).

Find `utoipa-swagger-ui` [feature flags here](https://github.com/juhaku/utoipa/tree/master/utoipa-swagger-ui#crate-features).

# License

Licensed under either of [Apache 2.0](LICENSE-APACHE) or [MIT](LICENSE-MIT) license at your option.
Expand Down

0 comments on commit 39ef61f

Please sign in to comment.