Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Config Swagger-ui path

I'm config swagger-ui path from this context below using yml file and using quarkus

swagger-ui:
path: /clinic/swagger-ui

but when start my application and access swagger can't see the page swagger-ui and changing the configuration as bellow, i can see the page swagger-ui when I change it back to the above configuration I can see the swagger-ui.

swagger-ui:
path: /swagger-ui

I do this and it works during local execution if it stops and restart my application I have to redo the same steps that I described above. Is the any solution for me not to need this? Because I have a rule which I must follow where the rest of the routes and endpoint's rest must be inside /clinic as below

/clinic/swagger-ui -> page swagger

/clinic/api/ -> endpoints rest's

like image 452
Robson passarella teixeira Avatar asked May 20 '26 17:05

Robson passarella teixeira


1 Answers

This works following the Quarkus guide for OpenAPI and Swagger UI. To reproduce, I did the following:

  1. Create a Quarkus (1.8.1) project with the following extensions:
    • quarkus-smallrye-openapi
    • quarkus-config-yaml (for your application.yml)
    • quarkus-resteasy (for programming REST services)
    • quarkus-resteasy-jsonb
  2. Create your REST endpoint (I just did the /fruits example of the aforementioned guide)
  3. Configure application.yml
quarkus:
    smallrye-openapi:
        path: /fruit/openapi
    swagger-ui:
        path: /fruit/swagger-ui
        always-include: true

Now you can access the OpenAPI yml via curl http://localhost:8080/fruit/openapi and the Swagger UI by pointing your browser to http://localhost:8080/fruit/swagger-ui.

Please note that the setting always-include: true makes the Swagger UI available even in production!

like image 108
rowing-ghoul Avatar answered May 23 '26 05:05

rowing-ghoul