riferrei / srclient

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

Only include schemaType and References when needed #98

Closed adamtabrams closed 1 year ago

adamtabrams commented 1 year ago

Older versions of the Confluent Schema Registry API don't support fields schemaType or References. Right now, this package always includes these in requests, even if they aren't being used. Since these fields were added to the API, the documentation has stated that they are optional fields. And it's documented that schemaType is always assumed to be Avro when it isn't specified.

This PR ensures that these fields are only included in the request when they're not empty. And it does this with minimal changes to the package.

I need this behavior in order to use this package for my use case. And I've found a few previous issues that had problems that this PR would address: https://github.com/riferrei/srclient/issues/11 https://github.com/riferrei/srclient/issues/19 https://github.com/riferrei/srclient/issues/21

In addition to the unit tests added in this PR, I've also tested these changes with integration tests specific to my use case.

Please feel free to mention any questions or concerns.

adamtabrams commented 1 year ago

Just bumping this PR @riferrei @AtakanColak

AtakanColak commented 1 year ago

Hi Adam, thank you for your contribution. I'm inclined to merge this change, except the part I've commented on. Could you please either walk me through the cases where empty schema type would be required or revert the change?

AtakanColak commented 1 year ago

Thanks 👍