Getting Started
Add Dependency
To serve Swagger UI, you need to include the ktor-swagger-ui
artifact in the build script.
All artifacts are published to Maven Central.
implementation("io.github.smiley4:ktor-swagger-ui:$version")
implementation 'io.github.smiley4:ktor-swagger-ui:$version'
<dependency>
<groupId>io.github.smiley4</groupId>
<artifactId>ktor-swagger-ui</artifactId>
<version>${version}</version>
</dependency>
Usage
routing {
route("swagger") {
swaggerUI("/api.json") {
//...
}
}
}
Using Swagger UI with auto-generated OpenAPI specification
routing {
route("api.json") {
openApi()
}
route("swagger") {
swaggerUI("/api.json")
}
}
Configuration Options
For more information on available configuration options, please see the api reference.