我正在编写我的第一个 Avro 架构,它使用 JSON 作为架构语言。我知道您不能将注释放入纯 JSON,但我想知道 Avro 工具是否允许注释。例如。也许它会在解析 JSON 之前剥离它们(像预处理器一样)。
编辑:我正在使用 C++ Avro 工具链
最佳答案
可以,但有限制。在该架构中,Avro 数据类型“record”、“enum”和“fixed”允许包含任意文档字符串的“doc”字段。例如:
{"type": "record", "name": "test.Weather",
"doc": "A weather reading.",
"fields": [
{"name": "station", "type": "string", "order": "ignore"},
{"name": "time", "type": "long"},
{"name": "temp", "type": "int"}
]
}
来自官方 Avro 规范:
doc: a JSON string providing documentation to the user of this schema (optional).
https://avro.apache.org/docs/current/spec.html#schema_record
关于json - 您可以在 Avro JSON 模式文件中添加注释吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16704310/