Skip to content

Conversation

@rayokota
Copy link
Member

@rayokota rayokota commented Nov 19, 2025

What

Fix support for wrapped Avro unions. For generic unions, the union is a map with a single name/value pair, with the name being the type name and the value being the union value.

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 review from a team as code owners November 19, 2025 04:36
Copilot AI review requested due to automatic review settings November 19, 2025 04:36
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 fixes support for wrapped Avro unions by modifying the resolveUnion and transform functions to properly handle union types that are represented as single-entry maps (e.g., map[string]interface{}{"com.acme.Data": {...}}). The changes ensure that when transforming union fields, the wrapper structure is preserved after applying field transformations.

Key changes:

  • Modified resolveUnion to detect and unwrap single-entry maps, returning both the resolved schema and the unwrapped message value
  • Updated transform to reconstruct the wrapped union structure after applying transformations to the inner value
  • Added comprehensive test coverage for encryption with wrapped unions

Reviewed Changes

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

File Description
schemaregistry/serde/avrov2/avro_util.go Enhanced union resolution and transformation logic to handle wrapped unions represented as single-entry maps
schemaregistry/serde/avrov2/avro_test.go Added test case and schema definition to verify encryption/decryption works correctly with wrapped union types

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

@sonarqube-confluent
Copy link

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