Skip to content
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

swagger-ui/index.html only reachable via direct URI /swagger-ui/4.14.3/index.html in spring boot native and springdoc 2 #1898

Closed
vgropp opened this issue Oct 20, 2022 · 2 comments
Labels
invalid This doesn't seem right

Comments

@vgropp
Copy link

vgropp commented Oct 20, 2022

Hi,

when using a native buildpack docker image with spring boot i can only request swagger-ui via direct request to /swagger-ui/4.14.3/index.html, when calling /swagger-ui.html it does redirect to /swagger-ui-/index-html but that results in a 404 response. When calling /swagger-ui/4.14.3/index.html the UI does work (without oauth authentication because of wrong redirect links). The json is sucessfully reachable via /v3/api-docs

I am using spring boot 3 m5 and springdoc-openapi-starter-webmvc-ui 2.0.0-M7

i had to include

    {
      "pattern":"\\QMETA-INF/resources/webjars/swagger-ui/4.14.3/favicon-32x32.png\\E"
    },
    {
      "pattern":"\\QMETA-INF/resources/webjars/swagger-ui/4.14.3/index.css\\E"
    },
    {
      "pattern":"\\QMETA-INF/resources/webjars/swagger-ui/4.14.3/index.html\\E"
    },
    {
      "pattern":"\\QMETA-INF/resources/webjars/swagger-ui/4.14.3/oauth2-redirect.html\\E"
    },
    {
      "pattern":"\\QMETA-INF/resources/webjars/swagger-ui/4.14.3/swagger-initializer.js\\E"
    },
    {
      "pattern":"\\QMETA-INF/resources/webjars/swagger-ui/4.14.3/swagger-ui-bundle.js.map\\E"
    },
    {
      "pattern":"\\QMETA-INF/resources/webjars/swagger-ui/4.14.3/swagger-ui-bundle.js\\E"
    },
    {
      "pattern":"\\QMETA-INF/resources/webjars/swagger-ui/4.14.3/swagger-ui-standalone-preset.js.map\\E"
    },
    {
      "pattern":"\\QMETA-INF/resources/webjars/swagger-ui/4.14.3/swagger-ui-standalone-preset.js\\E"
    },
    {
      "pattern":"\\QMETA-INF/resources/webjars/swagger-ui/4.14.3/swagger-ui.css.map\\E"
    },
    {
      "pattern":"\\QMETA-INF/resources/webjars/swagger-ui/4.14.3/swagger-ui.css\\E"
    },

into resource-config.json (generate by native-image-agent). Is there something missing or is it a bug? Reading other issues (#1887) it seems like it should work. I did not override springdoc.swagger-ui.path. It does work when running in a jdk and not as a native app in graalvm

@bnasslahsen
Copy link
Contributor

bnasslahsen commented Oct 20, 2022

@vgropp,

Read this ticket, which is still open:

In spring-native: hiting /swagger-ui.html will redirect you to /swagger-ui/4.14.3/index.html.
There is no available workaround for it right now.

@bnasslahsen bnasslahsen added the invalid This doesn't seem right label Oct 20, 2022
@vgropp
Copy link
Author

vgropp commented Oct 20, 2022

thanks for your fast reponse and hint

springdoc:
  enable-native-support: true

did the trick

@springdoc springdoc locked as resolved and limited conversation to collaborators Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants