riferrei / srclient

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

Omit references if nil #68

Closed arnaldur closed 2 years ago

arnaldur commented 2 years ago

Rationale is that karapace fails if references is set, even if empty: "Unrecognized field: references"

In order to keep srclient compatible I suggest omitting References if nil.

https://github.com/aiven/karapace/issues/195

note, not tested with other registries.

riferrei commented 2 years ago

I understand the rationale behind this PR, but I don't feel comfortable approving it as it targets a schema registry not intended to be supported by this library. I am not totally against providing support for other registries than Confluent's Schema Registry, as long extensible tests are made on it to make sure nothing will break. Furthermore, support for references is a thing in most registries these days, so maybe this fix should be worked out on Karaspace's side instead of on the client?

I propose closing this PR for now and moving this into an issue to be discussed.

@AtakanColak thoughts?

arnaldur commented 2 years ago

This was a bit of a shot in the dark, easier to change this than karapace. But I agree, karapace has had an open issue for a long time on this, it should be fixed there. I will close this and create an issue, I can contribute if you want to support karapace as well.

AtakanColak commented 2 years ago

I'd prefer to extend the existing interface and struct to a new KarapaceSchemaRegistryClient struct within this repository instead of adding exceptional cases to the existing struct for an exception like this PR. However I'd be up for this only if there are many who use Karapace and this library.

If Schema Registry API omits references if there are no references, then we can use this PR, but I don't know if that is the case.

arnaldur commented 2 years ago

I understand,I tried to do a minimally invasive change just to support this. I'll close this for now, but willing to put in the time to implement this if the Karapace support question becomes loud.