avro icon indicating copy to clipboard operation
avro copied to clipboard

Add custom logical types

Open jwtryg opened this issue 1 year ago • 2 comments

closes #435

Hi @nrwiersma

This PR adds the possibility to register custom logical types for the schema. These logicaltypes are primitive, and does not include logic for handling custom encoding/decoding, but simply adds the the custom logicalType to be referenced in the schemas.

I have added the WithCustomLogicalType function as a SchemaOption, but not at all schemas use this option - I saw this pattern was already used for other schema options.

Let me know what you think :)

jwtryg avatar Sep 10 '24 11:09 jwtryg

Hi @nrwiersma

Thank you for the feedback! I totally get what you are saying, there ought to be a more elegant approach. Do you have another approach in mind?

jwtryg avatar Oct 10 '24 18:10 jwtryg

I am toying with the idea of adding something along the lines of Parser Hooks, which would allow new types to be derived from the Avro Schema types, but extended to any specific need. My hope is that the hooks would allow arb parsing of parameters into a Schema structure without having to actually change the underlying types. The thought is still a work in progress though.

nrwiersma avatar Oct 10 '24 19:10 nrwiersma