Feature/swagger UI (#34)
This commit is contained in:
39
kompendium-swagger-ui/build.gradle.kts
Normal file
39
kompendium-swagger-ui/build.gradle.kts
Normal file
@ -0,0 +1,39 @@
|
||||
plugins {
|
||||
`java-library`
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
|
||||
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
||||
implementation(libs.bundles.ktor)
|
||||
api(libs.ktor.webjars)
|
||||
implementation(libs.webjars.swagger.ui)
|
||||
testImplementation("org.jetbrains.kotlin:kotlin-test")
|
||||
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
|
||||
testImplementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.12.0")
|
||||
testImplementation("io.ktor:ktor-server-test-host:1.5.3")
|
||||
}
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "GithubPackages"
|
||||
url = uri("https://maven.pkg.github.com/lg-backbone/kompendium")
|
||||
credentials {
|
||||
username = System.getenv("GITHUB_ACTOR")
|
||||
password = System.getenv("GITHUB_TOKEN")
|
||||
}
|
||||
}
|
||||
}
|
||||
publications {
|
||||
create<MavenPublication>("kompendium") {
|
||||
from(components["kotlin"])
|
||||
artifact(tasks.sourcesJar)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package org.leafygreens.kompendium.swagger
|
||||
|
||||
import io.ktor.application.call
|
||||
import io.ktor.response.respondRedirect
|
||||
import io.ktor.routing.Routing
|
||||
import io.ktor.routing.get
|
||||
|
||||
fun Routing.swaggerUI(openApiJsonUrl: String = "/openapi.json") {
|
||||
get("/swagger-ui") {
|
||||
call.respondRedirect("/webjars/swagger-ui/index.html?url=$openApiJsonUrl", true)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user