In this blog post we are going to look at the new styling and other new options available in OpenAPI and SwaggerUI Quarkus (v1.10.0 +).
The default style for Swagger UI has changed from the vanilla Swagger UI to a Quarkus branded page:
Swagger UI Themes are now available in configuration, with the default theme being ‘feeling blue’.
You can change the theme by setting the
quarkus.swagger-ui.theme property, for example:
You can also go back to the original (vanilla) Swagger UI theme:
Theme options available:
- feeling-blue (default)
As part of the custom branding, you can supply your own logo to replace the Quarkus logo. We are going to use Standard Bank as an example on how you can brand the page:
NOTE: Hot reload is not working for logo changes, and remember browser cache, you might need to force refresh your browser.
To supply your own logo, you need to place a file called
You can go further, and supply your own
style.css, to fine-tune the branding. In example, to change the
topbar of the Swagger-UI screen to the corporate colors of Standard Bank:
<1> here set the
topbar background color.
You can change any styling element in this css file, you need to place this file called
Other styling options
You can also set the HTML title, and add a footer:
Along with other OpenAPI Header fields that can be set via config (as discussed in this post):
The UI is now fully branded:
Other Swagger UI Options
Another new feature available in Quarkus (v1.10.0 +) is the ability to set any of the configuration options available in Swagger UI. As an example, we can set the
urls and add the petstore (as the default selected option) to Swagger UI:
This will change the
topbar to have a dropdown box with the urls provided:
supportedSubmitMethods can hide the
Try it out button for certain HTTP Method Types:
Note below the missing
Try it out button on the
All other Swagger UI options are now available to configure the UI.
Other Small new features
Two small new features in OpenAPI and Swagger UI, the ability to add the Health Endpoints and the ability to disable the UI and/or Schema in Runtime.
Add Health API to Open API
If you are using the
smallrye-health extension, you can add the Health Endpoints to OpenAPI:
Disable in Runtime
If you included the UI in your app (
quarkus.swagger-ui.always-include=true), you can now disable it when starting the application.
This will return a HTTP 404 (Not Found) on the Swagger UI page.
Similarly you can disable the schema (usually under
/openai) by doing: