Enabling Swagger UI on OpenApi
See original GitHub issueHello,
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 😦
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Using OpenAPI and Swagger UI - Quarkus
Swagger UI ; quarkus.swagger-ui.enable. If Swagger UI is included, it should be enabled/disabled. By default, Swagger UI is enabled if it is included...
Read more >Configuration - Swagger Documentation
Configuration. How to configure. Swagger UI accepts configuration parameters in four locations. ... A JavaScript object describing the OpenAPI definition.
Read more >Getting Started with OpenAPI Tools | Swagger Open Source
Use the Swagger Editor to create your OAS definition and then use Swagger Codegen to generate server implementation. Use the Swagger UI to...
Read more >REST API Documentation Tool | Swagger UI
Swagger UI allows development team to visualize and interact with the API's resources without having any of the implementation logic in place. Learn...
Read more >CORS - Swagger Documentation
Swagger UI is hosted on the same server as the application itself (same host and port). The application is located behind a proxy...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tipsy I am having the same problem but it is because the server is behind a reverse proxy. How can I set a prefix to let swagger ui know where to read the files ? like localhost:8000/webjars -> localhost:8000/myprefix/webjars
Oh Yes, I was using a different plugin. Thanks, @tipsy. It’s fine now.