Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.9.1
-
None
-
None
Description
When defining a date field in the avro schema the generated java class files contains different types based on the given types.
Giving a schema that contains date's, some are optional and some required.
{ "type": "record", "name": "DateData", "namespace": "com.keylane.ics.data", "fields": [ { "name": "dateAsInt", "type": "int", "logicalType": "date" }, { "name": "dateAsOptionalInt", "type": [ "null", "int" ], "logicalType": "date" }, { "name": "dateAsObject", "type": [ { "type": "int", "logicalType": "date" } ] }, { "name": "dateAsOptionalLocalDate", "type": [ "null", { "type": "int", "logicalType": "date" } ] } ] }
The generated class file defines the 4 fields with different java types
@Deprecated public int dateAsInt; @Deprecated public java.lang.Integer dateAsOptionalInt; @Deprecated public java.lang.Object dateAsObject; @Deprecated public java.time.LocalDate dateAsOptionalLocalDate;
We would prefer to have the type as a LocalDate, so that case 3 and 4 give the same field definition.
Is this a bug or should the schema definition be different (and how)?