Search code examples
javamavenavroavro-tools

avro maven plugin can not generate code for map schema


My avsc file is

{"type" : "map",
 "name" : "valueMap",
 "namespace" : "example.avro",
 "values": "long"
}

but after I used mvn compile, no error reported but no specific class generated. when the avsc schema is about enum or record, the avro maven plugin works well. How can I generate the related class for map schema?


Solution

  • There's no class to generate here since it's not a record or enum type (as you found, do work), it's just a collection.

    You can serialize a Map<String, Long> directly into Avro, so don't think you really need this schema file unless you were to reference/import it into another record