how to mark avro field deprecated in JSON/avsc?

I was looking for method to mark avro field deprecated in a way that generated Java code (getters, and setters for the field) are marked with @Deprecated annotation.

Puting @Deprecated into "doc" field doesn’t work, because generator puts it into /** javadoc */.


I have not had success getting the actual @Deprecated annotation into the generated java code, but the older style javadoc deprecation kind of works:

// schema avdl
record MyRecord {
    /** @deprecated unused */ union { null, int } count;

results in the generated java code having

/** @deprecated unused */
Integer count;

And some IDEs recognizes and highlights that (I use Intellij)

Source : Link , Question Author : tworec , Answer Author : Erik

Leave a Comment