简体   繁体   中英

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM