Ktor Series : API Validation using Konform
Here we go… again, another article in the Ktor Series!
Let’s start with the basics first and take a look at the validation library called Konform. Yes, you heard it right, Konform is a validation library which allows you to avoid long if.. else statements to validate your API request body. Many of you might think, here is another new complicated library for validation and you are not wrong but trust me you’ll see what we are talking about & how Konform saves you trouble.
What is Konform?
Konform is one of the open-source libraries developed to validate objects in Kotlin. Konform is not limited to Ktor or API project but supports multi-platform too.
https://github.com/konform-kt/konform
There are many other frameworks and libraries available to perform object validation however konform is one of the closes libraries that can help us achieve DSL based fluent APIs development.
There are many blogs published in favor of different libraries but this article has PoC with most of the famous validation libraries. Kudos to Emanuel Moecklin for doing this much research for the sake of the community.
(Link to the repo. is available at the end of the article)