utoipa icon indicating copy to clipboard operation
utoipa copied to clipboard

utoipa_swagger_ui: doesn't work with warp

Open trkohler opened this issue 1 year ago • 1 comments

image What is the recommended way to add swagger ui to arp framework? If there is any?

I tried to use it like that (https://github.com/juhaku/utoipa/blob/6e3cb4b9be5072108e999b982b17ffae117d65ac/examples/todo-axum/src/main.rs#L52) but it is not type compatible.

 |
36 |       .merge(SwaggerUi::new("/swagger-ui/*tail").url("/api-doc/openapi.json", ApiDoc::openapi()))
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `axum::Router`, found struct `SwaggerUi`

trkohler avatar Aug 10 '22 14:08 trkohler

Yeah that syntax is the new syntax coming in version 2.0.0 once released. In 1.1.0 release the syntax is bit more complicated similar to the existing for tide and warp framework. To see how it works one need to go back in time to see the example in that point of the releases. See here 1.1.0 example https://github.com/juhaku/utoipa/blob/utoipa-1.1.0/examples/todo-axum/src/main.rs.

juhaku avatar Aug 10 '22 19:08 juhaku

thanks for explaining! I currently forked the main to be able to make the same as written in your examples, but would be waiting for the release!

trkohler avatar Aug 12 '22 10:08 trkohler