Is there a way to invoke Ktor’s validator manually...
# ktor
m
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
Maybe you could validate in the validation block by some condition?
a
Unfortunately, it's not possible to imperatively call the validation, although you can throw the
RequestValidationException
in the route handler.
s
@Mario Andhika You can use https://akkurate.dev/docs/overview.html
d
I don't think this library is related to ktor validation