I want to use annotation validation for beans like...
# ktor
a
I want to use annotation validation for beans like I was doing in spring boot
Copy code
data class NewUser(
    ....
    @field:NotNull @field:Email val email: String,
    ...
)

get(){
   val user = call.receive<NewUser>()
}
c
So continue to use Spring Boot or directly use one of the validation libraries it uses?
a
If there a ktor way, so tell me how, or a link
e
a
You shouldn't need any annotations to handle a null non-nullable property. Unless you're using gson as your json module (which I don't reccommend), the json module will catch the non value, and Ktor will return a 400.
a
yeah, I'm using json module, also want to get the jakerta built-in email validator, or something similar in ktor