DynamoDB AttributeValue's MarshallMap() Does Not Support time.Time Correctly #2383
Labels
feature/dynamodb/attributevalue
Pertains to dynamodb attributevalue marshaler HLL (feature/dynamodb/attributevalue).
feature-request
A feature should be added or improved.
p3
This is a minor priority issue
queued
This issues is on the AWS team's backlog
Describe the bug
I am seeing that it's not possible to use
omitempty
ontime.Time
struct fields withattributevalue.MarshalMap()
fromgithub.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue
.This behavior was observed on the latest version:
github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue
v1.12.3Expected Behavior
When
MarshalMap()
is supplied with a struct containing atime.Time
field with the tagomitempty
whos value is the zero value, the output map should not contain a key for that struct field.Current Behavior
Output attribute value map includes a key and value for the field that should be omitted.
Reproduction Steps
repro_test.go
service_test_suite.go
Possible Solution
As far as I've been able to reason by stepping through the repro above in a debugger, there should probably be a check for
fieldTag.OmitEmpty
in this code block inencode.go
(just like thefieldTag.AsUnixTime
tag is checked).aws-sdk-go-v2/feature/dynamodb/attributevalue/encode.go
Line 478 in 3bd97c0
Additional Information/Context
No response
AWS Go SDK V2 Module Versions Used
Compiler and Version used
go version go1.20.6 linux/amd64
Operating System and version
Fedora Linux 37
The text was updated successfully, but these errors were encountered: