Hello,
Please, I'm new to Javalin and I will love to expose my API using SwaggerUI, hosted on my embedded jetty server.
Below is my configuration:
return new OpenApiOptions(applicationInfo)
.path("/swagger-json")
.activateAnnotationScanningFor("my.package")
.swagger(new SwaggerOptions("/swagger").title("My Swagger Documentation"))
.reDoc(new ReDocOptions("/redoc").title("My ReDoc Documentation")) ;
But I'm getting a blank page when I visit ~/swagger and the following on my console.
http://localhost:7001/webjars/swagger-ui/3.23.8/swagger-ui.css net::ERR_ABORTED 404 (Not Found)
swagger:27 GET http://localhost:7001/webjars/swagger-ui/3.23.8/swagger-ui-bundle.js net::ERR_ABORTED 404 (Not Found)
swagger:28 GET http://localhost:7001/webjars/swagger-ui/3.23.8/swagger-ui-standalone-preset.js net::ERR_ABORTED 404 (Not Found)
swagger:31 Uncaught ReferenceError: SwaggerUIBundle is not defined
at window.onload (swagger:31)
Please note that I enabled Webjars ...config.enableWebjars();... but still not working :(
Hi @elvisols, can you try cloning the examples from https://javalin.io/tutorials/openapi-example ?
Thanks @tipsy
Swagger-ui still isn't coming up. Still getting the previous console error of SwaggerUIBundle not defined However after adding the redoc dependency, the redoc ui displayed fine. Is there something I might be missing with Swagger-UI?
You shouldn't have to do anything differently. Are you including a different version than the plugin expects?
Oh Yes, I was using a different plugin. Thanks, @tipsy. It's fine now.
Great, happy you got it working!