[ https://issues.apache.org/jira/browse/AVRO-872?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Bill Graham updated AVRO-872: ----------------------------- Attachment: AVRO-872_4.patch The last patch works well, thanks. Attached is patch #4 which also has a parse(File[]) method, if we choose to go this route. The value of being able to parse multiple JSON files into a single schema is that it allows for a more modular approach when creating and managing schema definitions. Without support for this at the JSON level, users will resort to copy and pasting common schemas into much larger and less manageable schema definitions. It seems like a defacto best-practice is emerging to concat multiple schemas together into a union as a way to partially get around repeatedly in-lining JSON child schemas. This approach gets the job done, but has manageability problems. This problem can be solved at the IDL level, but that provides yet another level of abstraction, a new language syntax and a compilation step to complicate what would otherwise be a very simple use case. Regarding consuming/producing fragmentary JSON, with the proposed approach producing JSON fragments will still not occur, since the in-memory schema is always complete, due to the reverse-dependency ordering that is required at parse time (not unlike parsing a union). Also, parsing a JSON fragment will still fail without parsing it's dependancies first so it's not loosening the contract of how parsing is handled in any way. I'd also like to hear others thoughts on this though. > 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