SMILEY4 / ktor-swagger-ui

Kotlin Ktor plugin to generate OpenAPI and provide Swagger UI
Apache License 2.0
142 stars 26 forks source link

index.html Not found #23

Closed MikeDirven closed 1 year ago

MikeDirven commented 1 year ago

when trying to go to the swagger documentation the index.html is not found in the webjar. Used version of the liberary: 1.1.0

2023-01-31 09:22:20.132 [main] INFO  Application - Responding at http://127.0.0.1:8080
2023-01-31 10:03:35.677 [eventLoopGroupProxy-4-2] TRACE io.ktor.server.sessions.Sessions - Sessions found for /swagger-ui/index.html: Session
2023-01-31 10:03:35.686 [eventLoopGroupProxy-4-2] TRACE io.ktor.routing.Routing - Trace for [swagger-ui, index.html]
/, segment:0 -> SUCCESS @ /
  /swagger-ui, segment:1 -> SUCCESS @ /swagger-ui
    /swagger-ui/(method:GET), segment:1 -> FAILURE "Not all segments matched" @ /swagger-ui/(method:GET)
    /swagger-ui/api.json, segment:1 -> FAILURE "Selector didn't match" @ /swagger-ui/api.json
    /swagger-ui/{filename}, segment:2 -> SUCCESS; Parameters [filename=[index.html]] @ /swagger-ui/{filename}
      /swagger-ui/{filename}/(method:GET), segment:2 -> SUCCESS @ /swagger-ui/{filename}/(method:GET)
  /api, segment:0 -> FAILURE "Selector didn't match" @ /api
  /{...}, segment:0 -> FAILURE "Better match was already found" @ /{...}
Matched routes:
  "" -> "swagger-ui" -> "{filename}" -> "(method:GET)"
Route resolve result:
  SUCCESS; Parameters [filename=[index.html]] @ /swagger-ui/{filename}/(method:GET)
2023-01-31 10:03:35.690 [eventLoopGroupProxy-4-2] TRACE io.ktor.server.sessions.Sessions - Sending session data for /swagger-ui/index.html: Session
2023-01-31 10:03:35.691 [eventLoopGroupProxy-4-2] TRACE i.k.s.p.c.ContentNegotiation - Skipping because the type is ignored.
2023-01-31 10:03:35.697 [eventLoopGroupProxy-4-2] TRACE i.k.s.p.compression.Compression - Skip compression because no suitable encoder found.
2023-01-31 10:03:35.698 [eventLoopGroupProxy-4-2] TRACE i.k.s.p.statuspages.StatusPages - No handler found for status code 404 Not Found for call: /swagger-ui/index.html
2023-01-31 10:03:35.832 [eventLoopGroupProxy-4-2] TRACE Application - 404 Not Found: GET - /swagger-ui/index.html

My configuration:

install(SwaggerUI){
        pathFilter = { _, url -> url.firstOrNull() == "api" }
        swagger {
            forwardRoot = false
            swaggerUrl = "swagger-ui"
            onlineSpecValidator()
            displayOperationId = true
            showTagFilterInput = true
            syntaxHighlight = SwaggerUiSyntaxHighlight.MONOKAI
        }

        info {
            title = "Ktor swagger"
            version = "latest"
            description = "Ktor swagger api documentation"
            contact {
                name = "Mike Dirven"
                url = "http://www.icsvertex.nl"
                email = "m.dirven@ams.icsvertex.nl"
            }
        }
    }
MikeDirven commented 1 year ago

Issue has been resolved there was another old swagger-ui liberary that imported the swagger-ui webjar version 4.15.5 while yours is using 4.15.0

Frontrider commented 1 year ago

I have the same issue, the jar is the right version.

2023-03-19T00:41:06.075763177Z 156343 [DefaultDispatcher-worker-11] TRACE io.ktor.routing.Routing  - Trace for [docs, index.html]
2023-03-19T00:41:06.075790327Z /, segment:0 -> SUCCESS @ /
2023-03-19T00:41:06.075795139Z   /docs, segment:1 -> SUCCESS @ /docs
2023-03-19T00:41:06.075798344Z     /docs/(method:GET), segment:1 -> FAILURE "Not all segments matched" @ /docs/(method:GET)
2023-03-19T00:41:06.075801185Z     /docs/api.json, segment:1 -> FAILURE "Selector didn't match" @ /docs/api.json
2023-03-19T00:41:06.075804172Z     /docs/{filename}, segment:2 -> SUCCESS; Parameters [filename=[index.html]] @ /docs/{filename}
2023-03-19T00:41:06.075807149Z       /docs/{filename}/(method:GET), segment:2 -> SUCCESS @ /docs/{filename}/(method:GET)
2023-03-19T00:41:06.075809851Z   /login, segment:0 -> FAILURE "Selector didn't match" @ /login
2023-03-19T00:41:06.075812465Z   /(authenticate "default"), segment:0 -> SUCCESS @ /(authenticate "default")
2023-03-19T00:41:06.075815320Z     /(authenticate "default")/user, segment:0 -> FAILURE "Selector didn't match" @ /(authenticate "default")/user
2023-03-19T00:41:06.075818275Z   /, segment:0 -> SUCCESS @ /
2023-03-19T00:41:06.075821062Z     /storage, segment:0 -> FAILURE "Selector didn't match" @ /storage
2023-03-19T00:41:06.075823758Z Matched routes:
2023-03-19T00:41:06.075826262Z   "" -> "docs" -> "{filename}" -> "(method:GET)"
2023-03-19T00:41:06.075839388Z Route resolve result:
2023-03-19T00:41:06.075842599Z   SUCCESS; Parameters [filename=[index.html]] @ /docs/{filename}/(method:GET)
2023-03-19T00:41:06.139270846Z 156407 [DefaultDispatcher-worker-15] TRACE io.ktor.routing.Routing  - Trace for [favicon.ico]
2023-03-19T00:41:06.139293204Z /, segment:0 -> SUCCESS @ /
2023-03-19T00:41:06.139295922Z   /docs, segment:0 -> FAILURE "Selector didn't match" @ /docs
2023-03-19T00:41:06.139299896Z   /login, segment:0 -> FAILURE "Selector didn't match" @ /login
2023-03-19T00:41:06.139302895Z   /(authenticate "default"), segment:0 -> SUCCESS @ /(authenticate "default")
2023-03-19T00:41:06.139306072Z     /(authenticate "default")/user, segment:0 -> FAILURE "Selector didn't match" @ /(authenticate "default")/user
2023-03-19T00:41:06.139308676Z   /, segment:0 -> SUCCESS @ /
2023-03-19T00:41:06.139310976Z     /storage, segment:0 -> FAILURE "Selector didn't match" @ /storage
2023-03-19T00:41:06.139316746Z Matched routes:
2023-03-19T00:41:06.139319276Z   No results
2023-03-19T00:41:06.139321394Z Route resolve result:
2023-03-19T00:41:06.139324019Z   FAILURE "No matched subtrees found" @ /
Frontrider commented 1 year ago

/docs/api.json returns an empty json as well.