Ivan Brko
04/10/2020, 10:31 AMdata class User(
val username: String,
val email: String,
val firstName: String,
val lastName: String,
val password: String,
val role: Role,
val createdAt: LocalDateTime,
val updatedAt: LocalDateTime
)
So, in my file I create a serializer for it like this:
@Serializer(forClass = User::class)
object UserSerializer {}
Now, everything seems to work OK when deserializing the data, however when KMongo tries to serialize it and send it to DB, I get a nasty java exception stack with the following message:
java.lang.IndexOutOfBoundsException: com.example.domain.users.User descriptor has only 8 elements, index: 0
After going through code, I found that in file PluginGeneratedSerialDescriptor.kt there is an overriden fun getElementDescriptor in which property generatedSerializer is trying to get accessed, but it is null and this causes the exception.
Does anyone know if this is a bug, or I'm doing something wrong here?Dominaezzz
04/10/2020, 4:00 PM