heetch / heetch/avro

Create aliases on the `globalNames` somehow

Open
#120 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
95
Forks
18
PR merge metrics
No merged PRs in 30d

Description

Hey,

I'm using the `confluent-kafka-go`, during the deserialization-generic flow they call [`avro.Unmarshal`](https://github.com/confluentinc/confluent-kafka-go/blob/master/schemaregistry/serde/avro/avro_generic.go#L130), which by consequence it will use the [`globalNames.Unmarshal`](https://github.com/heetch/avro/blob/master/decode.go#L24).
In my case, I'm experiencing an error of `Incompatible types` from `gogen-avro`, I have a struct with the Avro schema defined just on the schema registry, outer from my project. So the `writer` and `reader` schemas don't match, because the field names are interpreted differently.

After doing some hacks locally in order to test, I found `globalNames.Rename("", "", "")` and it solves the issue. But I didn't find a way to hook `globalNames` variable or some way to replace them globally (as [zap log does for instance](https://github.com/uber-go/zap/blob/aea2a5051d079dbe4606d990119c8b68f574ff59/global.go#L66)).

Which is the right way to use the aliases by `Rename` method?
Does makes sense for you to propose a way to use `Rename` method on the `globalNames`? If does, would you accept a PR making this kind of change?

Tks

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.