avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@apache.org>
Subject Re: Specific compiler task, separate schemas
Date Fri, 01 Jun 2012 00:05:39 GMT
On 05/30/2012 06:04 PM, Mark Hayes wrote:
> I found a way around this.  If I put all three schemas in a single JSON
> array, in a single JSON document in a file, and parse that file using
> the ant SchemaTask, then it works -- it generates classes for all three
> schemas.  I assume it will also work when parsing the schema using other
> tools.
>
> I don't see this documented anywhere and I found it by trial and error.
>   My guess is that the top level array is treated as an Avro union, and
> the SpecificCompiler doesn't happen to output this top level union type.

That's right.

> I don't know if it is meant to work this way (i.e, will continue to work
> in the future), or is just a coincidence.  Does anyone know?

This will continue to work in the future.  Other folks rely on it.

The Ant task might be improved to make this easier.  If the task reused 
the SpecificCompiler instance then one might be able to specify the 
compiler input as something like:

<fileset>
   <filename name="T1.avsc"/>
   <filename name="T2DependsonT1"/>
</fileset>

If this sounds useful to you, please file an issue in Jira.

Doug

Mime
View raw message