Im writing some rstAPI with Ktor and want it to be autodocumentated
I dont need swagger html generation and stuff, just raw openapi.yml
Searching for “ktor openapi generation” and etc gives me official docs link (https://ktor.io/docs/server-openapi.htm)
But, if i try to write same code in my project
fun main() {
embeddedServer(
Netty,
port = Config.load().main.port,
host = Config.load().main.host,
module = Application::module
).start(wait = true)
}
fun Application.module() {
routing {
route("/api") {
get {
call.respond("Hello world!")
}
}
openAPI(path = "/api/openapi", swaggerFile = "documentation.yaml", )
}
}
it just gives me FileNotFoundException
Exception in thread "main" java.io.FileNotFoundException: Swagger file not found: documentation.yaml
at io.ktor.server.plugins.openapi.OpenAPIKt.readOpenAPIFile(OpenAPI.kt:57)
at io.ktor.server.plugins.openapi.OpenAPIKt.openAPI(OpenAPI.kt:27)
at io.ktor.server.plugins.openapi.OpenAPIKt.openAPI$default(OpenAPI.kt:22)
at _4Tipsy.TinyCloudAPI.AppKt$module$1.invoke(App.kt:39)
...
As i got it, io.ktor:ktor-server-openapi
wasnt made for openapi generation
So, please, tell me about any solution