Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

DynamoDB Mapper: Add attribute converter annotation #1457

Open
Labels
dynamodb-mapper feature-requestA feature should be added or improved. p2This is a standard priority issue
@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

Metadata

Metadata

Assignees

No one assigned

    Labels

    dynamodb-mapper feature-requestA feature should be added or improved. p2This is a standard priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /