Skip to content

[CLI-3630] Support Schema IDs in headers#3163

Merged
Steven Gagniere (sgagniere) merged 33 commits intomainfrom
CLI-3630
Jan 26, 2026
Merged

[CLI-3630] Support Schema IDs in headers#3163
Steven Gagniere (sgagniere) merged 33 commits intomainfrom
CLI-3630

Conversation

@sgagniere
Copy link
Copy Markdown
Member

@sgagniere Steven Gagniere (sgagniere) commented Aug 19, 2025

Release Notes

Breaking Changes

  • PLACEHOLDER

New Features

  • confluent kafka topic consume now supports consuming messages with schema IDs serialized in the header

Bug Fixes

  • PLACEHOLDER

Checklist

  • I have successfully built and used a custom CLI binary, without linter issues from this PR.
  • I have clearly specified in the What section below whether this PR applies to Confluent Cloud, Confluent Platform, or both.
  • I have verified this PR in Confluent Cloud pre-prod or production environment, if applicable.
  • I have verified this PR in Confluent Platform on-premises environment, if applicable.
  • I have attached manual CLI verification results or screenshots in the Test & Review section below.
  • I have added appropriate CLI integration or unit tests for any new or updated commands and functionality.
  • I confirm that this PR introduces no breaking changes or backward compatibility issues.
  • I have indicated the potential customer impact if something goes wrong in the Blast Radius section below.
  • I have put checkmarks below confirming that the feature associated with this PR is enabled in:
    • Confluent Cloud prod
    • Confluent Cloud stag or devel
    • Confluent Platform
    • Check this box if the feature is enabled for certain organizations only

What

Support schema IDs in headers for confluent kafka topic [produce | consume] for both Cloud and On-prem.

Blast Radius

The update to the functionality is additive, but the implementation required changes to the serdes package. So in the worst case bugs could impact the deserialization of json/avro/protobuf messages in kafka topic consume and asyncapi export.

References

Test & Review

Manual testing: https://docs.google.com/document/d/13e62TwsqCSwT6FU587Gm03Vz_VNFP4c9XrCw2anK8oI/edit?usp=sharing

@confluent-cla-assistant
Copy link
Copy Markdown

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

@sgagniere Steven Gagniere (sgagniere) changed the title [CLI-3630] Update ckgo version to 2.11.0 [CLI-3630] Update ckgo version to 2.11.0 to support Schema IDs in headers Sep 23, 2025
@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent

This comment has been minimized.

@sgagniere Steven Gagniere (sgagniere) marked this pull request as ready for review October 24, 2025 01:58
@sgagniere Steven Gagniere (sgagniere) requested a review from a team as a code owner October 24, 2025 01:58
Copilot AI review requested due to automatic review settings October 24, 2025 01:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the confluent-kafka-go library to version 2.11.0 to support serializing and deserializing schema IDs in message headers instead of the traditional message prefix. The changes introduce a new --schema-id-header flag for the confluent kafka topic produce command and automatically support header-based schema IDs in the consume command.

Key changes:

  • Updated confluent-kafka-go dependency from v2.8.0 to v2.11.0
  • Added --schema-id-header flag to serialize schema IDs in headers for produce operations
  • Refactored serialization/deserialization interfaces to support headers and updated all provider implementations
  • Consolidated Schema Registry client initialization logic and improved test coverage for header-based schema IDs

Reviewed Changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
go.mod Updated confluent-kafka-go dependency to v2.11.0
pkg/serdes/serdes.go Added header support to serialization/deserialization interfaces and consolidated SR client initialization
pkg/serdes/*_serialization_provider.go Updated all serialization providers to return headers alongside serialized data
pkg/serdes/*_deserialization_provider.go Updated all deserialization providers to accept headers and use shared SR client initialization
pkg/serdes/serdes_test.go Added comprehensive test coverage for header-based schema ID serialization/deserialization
internal/kafka/command_topic_produce.go Added --schema-id-header flag support and updated message serialization to include headers
internal/kafka/confluent_kafka.go Refactored consume logic to support header-based schema IDs and removed legacy RequestSchema method
internal/kafka/confluent_kafka_configs.go Enhanced debug logging configuration for producer/consumer
internal/asyncapi/command_export.go Updated to use new deserialization interface with headers
test/fixtures/output/kafka/topic/*.golden Updated test fixtures for help text and error messages

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread pkg/serdes/json_deserialization_provider.go
@@ -67,7 +45,6 @@ func (a *AvroDeserializationProvider) InitDeserializer(srClientUrl, srClusterId,
}

deser, err := avrov2.NewDeserializer(serdeClient, serdeType, serdeConfig)
Copy link

Copilot AI Oct 24, 2025

Choose a reason for hiding this comment

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

[nitpick] Removed blank line between the deserializer creation and error check. While this works, the previous formatting with the blank line was more consistent with the style used elsewhere in the codebase.

Suggested change
deser, err := avrov2.NewDeserializer(serdeClient, serdeType, serdeConfig)
deser, err := avrov2.NewDeserializer(serdeClient, serdeType, serdeConfig)

Copilot uses AI. Check for mistakes.
Comment thread pkg/serdes/serdes_test.go Outdated
Comment thread pkg/serdes/serdes_test.go Outdated
@sonarqube-confluent
Copy link
Copy Markdown

Failed

  • 53.80% Coverage on New Code (is less than 80.00%)

Analysis Details

8 Issues

  • Bug 0 Bugs
  • Vulnerability 0 Vulnerabilities
  • Code Smell 8 Code Smells

Coverage and Duplications

  • Coverage 53.80% Coverage (78.30% Estimated after merge)
  • Duplications No duplication information (0.20% Estimated after merge)

Project ID: cli

View in SonarQube

@sonarqube-confluent
Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

Failed conditions
57.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube

@sgagniere Steven Gagniere (sgagniere) changed the title [CLI-3630] Update ckgo version to 2.11.0 to support Schema IDs in headers [CLI-3630] Support Schema IDs in headers Jan 20, 2026
Comment thread internal/asyncapi/command_export.go
Comment thread internal/kafka/confluent_kafka.go
Comment thread internal/kafka/confluent_kafka.go Outdated
Comment thread pkg/serdes/json_deserialization_provider.go
Comment thread pkg/serdes/protobuf_deserialization_provider.go
Comment thread internal/kafka/command_topic_produce.go
@channingdong
Copy link
Copy Markdown
Contributor

As a precautionary sanity check, can we add one more manual test case that produces and consumes a plain string message (no schema involved)?

@sonarqube-confluent
Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

Failed conditions
57.8% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@sgagniere Steven Gagniere (sgagniere) merged commit 282b203 into main Jan 26, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants