Describe your question
First, a bit of context: on #254, one of the comments by @tipsy suggests using a simple
get("/my-docs", SwaggerRenderer("exampleApiSpec.yaml"))
To expose Swagger documentation from a yaml file - which I will generate manually at this time.
This, initially, outputs a page on my-docs telling me to add a dependency on swagger-ui's webjar (that is, compile 'org.webjars:swagger-ui:3.17.6'). After doing this, accessing /my-docs on a browser shows me a blank web page. Its source is there, it's a short-ish html that is in SwaggerRenderer.kt, but it seems like it cannot find the resources from the Webjar on the server.
So, at this point, I'm stumped. According to #309, Webjars should be enabled automatically, but I'm missing something.
How do I expose swagger-ui's Webjar?
Hi @fmobus, I reverted #309 in 061e641b23272dab0a857ebadccb6ddb2fd27e9a, it was one of the last changes before releasing 2.0.0. I've updated the issues you linked to in order to reflect this. To enable swagger you'll have to do:
val app = Javalin.create().apply {
enableWebJars()
get("/my-docs", SwaggerRenderer("exampleApiSpec.yaml"))
}.start(0)
That worked! Thanks!