hamba / avro

A fast Go Avro codec
MIT License
365 stars 91 forks source link

avrogen fails to generate go struct from avro record with enum field #442

Closed GeorgyBocharov closed 1 week ago

GeorgyBocharov commented 1 week ago

enum_record.avsc

Hamba version: v2.25.0

I get error "Error: avro: unknown type: enum" during generation of go struct from enum_record.avsc (file attached). The command I use is avrogen -pkg=codec enum_record.avsc

In source code I see that hamba supports enum avro type, but during code generation it fails

nrwiersma commented 1 week ago

You schema is wrong. That is not how fields work.

{
  "type": "record",
  "name": "EnumRecord",
  "fields": [
    {"name": "test", "type": {"type": "enum", "name": "enum", "symbols": ["foo", "bar"]}}
  ]
}
GeorgyBocharov commented 1 week ago

oh, you are right. thanks