question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enabling Swagger UI on OpenApi

See original GitHub issue

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 😦

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
iruxcommented, May 3, 2021

@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

1reaction
elvisolscommented, Jan 4, 2020

Oh Yes, I was using a different plugin. Thanks, @tipsy. It’s fine now.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found