What do you think about providing a json serializa...
# micronaut
r
What do you think about providing a json serialization/deserialization library? I mean that is a solution to solve this issue https://github.com/FasterXML/jackson-module-kotlin/issues/58 Basically I tried to fix that for Kotlin validation should return all validation failure, not just first error regarding to null.
Copy code
class 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.