dany giguere

03/26/2023, 7:38 PM
Regarding the request validation :, how does it work when I’ll have a ton of routes, can I apply the validation to specific routes or even to a single route ? According to the doc, I should do :
install(RequestValidation) {
        validate<Post> { post ->
            if (post.title.length < 4)
                ValidationResult.Invalid("A post ID should be greater than 0")
            else ValidationResult.Valid
But eventually there will be a lot of validations in there. It would be nice if I could apply to my post routes, only the validation regarding the posts…

Aleksei Tirman [JB]

03/27/2023, 9:25 AM
You can install the
plugin into specific routes to apply a validation logic only to them.