How to create Avro Schema to have similar name for Java Avro maven generated class?

Viewed 100

I have a use case to create Avro Schema with two string field but both the field would look similar,

  1. firstName
  2. first_name

These two are different field due to some legacy reason. The problem that I face now is that, on generating Java class I am getting the following exception,

method setFirstName(java.lang.String) is already defined in class 

This is because the Avro maven plugin is trying to create two same setter method for each variable. For some legacy reason I can't fix it in the source end. Is there any option to handle this case in the Avro maven plugin level?

After referring to the code, it looks like the code handles only when two field are exact same except the first character, but in my case this conflict strategy is not recusing me.

1 Answers

I don't believe that what you want to do is currently possible as of Avro 1.11.0, and this is a nice feature to add to the Avro Maven plugin (at their issues tracker).

In my opinion, the generated code has never taken into account collisions caused by snake_case versus camelCase fields, but it should.

Related