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
Summary
When attempting to serialize an Avro union type ["null", "string"] using the Schema Registry client, an error is thrown during the NativeFromTextual conversion process. The error encountered is as follows NativeFromTextual conversion failed: cannot decode textual record "com.example.audit.AuditEvent": cannot decode textual union: expected: '{'; actual: '"' for key: "name"
Steps to Reproduce
Define an Avro schema with a union type (["null", "string"]) for the name field:
Summary
When attempting to serialize an Avro union type ["null", "string"] using the Schema Registry client, an error is thrown during the NativeFromTextual conversion process. The error encountered is as follows
NativeFromTextual conversion failed: cannot decode textual record "com.example.audit.AuditEvent": cannot decode textual union: expected: '{'; actual: '"' for key: "name"
Steps to Reproduce
{ "fields": [ { "name": "uuid", "type": "string" }, { "default": null, "name": "name", "type": ["null", "string"] } ], "name": "AuditEvent", "namespace": "com.example.audit", "type": "record" }
type AuditTrailEventData struct { UUID string
json:"uuid"Name string
json:"name"}
3. Try to produce an event using the following code
`value, err := json.Marshal(dto)
if err != nil {
slogger.GetInstance().WithContext(ctx).Errorf("Failed to marshal dto: %s", err)
return err
}
`
I would appreciate guidance or a fix for handling union types with Avro serialization in Go.
The text was updated successfully, but these errors were encountered: