Aws-sdk-go: dynamodbattribute.Marshal incorrectly marshals an empty list to {NULL: true}

Created on 9 Aug 2019  路  1Comment  路  Source: aws/aws-sdk-go

Please fill out the sections below to help us address your issue.

Version of AWS SDK for Go?

v1.21.5

Version of Go (go version)?

go version go1.11.5 linux/amd64

What issue did you see?

dynamodbattribute.Marshal incorrectly marshals an empty list to {NULL: true}

Steps to reproduce

func Test_marshalIssue(t *testing.T) {
    type customStruct struct {
        key string
        val string
    }

    d, _ := dynamodbattribute.Marshal([]*customStruct{})
    t.Error(d)
    /*prints
         {
            NULL: true
         }
    */
}

Expected:
Empty list should be marshaled to

&dynamodb.AttributeValue{
    L: []*dynamodb.AttributeValue{},
}
bug

Most helpful comment

Hi @vipingoel, thanks for reaching out to us about this and I do apologize for the long delay in response from our end. Fixing this behavior is something we've had in our backlog for some time, I've brought this up with the rest of the team this week and we've agreed to prioritize the implementation of this change in a non-breaking manner. You can track progress on this in PR #2419.

>All comments

Hi @vipingoel, thanks for reaching out to us about this and I do apologize for the long delay in response from our end. Fixing this behavior is something we've had in our backlog for some time, I've brought this up with the rest of the team this week and we've agreed to prioritize the implementation of this change in a non-breaking manner. You can track progress on this in PR #2419.

Was this page helpful?
0 / 5 - 0 ratings