-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
examples/axum-utoipa-bindings: the swagger ui cannot be shown properly when loading /swagger-ui
#1152
Comments
+1 having the same issue here |
Added a quick revert here #1153 |
Can confirm the issue of the assets being not |
Right, I'd then just fix this directly, because reverting back to the original, is not feasible either it will again break the behavior the original commit was meant to fix.
I would be interested to see whether this would fix the issue for both use cases. |
i've created a PR (#1155) based on the patch in my previous comment. without my change, |
before a985d8c, the swagger ui can be shown when loading
/swagger-ui
.the request for
/swagger-ui
is redirected to/swagger-ui/
and the assets of the swagger ui are loaded properly.a985d8c breaks this behavior and the request for
/swagger-ui
is not redirected and urls of the assets are wrong.because the url of the swagger ui is
/swagger-ui
and relative urls of the assets are resolved with/
.i think that it's better to revert a985d8c on the
master
branch. then fix #1042 properly.the simplest solution is
panic!()
whenSwaggerUi::new()
is called with/
.i think that this is acceptable for most people because mounting the swagger ui to
/
is rare.another solution is adding the route for redirect only when the
path
does not end with/
.in this case, a request for
/swagger-ui
won't be redirected ifSwaggerUi::new()
is called with/swagger-ui/
.but i think that this is what the code is intended to do.
there is another solution.
currently, assets are specified with relative urls.
so, using absolute urls for the assets in the html document of the swagger ui can solve this issue without the redirect.
but, this kind of change affects servers other than axum and you may have to pay more cost for testing than other solutions.
i prefer the second solution, but you can choose one of any solutions.
The text was updated successfully, but these errors were encountered: