Hi everyone, Ktor is from what I understand a micr...
# ktor
a
Hi everyone, Ktor is from what I understand a microframework and comparing it with Spring Boot is like mixing apples and oranges. Nonetheless I need some information for a framework shootout tomorrow in a project for one of our customers, and some of my colleagues including myself would appreciate using Kotlin with Ktor. I would like to know if "Exposed" is the preferred framework for DB access in the Ktor ecosystem. And are there any plans to provide some way to generate OpenAPI (Swagger) documentation based on the Routes used in Ktor? Thanx in advance...
👍 1
r
The nice thing about Ktor is that it's completely up to you what other libraries, including for DB access, you use, Ktor doesn't care. You could use a java library that's already well known to you, or you can use bleeding edge Kotlin tech like Exposed, which for example I am doing and like the experience so far, but keep in mind that Exposed in particular is still 0.x, and far from the maturity of the established libraries.
👍 5
a
Anyone an idea/comment on Swagger documentation?
I found this project but to me integration to Ktor routes does not feel intuitive yet. And I don't know if it will become an official Ktor feature as mentioned in the README below (feature proposal).
l
You could go contract first maybe and use a tool like pact.io to verify that your implementation matches the openApi Spec.
Processing
@Location
annotations and generating an OpenApi spec out of them also shouldn't be too hard
a
@lovis Of course we can use Swagger Mock Validator in order to validate against OpenAPI spec. However, I was curious if the above mentioned ktor-swagger will be further developed as we need changes in the Ktor routes to automatically reflect on the project's OpenAPI spec. Type safe routing using @Location annotation is a feature we don't use in our project as it is experimental as of yet. But thanks for showing me alternatives.