Is there a way to invoke Ktor’s validator manually instead of using the validator? I wanna do something like this:
Copy code
post("my-endpoint") {
val request = call.receive<MyRequest>() // This would be validated by Ktor using the validate block, but this is not what I want
val transformedRequest = doSomethingThatTransformsRequest(request)
validate(transformedRequest) // <- How to do this?
}
d
Daniel Weidensdörfer
08/12/2024, 7:25 AM
Maybe you could validate in the validation block by some condition?
a
Aleksei Tirman [JB]
08/12/2024, 8:12 AM
Unfortunately, it's not possible to imperatively call the validation, although you can throw the