【发布时间】:2025-11-29 07:40:01
【问题描述】:
在 C# 中我可以定义这两个 POCO 来定义世代
public class Family
{
public List<Person> FamilyMembers {get; set;}
}
public class Person
{
public string FirstName {get; set;}
public string LastName {get; set;}
public List<Person> Children {get; set;}
}
我正在尝试定义一个 AVRO 模式来将 FamilyMembers 序列化为。是否可以在 Avro 中定义一个递归数组(不确定这是否是正确的术语),而不必像下面那样在模式中指定每一代。
{
"type": "record",
"name": "family",
"namespace": "com.family.my",
"fields": [
{
"name":"familymember",
"type":{
"type": "array",
"items":{
"name":"person",
"type":"record",
"fields":[
{"name":"firstname", "type":"string"},
{"name":"lastname", "type":"string"},
{"name":"children",
"type":{
"type": "array",
"items":{
"name":"children",
"type":"record",
"fields":[
{"name":"firstname", "type":"string"},
{"name":"lastname", "type":"string"},
{"name":"grandchildren",
"type":{
"type": "array",
"items":{
"name":"greatgrandchildren",
"type":"record",
"fields":[
{"name":"firstname", "type":"string"},
{"name":"lastname", "type":"string"}
]
}
}}
]
}
}}
]
}
}
}
]
}
【问题讨论】:
标签: avro confluent-schema-registry