Cannot use a data type that is not at last position in the schema?
Closed this issue · 3 comments
Hello
It seems that a record cannot be serialized if it uses a type referenced early in the schema, i.e. not the last one (even if implementing the schema-name property in the AvroSerializable protocol). Any way to circumvent this?
Thanks!
Note: it works ok of course using the parser on the generated json - I may provide a pull request if time allows and you are interested.
The problem implementation-wise is that the Avro Parser
objects don't provide any public interface for accessing their full name-to-schema maps. I've thought about using reflection, but it didn't sit quite right. Round-tripping back through the JSON sounds like a much better solution. Schema-parsing shouldn't be happening frequently enough to make it a performance hit.
I would definitely be interested in a PR, especially one with a test case.
Thanks!
I just released version 0.4.7, which incorporates the above commit, and I believe resolves this issue. Let me know if this doesn't work as you expect.