You will need to “bake in” everything in the avsc, so your a.avsc will look
like:
> a.avsc
> {
> "type": "record", "name": "a", "fields": [{
> "name": "X", "type": {
> "type": "record", "name": "b", "fields": [{
> "name": "Y", "type": {
> "type": "record", "name": "c", "fields": [{
> "name": "Z", "type": "a"
> }]
> }
> }]
> }
> }]
> }
However this is not exactly easy to look at...
I recommend using IDL to define/maintain schemas..., compile the IDL with the
latest avro dev master, this will generate the schemas for you…
cheers
—Z
> On Jan 9, 2018, at 9:30 AM, Elliot West <[email protected]> wrote:
>
> Hi,
>
> I understand that Avro supports circular type dependencies, and also schema
> composition. However, I cannot seem to be able to create a circular type
> reference that spans multiple schema payloads. Consider this example:
>
> a.avsc
> {
> "type": "record", "name": "a", "fields": [{
> "name": "X", "type": "b"
> }]
> }
>
> b.avsc
> {
> "type": "record", "name": "b", "fields": [{
> "name": "Y", "type": "c"
> }]
> }
>
> c.avsc
> {
> "type": "record", "name": "c", "fields": [{
> "name": "Z", "type": "a"
> }]
> }
>
> In this case, there seems to be no good entry point that will result in a
> valid initial schema, and hence while these types are declared in different
> files, the total schema cannot be correctly parsed.
>
> Can you confirm if this is an issue? Is there an outstanding JIRA, and if not
> should I raise one. Can you suggest work arounds?
>
> Thanks,
>
> Elliot.
>