Skip to content

Conversation

@rayokota
Copy link
Member

@rayokota rayokota commented Nov 19, 2025

What

Fix support for wrapped Avro unions. A wrapped union can either be a tuple containing the type name and value, or a dict with an extra "-type" field with the type name.

Checklist

  • [Y] Contains customer facing changes? Including API/behavior changes
  • [Y] Did you add sufficient unit test and/or integration test coverage for this PR?
    • If not, please explain why it is not required

References

JIRA:

Test & Review

Open questions / Follow-ups

@rayokota rayokota requested a review from MSeal as a code owner November 19, 2025 04:37
Copilot AI review requested due to automatic review settings November 19, 2025 04:37
@rayokota rayokota requested review from a team as code owners November 19, 2025 04:37
@confluent-cla-assistant
Copy link

🎉 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.

Copy link

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 adds support for wrapped Avro unions in the schema registry serialization/deserialization logic. The changes enable proper handling of two union representation formats: tuple-based wrapped unions and dictionary-based typed unions.

  • Added logic to detect and handle wrapped union types (tuples) and typed unions (dictionaries with '-type' key)
  • Updated the union resolution to preserve the wrapper format during transformations
  • Added comprehensive test coverage for both wrapped and typed union scenarios with field encryption

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/confluent_kafka/schema_registry/common/avro.py Added tuple type support and modified _resolve_union to handle wrapped and typed unions, preserving tuple wrappers during transformation
tests/schema_registry/_sync/test_avro_serdes.py Added synchronous tests for wrapped and typed union encryption scenarios
tests/schema_registry/_async/test_avro_serdes.py Added asynchronous tests for wrapped and typed union encryption scenarios

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Claimundefine
Claimundefine previously approved these changes Nov 20, 2025
@sonarqube-confluent
Copy link

@rayokota rayokota merged commit 3c01848 into master Nov 20, 2025
2 of 3 checks passed
@rayokota rayokota deleted the DGS-22899 branch November 20, 2025 21:30
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.

3 participants