oharaandrew314 / dynamodb-kotlin-module

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

Support null sets and lists #4

Closed oharaandrew314 closed 2 years ago

oharaandrew314 commented 2 years ago

The mapper cannot properly convert null lists or sets.

java.lang.IllegalStateException: Unable to convert attribute value: AttributeValue()
    at software.amazon.awssdk.enhanced.dynamodb.internal.converter.attribute.EnhancedAttributeValue.fromAttributeValue(EnhancedAttributeValue.java:352)
    at software.amazon.awssdk.enhanced.dynamodb.internal.converter.attribute.ListAttributeConverter$Delegate.transformTo(ListAttributeConverter.java:154)
    at software.amazon.awssdk.enhanced.dynamodb.internal.converter.attribute.ListAttributeConverter.transformTo(ListAttributeConverter.java:120)
    at software.amazon.awssdk.enhanced.dynamodb.internal.converter.attribute.ListAttributeConverter.transformTo(ListAttributeConverter.java:82)
    at io.andrewohara.dynamokt.DataClassAttribute.unConvert(DataClassAttribute.kt:34)
    at io.andrewohara.dynamokt.DataClassTableSchema.mapToItem(DataClassTableSchema.kt:21)
    at software.amazon.awssdk.enhanced.dynamodb.TableSchema.mapToItem(TableSchema.java:185)
    at software.amazon.awssdk.enhanced.dynamodb.internal.converter.attribute.DocumentAttributeConverter.transformTo(DocumentAttributeConverter.java:62)
    at io.andrewohara.dynamokt.DataClassAttribute.unConvert(DataClassAttribute.kt:34)
    at io.andrewohara.dynamokt.DataClassTableSchema.mapToItem(DataClassTableSchema.kt:21)
    at software.amazon.awssdk.enhanced.dynamodb.internal.EnhancedClientUtils.readAndTransformSingleItem(EnhancedClientUtils.java:87)
    at software.amazon.awssdk.enhanced.dynamodb.internal.operations.PutItemOperation.transformResponse(PutItemOperation.java:127)
    at software.amazon.awssdk.enhanced.dynamodb.internal.operations.PutItemOperation.transformResponse(PutItemOperation.java:45)
    at software.amazon.awssdk.enhanced.dynamodb.internal.operations.CommonOperation.execute(CommonOperation.java:115)
    at software.amazon.awssdk.enhanced.dynamodb.internal.operations.TableOperation.executeOnPrimaryIndex(TableOperation.java:59)
    at software.amazon.awssdk.enhanced.dynamodb.internal.client.DefaultDynamoDbTable.putItem(DefaultDynamoDbTable.java:201)
    at software.amazon.awssdk.enhanced.dynamodb.internal.client.DefaultDynamoDbTable.putItem(DefaultDynamoDbTable.java:209)
    at software.amazon.awssdk.enhanced.dynamodb.internal.client.DefaultDynamoDbTable.putItem(DefaultDynamoDbTable.java:214)
oharaandrew314 commented 2 years ago

This is most likely fixed in https://github.com/oharaandrew314/mock-aws-java-sdk/commit/37b86b28ae306b02da712436c7f849bfcd37c8a9