I don`t like post randoms usually but it must be h...
# random
m
I don`t like post randoms usually but it must be here! 😃
😂 9
💯 2
😞 3
rage2 1
😄 1
😡 4
a
And in this way the data class you set up for the response resulted to be totally useless and you had to convert that to a normal class, writing default getters and at least 2 constructors for it. Or setting every field as nullable, resulting in danger all over the code, checking for null pointers everywhere.
m
Or U can create DTO layer (as usual for most of people)
Copy code
data class Entity(val id:String, val name: String, val i: Int, val description: String) 
class EntityDTO(val id:String) {  
val name: String?
 val i: Int? 
val description: String?
}
and give few ext functions Entitiy.toDTO, EntityDTO.toModel(btw - want to try implement automation for this with KAPT, don't know will this bicycle give any benefits) and validation function and hardly control or incomes in controller layer an it will keep nulls from internals of app/system. Of course it isn't silver bullet