Plugin and Swagger Configuration - SMILEY4/ktor-openapi-tools GitHub Wiki
When installing the plugin with install(SwaggerUI)
, sensible default values will be used and can be overwritten when
required.
install(SwaggerUI) {
swagger {
displayOperationId = false
showTagFilterInput = false
sort = SwaggerUiSort.NONE
syntaxHighlight = SwaggerUiSyntaxHighlight.AGATE
withCredentials = false
}
schemas {
// configure shared schemas...
// customize schema generation ...
// See "Customizing-Schemas" for more information
}
examples {
// configure shared examples ...
// See "Shared Examples" for more information
}
spec("different-api") {
// Specific plugin, swagger and openapi-spec configuration when using multiple specs
// see "Multiple Api-Specs" for more information
}
specAssigner = { _, _ -> PluginConfigDsl.DEFAULT_SPEC_ID }
pathFilter = { _, url -> url.firstOrNull() != "hidden" }
ignoredRouteSelectors = emptySet()
outputFormat = OutputFormat.JSON
postBuild = { api -> println("Completed api: $api") }
}
Property | Description | Default |
---|---|---|
swagger.displayOperationId |
Whether to show the operation-id of endpoints in the list. | false |
swagger.showTagFilterInput |
Whether the top bar will show an edit box that can be used to filter the tagged operations. | false |
swagger.sort |
Apply a sort to the operation list. NONE , ALPHANUMERICALLY or HTTP_METHOD |
NONE |
swagger.syntaxHighlight |
Syntax coloring theme to use. DISABLED , AGATE , ARTA , MONOKAI , NORD , OBSIDIAN , TOMORROW_NIGHT or IDEA |
AGATE |
swagger.withCredentials |
If set to true, enables passing credentials, in CORS requests that are sent by the browser (default false). | false |
specAssigner |
Assigns routes without an explicitly specified specId to an openapi-spec. | no-op |
pathFilter |
Filter to apply to all routes. Return 'false' for routes to not include them in the OpenApi-Spec and Swagger-UI. | no-op |
ignoredRouteSelectors |
ktor route-selectors (and all their sub-classes) in this list are ignored in the route-urls | empty |
postBuild |
Action that is called with the final openapi-spec. | no-op |
spec(specId)... |
Specific plugin, swagger and openapi-spec configuration when using multiple specs. Multiple specs with different ids can be configured. See TODO for more information. | |
schemas... |
Configure shared schemas or customize schema generation. See TODO for more information. | |
examples... |
Configure shared examples. See TODO for more information. | |
outputFormat |
Output format of the api spec, either JSON or YAML |
JSON |