Closed skibak closed 1 year ago
The class you've provided is just a java bean; you should be able to use the BeanTableSchema
; see this guide for using beans with the v2 sdk.
This module is intended for use with idiomatic Kotlin data classes like
data class Record(
@DynamoKtPartitionKey val id: UUID,
val name: String
)
Yes, it is now. I just tried to migrate from using standard annotation to more Kotlin friendly. Minimum we should detect this situation and throw error. Ideally we should invoke constructor, and then invoke remaining property setters.
To explain context: I'm trying to come with better way to support calculated fields. I wanted to put required fields in constructor, and define calculated fields (composite keys used for indexing) inside, plus override some properties setters to trigger fields calculation.
Yeah, you're right. I'll look into an improvement.
I've added a check to version 0.2.2
I have data class with somer properties defined in constructor and some in class body, e.g.
When schema for it created, code here https://github.com/oharaandrew314/dynamodb-kotlin-module/blob/master/src/main/kotlin/io/andrewohara/dynamokt/DataClassAttribute.kt#L55 builds incorrect association between attributes and constructor parameter.
So later mapToItem fails to create instance because of constructor arguments mismatch.