From 5834541404c7b9c8aa7dcf9da651951312b78509 Mon Sep 17 00:00:00 2001 From: vladislav Date: Sun, 20 Jul 2025 00:03:32 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20SwaggerUI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 1 + src/main/kotlin/Swagger.kt | 13 +++++++++++++ openapi.yaml => src/main/resources/openapi.yaml | 0 3 files changed, 14 insertions(+) create mode 100644 src/main/kotlin/Swagger.kt rename openapi.yaml => src/main/resources/openapi.yaml (100%) diff --git a/build.gradle.kts b/build.gradle.kts index 4d9c35a..43fb549 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,6 +34,7 @@ dependencies { implementation("io.ktor:ktor-server-content-negotiation") implementation("io.ktor:ktor-serialization-kotlinx-json") implementation("io.ktor:ktor-server-netty") + implementation("io.ktor:ktor-server-swagger") implementation("ch.qos.logback:logback-classic:1.5.13") implementation("com.github.bitfireAT:dav4jvm:2.2.1") implementation("io.ktor:ktor-client-logging:3.2.2") diff --git a/src/main/kotlin/Swagger.kt b/src/main/kotlin/Swagger.kt new file mode 100644 index 0000000..f1d86ca --- /dev/null +++ b/src/main/kotlin/Swagger.kt @@ -0,0 +1,13 @@ +package com.nano + +import io.ktor.server.application.Application +import io.ktor.server.plugins.swagger.swaggerUI +import io.ktor.server.routing.routing + +fun Application.configureSwagger() { + routing { + routing { + swaggerUI(path = "swagger", swaggerFile = "openapi.yaml") + } + } +} \ No newline at end of file diff --git a/openapi.yaml b/src/main/resources/openapi.yaml similarity index 100% rename from openapi.yaml rename to src/main/resources/openapi.yaml