What are the advantages/disadvantages of doing val...
# ktor
l
What are the advantages/disadvantages of doing validation on incoming request bodies via plain old
require
in a data class's
init
vs using the
RequestValidation
plugin?
j
Using the RequestValidation plugin you can run validation for more complex use cases, like checking if some value is already in your database.
Here’s a usage example of the RequestValidation plugin, using #akkurate: https://akkurate.dev/docs/ktor-validation-tutorial.html
l
Sweet thanks @Johann Pardanaud I've gone with RequestValidation for now and gotten rid of all my requires. It's certainly a lot nicer than what I had before. What I've done is put my validate functions in the companion object of the models. Seems nicer to me than having them in the Application.module or somewhere like that
👍 1