Skip to content

Fix redefining a named Avro type in a diamond dependency pattern#2238

Open
Robert Yokota (rayokota) wants to merge 2 commits intomasterfrom
fix-avro-diamond
Open

Fix redefining a named Avro type in a diamond dependency pattern#2238
Robert Yokota (rayokota) wants to merge 2 commits intomasterfrom
fix-avro-diamond

Conversation

@rayokota
Copy link
Copy Markdown
Member

@rayokota Robert Yokota (rayokota) commented Apr 25, 2026

What

Fix redefining a named Avro type in a diamond dependency pattern. Fixes #2236

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

Copilot AI review requested due to automatic review settings April 25, 2026 00:24
@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.

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

Fixes Avro schema reference resolution for “diamond dependency” graphs where multiple sibling references share the same named type, avoiding SchemaParseException("redefined named type ...") during parsing.

Changes:

  • Update _resolve_named_schema (sync + async) to store referenced schemas in raw (unparsed) form so the top-level load_schema resolves each named type only once.
  • Add sync and async regression tests that reproduce the diamond-dependency reference pattern and verify serialize/deserialize round-trips.

Reviewed changes

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

File Description
src/confluent_kafka/schema_registry/_sync/avro.py Adjusts named-schema reference collection to prevent duplicate inline definitions in diamond graphs.
src/confluent_kafka/schema_registry/_async/avro.py Async equivalent of the named-schema reference resolution fix.
tests/schema_registry/_sync/test_avro_serdes.py Adds regression test covering diamond reference dependencies for sync serializer/deserializer.
tests/schema_registry/_async/test_avro_serdes.py Adds regression test covering diamond reference dependencies for async serializer/deserializer.

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

@sonarqube-confluent
Copy link
Copy Markdown

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.

SchemaParseException: redefined named type when two schema references share a common named type

2 participants