Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for circular references in AVDL (Avro IDL) #308

Open
MichaelHirn opened this issue Jun 14, 2020 · 2 comments
Open

Support for circular references in AVDL (Avro IDL) #308

MichaelHirn opened this issue Jun 14, 2020 · 2 comments

Comments

@MichaelHirn
Copy link

I understand that circular schema references (see example below) are supported for avsc schemas, however I was not able to get them working in avdl schemas; they will error when compiled to avsc schemas with the usual 'undefined type name' error, as the declaration order of records in avdl matters.

// this will not compile with avsc
record SampleNode {
  int count = 0;
  array<SamplePair> samples = [];
}
record SamplePair {
 string name;
 SampleNode node;
}

Judging from avro's issue tracker, support for circular references landed in v1.9 (source) - is there any way in avsc lib that supports circular references in avdl today or would avsc need to upgrade to avro v1.9 specification?

ref: #238

@mtth
Copy link
Owner

mtth commented Jun 16, 2020

Hi @MichaelHirn. Thanks for bringing this up, I wasn't aware of this v1.9 change. avsc does not currently support this type of IDL but probably should. How urgent is this feature from your side?

In case it's useful: avsc already supports IDL files with circular references using the following (non-standard now, since it predates the v1.9 change and was modeled on .avsc declarations) syntax:

record SampleNode {
  int count = 0;
  array < record SamplePair { // "Inline declaration".
    string name;
    SampleNode node;
  } > samples = [];
}

(You can even omit the < and > delimiters, as they tend to clutter definitions.)

@MichaelHirn
Copy link
Author

Hi @mtth, thanks for your response. The inline declaration is very helpful - I think that would probably be sufficient for us for now. I will be able to use inline declaration (and circular dependencies) more in the next days and weeks and would circle back with any updates.

Thanks for you help on this one :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants