Hope this is the right channel for this type of qu...
# spring
d
Hope this is the right channel for this type of question. How do you handle the concept of optional fields in a REST API when using Kotlin? For my json output I am using data classes, for example like this:
data class User(val id: UUID, val username: String)
. I could add all possible fields (e.g.
friends
) to this class, but causes some problems: I now need to make sure Jackson ignores those fields if they were not requested, my fields now have to be nullable even when they really shouldn't be. Any ideas?