https://kotlinlang.org logo
#ktor
Title
# ktor
c

CLOVIS

05/03/2021, 10:54 AM
I see that Ktor has a generator that reads OpenAPI, is there a way to do the opposite (generate an OpenAPI file from my route declarations)?
j

John O'Reilly

05/03/2021, 11:33 AM
I've used https://github.com/nielsfalk/ktor-swagger in one project and seems to work well.... though note that it isn't being maintained
Maybe could be integrated in to ktor?
r

Rustam Siniukov

05/03/2021, 2:25 PM
Here is the ticket to track https://youtrack.jetbrains.com/issue/KTOR-774. We are investigating different ways on how to implement it using idiomatic kotlin and ktor style. No estimates yet.
👍 3
c

CLOVIS

05/03/2021, 2:27 PM
Thanks, I hope it makes it into Ktor one day 👍
j

Joost Klitsie

05/03/2021, 2:36 PM
Or you can create a common multiplatform library between backend and frontend with DTO's and paths and whatnot, which you can call upon from code 🙂 Then there is no need for api generation
c

CLOVIS

05/03/2021, 3:04 PM
Not all projects allow me to choose the tech for backend and frontend. It's already pretty good that I managed to get Ktor/Kotlin at all.
👍 1
c

csieflyman

05/03/2021, 5:31 PM
I implement OpenAPI generator myself in my ktor-example side project. but it is not a independent library https://github.com/csieflyman/ktor-example
g
dunno if it helps ^ (for swagger generation)
2 Views