[ https://issues.apache.org/jira/browse/AVRO-872?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13082716#comment-13082716 ]
Bill Graham commented on AVRO-872: ---------------------------------- It is possible to generate the Protocol at run time directly from an IDL file. That way the Project can be generated and consumed without the extra step to pre-generate an avpr file. Something like this works: {code} Idl parser = new Idl(idfFile); Protocol p = parser.CompilationUnit(); {code} The downside is that now the avro-compiler jar would be needed at run time. I agree though that it would be nice to not have to create and use Protocols if you only need Schemas. @Doug if all your schema objects are defined in your avsc files, then defining a dummy "record Foo" would be needed, right? Could you instead do something like this to load a collection of Schemas instead?: {noformat} @namespace("foo.bar") schema MySchema { import schema "Bar.avsc"; ... } {noformat} Granted, now there's a dummy MySchema thing, but it's not a record. > Allow interdependancies across IDL schema imports > ------------------------------------------------- > > Key: AVRO-872 > URL: https://issues.apache.org/jira/browse/AVRO-872 > Project: Avro > Issue Type: Improvement > Reporter: Bill Graham > Assignee: Doug Cutting > Attachments: AVRO-872.patch, AVRO-872.patch, AVRO-872.patch, > AVRO-872_4.patch > > > This currently doesn't work because Player depends on Position, but it should: > {noformat} > $ cat position.avsc > {"type":"enum", "name": "Position", "namespace": "avro.examples.baseball", > "symbols": ["P", "C", "B1", "B2", "B3", "SS", "LF", "CF", "RF", "DH"] > } > $ cat player.avsc > {"type":"record", "name":"Player", "namespace": "avro.examples.baseball", > "fields": [ > {"name": "number", "type": "int"}, > {"name": "first_name", "type": "string"}, > {"name": "last_name", "type": "string"}, > {"name": "position", "type": {"type": "array", "items": > "avro.examples.baseball.Position"} } > ] > } > $ cat baseball.avdl > @namespace("avro.examples.baseball") > protocol Baseball { > import schema "position.avsc"; > import schema "player.avsc"; > } > $ java -jar avro-tools-1.5.1.jar idl baseball.avdl baseball.avpr > {noformat} -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira