tworec
tworec

Reputation: 4747

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 */.

Upvotes: 20

Views: 4934

Answers (1)

Erik
Erik

Reputation: 658

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)

Upvotes: 2

Related Questions