riferrei / srclient

Golang Client for Schema Registry
Apache License 2.0
235 stars 70 forks source link

Suport Karapace #69

Closed arnaldur closed 2 years ago

arnaldur commented 2 years ago

Currently Karapace requests fail if "references" is set, even if empty: "Unrecognized field: references". https://github.com/aiven/karapace/issues/195

In order to support Karapace in srclient I suggest adding an arg to the CreateSchemaRegistryClient method that allows to override the default behaviour if needed. The only change would be to add omitempty on the References field in the structs and looking at the arg to decide if the default empty value for References should be set.

Here is my closed PR with code for reference https://github.com/riferrei/srclient/pull/68

arnaldur commented 2 years ago

It comes down to omitempty treating empty and nil the same way. It would have to be a different struct sent to the registry in order to make absolutely no changes to the data that goes over the wire. If I manage to pack this nicely somehow and make no changes to the requests I'll reopen the PR.

https://github.com/golang/go/issues/22480

arnaldur commented 2 years ago

Reopened my PR with separate struct for Karapace requests along with a flag to omitempty on references

AtakanColak commented 2 years ago

Closed for now, see #68