Hi,

IMO it behaves correctly!

AvroTest class is mapped to a Record schema and its class fields are mapped
to record fields.

What kind of schema do you expect to be generated without the fields?

On Tue, 1 Apr 2025 at 13:07, Bagi <bagi7playst...@gmail.com> wrote:

> Hi,
>
> Newb here. Having an issue with generating the schema when there is an
> enum at the top of the tree. Using Avro 1.12.0, I am trying to generate
> .avsc file from Java class file, using the following command:
> ReflectData.get().getSchema(AvroTest.class);
>
> Here is the AvroTest.java:
> public class AvroTest {
>     public enum MyEnum {
>         ENONE, ENTWO, ENTHREE;
>     }
> }
>
> The ReflectData is ignoring this enum. Workaround is to add field with
> that enum to the class, ie.
> private MyEnum myEnum;
>
> Is there any other way to force the enum to be added to the generated
> schema? Perhaps something similar to @AvroName annotation but for enums?
>
> Regards, Bagi
>

Reply via email to