You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
type Personal struct { Addresses []Address json:"addresses" }
type Address struct { State string json:"state" validate:"min=6,max=100,noLeadingTrailingSpace" pact:"example=123456,regex=^\d{6}$" }
Now I'm trying to encode my message using struct2 and decode in struct1 using NativeFromBinary() method i.e. val, newBuf, err := ac.NativeFromBinary(msg)
Ideal assumption would be to get a decoding error, but instead of getting error I'm getting a Personal(struct1) containing empty Addresses slice into val & newBuf containing other remaining bytes(undecoded) and err is nil.
I think this is shouldn't be the case. Please see!
The text was updated successfully, but these errors were encountered:
Hi there,
Consider below struct: [struct1]
type Personal struct { Addresses []Address
json:"addresses"}
type Address struct { StreetName string
json:"streetName" validate:"min=6,max=100,noLeadingTrailingSpace" pact:"example=123456,regex=^\d{6}$"}
Consider below avro codec for the same: [struct1]
{ "name": "Personal", "type": "record", "fields": [ { "name": "addresses", "type": { "type": "array", "items": { "type": "record", "name": "Address", "fields": [{ "name": "streetName", "type": "string" } ] } } } ] }
Now consider another struct & it's avro schema: [struct2]
{ "name": "Personal", "type": "record", "fields": [ { "name": "addresses", "type": { "type": "array", "items": { "type": "record", "name": "Address", "fields": [{ "name": "state", "type": "string" } ] } } } ] }
type Personal struct { Addresses []Address
json:"addresses"}
type Address struct { State string
json:"state" validate:"min=6,max=100,noLeadingTrailingSpace" pact:"example=123456,regex=^\d{6}$"}
Now I'm trying to encode my message using struct2 and decode in struct1 using NativeFromBinary() method i.e.
val, newBuf, err := ac.NativeFromBinary(msg)
Ideal assumption would be to get a decoding error, but instead of getting error I'm getting a Personal(struct1) containing empty Addresses slice into val & newBuf containing other remaining bytes(undecoded) and err is nil.
I think this is shouldn't be the case. Please see!
The text was updated successfully, but these errors were encountered: