Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion feature/dynamodb/attributevalue/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func enumFields(t reflect.Type, opts structFieldOptions) []field {
structField := buildField(f.Index, i, sf, fieldTag)
structField.Type = ft

if !sf.Anonymous || ft.Kind() != reflect.Struct {
if !sf.Anonymous || fieldTag.Name != "" || ft.Kind() != reflect.Struct {
fields = append(fields, structField)
if count[f.Type] > 1 {
// If there were multiple instances, add a second,
Expand Down
13 changes: 13 additions & 0 deletions feature/dynamodb/attributevalue/marshaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,10 @@ func BenchmarkUnmarshalTwoMembers(b *testing.B) {
}

func Test_Encode_YAML_TagKey(t *testing.T) {
type Embedded struct {
String string `yaml:"string"`
}

input := struct {
String string `yaml:"string"`
EmptyString string `yaml:"empty"`
Expand All @@ -649,6 +653,7 @@ func Test_Encode_YAML_TagKey(t *testing.T) {
Slice []string `yaml:"slice"`
Map map[string]int `yaml:"map"`
NoTag string
Embedded `yaml:"embedded"`
}{
String: "String",
Ignored: "Ignored",
Expand All @@ -658,6 +663,9 @@ func Test_Encode_YAML_TagKey(t *testing.T) {
"two": 2,
},
NoTag: "NoTag",
Embedded: Embedded{
String: "String",
},
}

expected := &types.AttributeValueMemberM{
Expand All @@ -682,6 +690,11 @@ func Test_Encode_YAML_TagKey(t *testing.T) {
},
},
"NoTag": &types.AttributeValueMemberS{Value: "NoTag"},
"embedded": &types.AttributeValueMemberM{
Value: map[string]types.AttributeValue{
"string": &types.AttributeValueMemberS{Value: "String"},
},
},
},
}

Expand Down
2 changes: 1 addition & 1 deletion feature/dynamodbstreams/attributevalue/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func enumFields(t reflect.Type, opts structFieldOptions) []field {
structField := buildField(f.Index, i, sf, fieldTag)
structField.Type = ft

if !sf.Anonymous || ft.Kind() != reflect.Struct {
if !sf.Anonymous || fieldTag.Name != "" || ft.Kind() != reflect.Struct {
fields = append(fields, structField)
if count[f.Type] > 1 {
// If there were multiple instances, add a second,
Expand Down
13 changes: 13 additions & 0 deletions feature/dynamodbstreams/attributevalue/marshaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,10 @@ func BenchmarkUnmarshalTwoMembers(b *testing.B) {
}

func Test_Encode_YAML_TagKey(t *testing.T) {
type Embedded struct {
String string `yaml:"string"`
}

input := struct {
String string `yaml:"string"`
EmptyString string `yaml:"empty"`
Expand All @@ -649,6 +653,7 @@ func Test_Encode_YAML_TagKey(t *testing.T) {
Slice []string `yaml:"slice"`
Map map[string]int `yaml:"map"`
NoTag string
Embedded `yaml:"embedded"`
}{
String: "String",
Ignored: "Ignored",
Expand All @@ -658,6 +663,9 @@ func Test_Encode_YAML_TagKey(t *testing.T) {
"two": 2,
},
NoTag: "NoTag",
Embedded: Embedded{
String: "String",
},
}

expected := &types.AttributeValueMemberM{
Expand All @@ -682,6 +690,11 @@ func Test_Encode_YAML_TagKey(t *testing.T) {
},
},
"NoTag": &types.AttributeValueMemberS{Value: "NoTag"},
"embedded": &types.AttributeValueMemberM{
Value: map[string]types.AttributeValue{
"string": &types.AttributeValueMemberS{Value: "String"},
},
},
},
}

Expand Down