Search code examples
swagger-uiquarkus

Quarkus Manually Set Open API Url


So I know I can change the open api path with quarkus.smallrye-openapi.path=/openapi

However I am using an api gateway and at the beginning of my services I identify them with something like https://gateurl/notification/swagger-ui/

How do I change the url for open api so I don't have to manually put /notification/openapi in swagger each time I open the url

enter image description here

enter image description here


Solution

  • You can use quarkus.swagger-ui.urls to set one or more urls. See https://quarkus.io/guides/openapi-swaggerui#quarkus-swaggerui_quarkus.swagger-ui.urls-urls

    Example:

    quarkus.swagger-ui.urls.default=https://gateurl/notification/swagger-ui/
    

    This will change the url as you want it.

    You can also add both (one that goes through the gateway and one direct for example):

    quarkus.swagger-ui.urls.default=https://gateurl/notification/swagger-ui/
    quarkus.swagger-ui.urls.direct=/q/openapi
    quarkus.swagger-ui.urls-primary-name=default
    

    This will give you a dropdown with the gateway one selected by default.

    See https://github.com/phillip-kruger/openapi-example for a example.