oharaandrew314 / dynamodb-kotlin-module

Kotlin Module for the dynamodb-enhanced SDk
Apache License 2.0
23 stars 3 forks source link

Nullable field without default value cannot be converted back to object #1

Closed oharaandrew314 closed 2 years ago

oharaandrew314 commented 2 years ago

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.