oharaandrew314/dynamodb-kotlin-module

Nullable field without default value cannot be converted back to object

Closed this issue · 0 comments

If there's a class with a nullable field, but no default value for it:

data class Person(val name: String, val age: Int?)

then the dynamo mapper will prefer to omit the null value. When the mapper reads the item, object initialization fails because no value was provided for that null field.

The mapper should instead assume that a nullable field's default value is null, unless otherwise indicated.