-
Notifications
You must be signed in to change notification settings - Fork 125
Open
Description
Right now it appears that generated union types simply use any, which is not type safe. This means code needs to be written manually to make this type safe. Ideally there would be some option to generate the boilerplate code to make this type safe.
Example schema with a union type:
{
"namespace": "com.test.avro",
"type": "record",
"name": "TestEvent",
"doc": "Test event",
"fields": [
{
"name": "exampleunion",
"type": ["string", "long"]
}
]
}avrogen -pkg avro -o testevent.go TestEvent.avsc
testevent.go
// Code generated by avro/gen. DO NOT EDIT.
package avro
// Test event.
type TestEvent struct {
Exampleunion any `avro:"exampleunion"`
}Metadata
Metadata
Assignees
Labels
No labels