I woule like to use multiple avro files when generating C# classes with avrogen.
Looking at apache.Avro code at: https://github.com/apache/avro/blob/e3e41dcd27822ac3fd4692291d1bbea4f8a294dc/lang/csharp/src/apache/main/Schema/Schema.cs#L210
when reading multipe files it is not possible to reuse previous loaded schema because "new SchemaNames()" is passed.
There is a way to use multipe avro files ?
Please provide the following information:
you'll need to use GenericRecord. yep, I agree this API is less than ideal.
I did some changes in avrogen, available here https://github.com/alfhv/avro, to make it work on my use case.
main changes are:
static void GenSchema(List<string> infiles, string outdir,
IEnumerable<KeyValuePair<string, string>> namespaceMapping)
public static Schema Parse(string json, SchemaNames schemaNames)
it could be possible to allow in some way this functionality with avrogen tool ??
Actually, the current API should be more open so we can overload some methods and code generation behavior, my use case is wider than just use multiple schema files.
ex: I have a base schema file (to inherit types from it) and then other schemas files from where I want to generate C# classes with avrogen but ignoring (not generating) classes from base schema file. I have already implemented in some way this behavior in my own version of avrogen but I would like to stay close to original Apache version in some way.
@alfhv
your changes helped me a lot! Thank you and congratulations for your initiative.
Most helpful comment
I did some changes in avrogen, available here https://github.com/alfhv/avro, to make it work on my use case.
main changes are:
static void GenSchema(List<string> infiles, string outdir, IEnumerable<KeyValuePair<string, string>> namespaceMapping)public static Schema Parse(string json, SchemaNames schemaNames)it could be possible to allow in some way this functionality with avrogen tool ??
Actually, the current API should be more open so we can overload some methods and code generation behavior, my use case is wider than just use multiple schema files.
ex: I have a base schema file (to inherit types from it) and then other schemas files from where I want to generate C# classes with avrogen but ignoring (not generating) classes from base schema file. I have already implemented in some way this behavior in my own version of avrogen but I would like to stay close to original Apache version in some way.