Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Avro >> mail # user >> imports and avpr files

Copy link to this message
Re: imports and avpr files
On 02/16/2012 07:06 AM, Jeremy Lewi wrote:
> I have an avpr file and I'd like to include other avpr files so that I
> can split my schemas into files with one file per namespace. Is this
> possible or do I need to use Avro IDL if I want to use imports.

You could use the same API that the IDL parser uses.  It copies each of
the types and messages from included protocols to a new protocol
instance (http://s.apache.org/wj).

Perhaps we should add a Protocol.Parser API like Schema.Parser.  One
could then repeatedly call parser.parseProtocol(avprFile) then call
parser.getProtocol() to return a protocol with all of the types and
methods.  Types defined in earlier files would be available for
reference by subsequent files.  This would make things somewhat simpler
than the current API does.  If that sounds like it would be useful,
please file an issue in Jira.