简体   繁体   中英

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

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM