feat: Remove Swagger and OpenAPI

Support and features are lacking
This commit is contained in:
oSumAtrIX
2024-01-29 11:31:15 +01:00
parent df999c00c4
commit af0b0865f4
7 changed files with 3 additions and 2818 deletions

View File

@@ -6,18 +6,10 @@ import io.ktor.server.application.*
import io.ktor.server.plugins.cachingheaders.*
import io.ktor.server.plugins.conditionalheaders.*
import io.ktor.server.plugins.cors.routing.*
import io.ktor.server.plugins.openapi.*
import io.ktor.server.plugins.swagger.*
import io.ktor.server.routing.*
import kotlin.time.Duration.Companion.minutes
fun Application.configureHTTP() {
install(ConditionalHeaders)
routing {
swaggerUI(path = "openapi")
}
routing {
openAPI(path = "openapi")
}
install(CORS) {
allowMethod(HttpMethod.Options)
allowMethod(HttpMethod.Put)
@@ -27,11 +19,8 @@ fun Application.configureHTTP() {
anyHost() // @TODO: Don't do this in production if possible. Try to limit it.
}
install(CachingHeaders) {
options { _, outgoingContent ->
when (outgoingContent.contentType?.withoutParameters()) {
ContentType.Text.CSS -> CachingOptions(CacheControl.MaxAge(maxAgeSeconds = 24 * 60 * 60))
else -> null
}
options { _, _ ->
CachingOptions(CacheControl.MaxAge(maxAgeSeconds = 5.minutes.inWholeSeconds.toInt()))
}
}
}

View File

@@ -1,23 +0,0 @@
openapi: "3.0.3"
info:
title: "Application API"
description: "Application API"
version: "1.0.0"
servers:
- url: "http://0.0.0.0:8080"
paths:
/:
get:
description: "Hello World!"
responses:
"200":
description: "OK"
content:
text/plain:
schema:
type: "string"
examples:
Example#1:
value: "Hello World!"
components:
schemas: