https://kotlinlang.org logo
Title
s

spierce7

04/09/2023, 11:40 PM
I've been looking at setting up swagger for one of my servers: https://ktor.io/docs/openapi.html#configure-swagger One thing that I don't understand about the plugin. How do I create the
swaggerFile = "openapi/documentation.yaml
? Is there a way to generate it?
Is there a way of automating it? I've found some 3rd party solutions like https://github.com/bkbnio/kompendium Is there an officially supported ktor way I'm not seeing?
I found that I can use IntellIJ to generate the spec. Is there a way I can add it to CI and automatically update it?
a

Arjan van Wieringen

04/10/2023, 7:58 AM
The IntelliJ generator is horribly broken and is more or less in an alpha state. It is next to useless in any serious project
s

spierce7

04/10/2023, 3:03 PM
oh, what should I be using then?
r

Ryan Brink

04/10/2023, 5:59 PM
I'm the maintainer of Kompendium, happy to answer any questions if you give it a go https://github.com/bkbnio/kompendium
s

spierce7

04/12/2023, 10:41 PM
@Ryan Brink Have you measured the performance impact of this on the server?
r

Ryan Brink

04/13/2023, 12:56 PM
Nope.. though all the reflection happens at startup (in order to construct the openapi spec), so the performance impact should be isolated to startup time. Would be very curious to hear some results if you happen to be using this on a very large project
I have a pipe dream where a future version of kompendium leverages kotlin symbol processing to allow users to construct their openapi spec at build time instead of runtime, but that would require a pretty much ground up rewrite of the library, and I don't have the bandwidth for that at the moment.