Hi all,
I've been struggling to get some sort of inheritance model to work with Avro
but I've not been very successful at it. So maybe someone in hear can give me a
pointer. What I've been trying to do is to define schemas like this
{"namespace": "com.test",
"type": "record",
"name": "Shape",
"fields": [
{"name": "colour", "type": "string"}
]
}
{"namespace": "com.test",
"type": "record",
"name": "Circle",
"fields": [
{"name": "radius", "type": "int"},
{"name": "super", "type": "com.test.Shape"}
]
}
{"namespace": "com.test",
"type": "record",
"name": "Square",
"fields": [
{"name": "width", "type": "int"},
{"name": "super", "type": "com.test.Shape"}
]
}
When I try to generate classes from this I get
"org.apache.avro.SchemaParseException: "com.test.Shape" is not a defined name".
So what is a defined name and where I define it? I tried to put everything into
the same file but that didn't work. I also tried to play around with unions but
couldn't get the schema syntax right. Any help with this would be greatly
appreciated and also other patterns for implementing inheritance with Avro are
interesting.
Thanks for any help!!
-Mika