mtth / avsc

Avro for JavaScript :zap:
MIT License
1.27k stars 147 forks source link

Avro.types.LogicalType's _copy implementation #462

Closed minazakh closed 3 weeks ago

minazakh commented 2 months ago

I am running into an issue with a custom Decimal logical type implementation (which follows the example implementation), in cases when deserializing a schema that has a Decimal logical type with a default value. More specifically, I can see that it calls my Decimal implementation's _copy function, which is inherited from Avro.types.LogicalType, and Avro.types.LogicalType doesn't have a proper implementation, but a dummy abstractfunction which does nothing but throw an error.

Adding an implementation of _copy in my Decimal class fixes the issue, but I couldn't find any mentions to _copy in the API docs or in any of the given logical types examples - so are we actually supposed to override it or am I doing something incorrectly?

mtth commented 2 months ago

Hi @minazakh. Can you share a code snippet reproducing the issue and your avsc version? LogicalType has a _copy implementation in the current release.