avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shannon Carey <sca...@expedia.com>
Subject Re-using record & enum types in single schema file
Date Fri, 07 Jul 2017 16:21:39 GMT
I'm trying to see if I can use a single Avro schema file but still have multiple record &
enum types re-used throughout different places in the schema.

Based on these answers https://stackoverflow.com/questions/21539113/can-i-split-an-apache-avro-schema-across-multiple-files
and https://stackoverflow.com/questions/29280635/avro-schema-definition-nesting-types the
only two ways are:

1. Use a union as the root type, and define all your re-used types as members of the union.
Unfortunately, this approach is not ideal as it allows any of those types to be serialized
as the root object regardless of which types you want to be the root.

Or, 2. Define a Protocol instead of a Schema, putting all your types into "types". This appears
to have the same problem as #1.

Is that right? Is there any other way? I'd rather only have to reference one schema file instead
of multiple.

Thanks,
Shannon
Mime
View raw message