rrader
02/10/2019, 9:36 AMclass SignUpDto(val email: String, val password: String)
@Post("/signup")
fun signup(@Body @Valid dto: SignUpDto): String {
return "OK"
}
If we will send { "email": null, "password": null } or {} to the endpoint, kotlin will throw an exception that ONE field is null, so we will be able in response only say that ONE field can not be null. What I want to achieve is that we should return in response that BOTH/ALL fields can not be null.
So, this can be done if validation will be done before object creation.
Maybe Micronaut can provide own solution for json serialization/deserialization? It can be based on existing solution, like https://github.com/square/moshi
In this case also can be fixed Jackson limitation regarding deserializing nested polymorphic types https://github.com/FasterXML/jackson-databind/issues/2000
But swagger supports it by anyOf, even multilevel.