Skip to content

Conversation

@rayokota
Copy link
Member

What

Fix handling of named Avro schemas. Fixes #1924

Checklist

  • Contains customer facing changes? Including API/behavior changes
  • 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

Copilot AI review requested due to automatic review settings February 28, 2025 22:54
@rayokota rayokota requested review from a team as code owners February 28, 2025 22:54
@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.

PR Overview

This PR addresses the handling of named Avro schemas to fix the issue described in #1924 by improving schema resolution and parsing.

  • Adds a new test to verify union serialization/deserialization of Avro schemas.
  • Updates schema parsing in the Avro serializer and deserializer to use a new helper function (parse_schema_with_repo).
  • Introduces LocalSchemaRepository to support the new parsing strategy.

Reviewed Changes

File Description
tests/schema_registry/test_avro_serdes.py Adds a new test to cover union schema serialization/deserialization.
src/confluent_kafka/schema_registry/avro.py Refactors named schema resolution to use parse_schema_with_repo and adds LocalSchemaRepository.

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

Comments suppressed due to low confidence (1)

src/confluent_kafka/schema_registry/avro.py:628

  • [nitpick] The variable name 'copy' is ambiguous and shadows the built-in module 'copy'. Consider renaming it to 'schemas_copy' or a more descriptive name.
copy = deepcopy(named_schemas)

Copy link
Contributor

@Claimundefine Claimundefine left a comment

Choose a reason for hiding this comment

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

LGTM

@rayokota rayokota merged commit 95cb644 into master Feb 28, 2025
1 of 2 checks passed
@rayokota rayokota deleted the fix-avro-named branch February 28, 2025 23:04
@sonarqube-confluent
Copy link

Passed

Analysis Details

2 Issues

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

Coverage and Duplications

  • Coverage 100.00% Coverage (61.80% Estimated after merge)
  • Duplications No duplication information (0.90% Estimated after merge)

Project ID: confluent-kafka-python

View in SonarQube

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.

redefined named type when record referenced multiple times within union

3 participants