Код: Выделить всё
{
"name": "MyNamespace.Foo",
"type": "record",
"fields": [
{
"name": "Name",
"type": "string"
},
{
"name": "Bar",
"type": "MyNamespace.Bar"
}
]
}
Код: Выделить всё
{
"name": "MyNamespace.Bar",
"type": "record",
"fields": [
{
"name": "Name",
"type": "string"
},
{
"name": "Foo",
"type": "MyNamespace.Foo"
}
]
}
< /code>
Я пытаюсь проанализировать их, чтобы создать схему союза с обоими типами: < /p>
var fooSchemaJson = File.ReadAllText("./Foo.avsc");
var barSchemaJson = File.ReadAllText("./Bar.avsc");
var fooSchema = Schema.Parse(fooSchemaJson);
var barSchema = Schema.Parse(barSchemaJson);
var combinedSchema = UnionSchema.Create(new List { fooSchema, barSchema }, null);
< /code>
Это выбрасывает приведенную ниже ошибку: < /p>
Avro.SchemaParseException: Undefined name: MyNamespace.Bar at 'fields[1].type'
at Avro.Schema.ParseJson(JToken jtok, SchemaNames names, String encspace)
at Avro.RecordSchema.createField(JToken jfield, Int32 pos, SchemaNames names, String encspace)
at Avro.RecordSchema.NewInstance(Type type, JToken jtok, PropertyMap props, SchemaNames names, String encspace)
at Avro.NamedSchema.NewInstance(JObject jo, PropertyMap props, SchemaNames names, String encspace)
at Avro.Schema.ParseJson(JToken jtok, SchemaNames names, String encspace)
at Avro.Schema.Parse(String json, SchemaNames names, String encspace)
at Avro.Schema.Parse(String json)
Подробнее здесь: https://stackoverflow.com/questions/794 ... ro-schemas