Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions schemaregistry/internal/rest_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"strings"
"time"

"github.com/confluentinc/confluent-kafka-go/v2/kafka"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid the dependency of the SR client on Kafka?

"github.com/confluentinc/confluent-kafka-go/v2/schemaregistry/rest"
"golang.org/x/oauth2/clientcredentials"
)
Expand Down Expand Up @@ -85,6 +86,14 @@ const (
TargetIdentityPoolIDKey = "Confluent-Identity-Pool-Id"
)

// getClientVersionHeaderValue returns the client version header value
// in the format "go/{version}"
// Note: currently the client version is tied to the librdkafka version
func getClientVersionHeaderValue() string {
_, version := kafka.LibraryVersion()
return "go/" + version
Comment on lines +89 to +94
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment states the version is 'tied to the librdkafka version', but this coupling may be confusing since this is a Schema Registry client. Consider clarifying why the librdkafka version is used for the Schema Registry client version header, or if a dedicated Schema Registry client version should be used instead.

Suggested change
// getClientVersionHeaderValue returns the client version header value
// in the format "go/{version}"
// Note: currently the client version is tied to the librdkafka version
func getClientVersionHeaderValue() string {
_, version := kafka.LibraryVersion()
return "go/" + version
// getClientVersionHeaderValue returns the Schema Registry client version header value
// in the format "go/{version}"
// Note: this version reflects the Schema Registry client, not the Kafka library version.
const schemaRegistryClientVersion = "1.0.0" // TODO: Update this version as needed for releases
func getClientVersionHeaderValue() string {
return "go/" + schemaRegistryClientVersion

Copilot uses AI. Check for mistakes.
}

// API represents a REST API request
type API struct {
method string
Expand Down Expand Up @@ -148,6 +157,7 @@ func NewRestService(conf *ClientConfig) (*RestService, error) {

headers.Set("Content-Type", "application/vnd.schemaregistry.v1+json")
headers.Set("Confluent-Accept-Unknown-Properties", "true")
headers.Set("Confluent-Client-Version", getClientVersionHeaderValue())

authenticationHeaderProvider, err := NewAuthenticationHeaderProvider(urls[0], conf)
if err != nil {
Expand Down