Package com.jsgalactic.axiom.openapi.ui
Class SwaggerUi.Builder
java.lang.Object
com.jsgalactic.axiom.openapi.ui.SwaggerUi.Builder
- Enclosing class:
SwaggerUi
Configures a
SwaggerUi. Not thread-safe; build once at startup.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the configuration.Sets where the UI is served.Adds a document the UI can display.Sets the page title.
-
Method Details
-
path
Sets where the UI is served.- Parameters:
path- absolute path without a trailing slash and without parameters, default/docs- Returns:
- this builder
-
title
Sets the page title.- Parameters:
title- text shown in the browser tab- Returns:
- this builder
-
spec
Adds a document the UI can display. With several, the UI offers a selector and starts with the first.- Parameters:
name- label, for exampleOpenAPI 3.1url- same-origin path of the document, for example/openapi.json- Returns:
- this builder
- Throws:
IllegalArgumentException- if the URL is not a same-origin path (a scheme, host or//would be refused by the page's Content-Security-Policy)
-
build
Builds the configuration.- Returns:
- an immutable
SwaggerUi - Throws:
IllegalStateException- if no spec was added
-