From 807048d3e759daf8f4aa832a5754d4e103d4a353 Mon Sep 17 00:00:00 2001 From: johanavril Date: Sun, 17 Nov 2019 14:21:29 +0700 Subject: [PATCH 1/3] add missing property on string map to Address conversion the conversion didn't have case for 'State' property causing the output value not equal to the input value and failed the DeepEqual --- examples/nested/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/nested/main.go b/examples/nested/main.go index 1dccbf9..229b53c 100644 --- a/examples/nested/main.go +++ b/examples/nested/main.go @@ -155,6 +155,10 @@ func StringMapToUser(data map[string]interface{}) *User { if value, ok := v.(string); ok { add.City = value } + case "State": + if value, ok := v.(string); ok { + add.State = value + } case "Zip": if value, ok := v.(int); ok { add.Zip = value From e575eae228f0585d0cd7d8e487a0dcda090dc88b Mon Sep 17 00:00:00 2001 From: johanavril Date: Sun, 17 Nov 2019 14:28:28 +0700 Subject: [PATCH 2/3] fix type assertion on an int property failed to type assertion int32 using int, causing the output value to not equal to the input value and failed the DeepEqual. --- examples/nested/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/nested/main.go b/examples/nested/main.go index 229b53c..b552c43 100644 --- a/examples/nested/main.go +++ b/examples/nested/main.go @@ -160,8 +160,8 @@ func StringMapToUser(data map[string]interface{}) *User { add.State = value } case "Zip": - if value, ok := v.(int); ok { - add.Zip = value + if value, ok := v.(int32); ok { + add.Zip = int(value) } } } From a36b5153e35aa155556d15323fefcb212fd8411a Mon Sep 17 00:00:00 2001 From: johanavril Date: Sun, 17 Nov 2019 14:36:40 +0700 Subject: [PATCH 3/3] fixup! Adding nested example --- examples/nested/schema.avsc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/nested/schema.avsc b/examples/nested/schema.avsc index 075c6b2..40b7837 100644 --- a/examples/nested/schema.avsc +++ b/examples/nested/schema.avsc @@ -1,7 +1,7 @@ { "namespace": "my.namespace.com", "type": "record", - "name": "indentity", + "name": "identity", "fields": [ { "name": "FirstName", "type": "string"}, { "name": "LastName", "type": "string"},