You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the confluent-kafka-go, during the deserialization-generic flow they call avro.Unmarshal, which by consequence it will use the globalNames.Unmarshal.
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("<struct_field>", "<schema_registry_field>", "<struct_field>") 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).
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
The text was updated successfully, but these errors were encountered:
I'm not quite sure we would like to expose the globalNames since it means manipulating global state.
One solution I believe may help is aliases on the avro schema itself https://avro.apache.org/docs/1.8.1/spec.html#Aliases
It does require to have control over the reader schema though.
Given this, one solution may be to expose a Rename function that would itself call globalNames
Thoughts @sixstone-qq@rogpeppe ?
I understand. However, for this particular case I'm talking about, the gogen-avro will generate the Avro schema in runtime and try to match, that's why I need to use the Rename function.
I said about the possibility to expose globalNames or replace it, as zap lib does could solve.
But of course, expose or not the globalNames is your call, exposing Rename function solves this case and probably is simplest.
Hey,
I'm using the
confluent-kafka-go
, during the deserialization-generic flow they callavro.Unmarshal
, which by consequence it will use theglobalNames.Unmarshal
.In my case, I'm experiencing an error of
Incompatible types
fromgogen-avro
, I have a struct with the Avro schema defined just on the schema registry, outer from my project. So thewriter
andreader
schemas don't match, because the field names are interpreted differently.After doing some hacks locally in order to test, I found
globalNames.Rename("<struct_field>", "<schema_registry_field>", "<struct_field>")
and it solves the issue. But I didn't find a way to hookglobalNames
variable or some way to replace them globally (as zap log does for instance).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 theglobalNames
? If does, would you accept a PR making this kind of change?Tks
The text was updated successfully, but these errors were encountered: