-
Notifications
You must be signed in to change notification settings - Fork 54
Open
@tznd-amazon
Description
Describe the feature
An @ConvertedBy annotation for attributes that the generator can use without defining the entire ItemConverter
Is your feature request related to a problem?
If would be great if we didn't need to define the entire Item converter when just one attribute needs a custom value converter.
Currently as documented with the DynamoDB Mapper when a custom item converter is needed a value converter must be created and then an ItemConverter needs to be created for the entire model. If I could annotate one attribute and the generator would honor it, it would save a lot of boilerplate.
Proposed Solution
@DynamoDbItem data class Employee( @DynamoDbPartitionKey val id: Int, val name: String, val role: String, # Proposed Annotation @ConvertedBy(UuidValueConverter::class) val workstationId: Uuid, ) public val UuidValueConverter = object : ValueConverter<Uuid> { override fun convertFrom(to: AttributeValue): Uuid = Uuid.parseHex(to.asS()) override fun convertTo(from: Uuid): AttributeValue = AttributeValue.S(from.toHexString()) }
Describe alternative solutions or features you've considered
No response
Acknowledge
- I may be able to implement this feature request
AWS SDK for Kotlin version
1.3.66-beta
Platform (JVM/JS/Native)
JVM
Operating system and version
AL2023