[ https://issues.apache.org/jira/browse/AVRO-872?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13082570#comment-13082570 ]
Doug Cutting commented on AVRO-872: ----------------------------------- I'm beginning to question the motivation for this a bit. The example player.avsc file is not a well-formed JSON schema, since it's not standalone, but rather depends on another .avsc file. To date, we've only consumed or produced standalone JSON, not fragmentary. JSON is meant to be the low-level schema language, with IDL as the higher level language, better supporting manually maintained schemas. So, before we commit this, I'd like to understand the use case a bit more. Is there a reason one couldn't define the two schemas in a single .avsc, .avpr file, or multiple .avdl files? We could I suppose change the Schema parser to, when it encounters an undefined name, look for a file defining it, much like the Java compiler looks for a .java file on the CLASSPATH, but I feel such features should be confined to IDL and that JSON should be primarily used for self-contained schemas. Standalone JSON schemas are what we save with files and exchange in RPC handshakes. Currently the API will not permit one to write a non-standalone Schema so I'm a bit reluctant to permit reading them. Do others have thoughts on this? > 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 > > > 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