Skip to content

DGS-23025 Add AssociatedNameStrategy#2577

Merged
Robert Yokota (rayokota) merged 29 commits into
masterfrom
assoc-strategy
Mar 12, 2026
Merged

DGS-23025 Add AssociatedNameStrategy#2577
Robert Yokota (rayokota) merged 29 commits into
masterfrom
assoc-strategy

Conversation

@rayokota
Copy link
Copy Markdown
Member

@rayokota Robert Yokota (rayokota) commented Feb 23, 2026

What

  • Add AssociatedNameStrategy, which is now the default
  • Add async subject-name strategy delegate pipeline (serdes now await subject resolution)
  • Add tests

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 February 23, 2026 22:42
Copy link
Copy Markdown
Contributor

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 introduces an “Associated” subject name strategy that resolves the Schema Registry subject for a topic via Schema Registry associations, and wires the serdes to use an async subject naming delegate to support this lookup.

Changes:

  • Added SubjectNameStrategy.Associated plus an async subject-name strategy delegate pipeline (serdes now await subject resolution).
  • Added Schema Registry REST + client APIs for association CRUD / lookup, and corresponding data contracts.
  • Added unit tests and mock support to validate associated subject resolution, fallback behavior, and kafka-cluster-namespace behavior.

Reviewed changes

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

Show a summary per file
File Description
test/Confluent.SchemaRegistry.Serdes.UnitTests/SerializeDeserialize.cs Adds unit tests covering Associated strategy behavior and fallback.
test/Confluent.SchemaRegistry.Serdes.UnitTests/BaseSerializeDeserialize.cs Extends mock Schema Registry client to support association lookups used by tests.
src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Adds async subject strategy delegate, Associated strategy implementation, and ToAsyncDelegate.
src/Confluent.SchemaRegistry/Rest/RestService.cs Adds REST calls for association lookup/create/delete and a void-request helper.
src/Confluent.SchemaRegistry/Rest/IRestService.cs Exposes association REST endpoints to the internal REST service interface.
src/Confluent.SchemaRegistry/Rest/DataContracts/Association.cs New association DTO for REST responses.
src/Confluent.SchemaRegistry/Rest/DataContracts/AssociationInfo.cs New association info DTO for create/update responses.
src/Confluent.SchemaRegistry/Rest/DataContracts/AssociationResponse.cs New DTO for create/update association responses.
src/Confluent.SchemaRegistry/Rest/DataContracts/AssociationCreateOrUpdateRequest.cs New DTO for create/update association requests.
src/Confluent.SchemaRegistry/Rest/DataContracts/AssociationCreateOrUpdateInfo.cs New DTO for association create/update items.
src/Confluent.SchemaRegistry/ISchemaRegistryClient.cs Adds association APIs to the public client interface.
src/Confluent.SchemaRegistry/CachedSchemaRegistryClient.cs Implements the new association APIs via RestService.
src/Confluent.SchemaRegistry/AsyncSerde.cs Switches serdes to use an async subject name delegate and await subject resolution.
src/Confluent.SchemaRegistry.Serdes.Protobuf/ProtobufSerializer.cs Uses ToAsyncDelegate and allows strategy.* configs.
src/Confluent.SchemaRegistry.Serdes.Protobuf/ProtobufDeserializer.cs Uses ToAsyncDelegate and allows strategy.* configs.
src/Confluent.SchemaRegistry.Serdes.Json/JsonSerializer.cs Uses ToAsyncDelegate and allows strategy.* configs.
src/Confluent.SchemaRegistry.Serdes.Json/JsonDeserializer.cs Uses ToAsyncDelegate and allows strategy.* configs.
src/Confluent.SchemaRegistry.Serdes.Avro/SpecificSerializerImpl.cs Awaits async subject name resolution.
src/Confluent.SchemaRegistry.Serdes.Avro/SpecificDeserializerImpl.cs Awaits async subject name resolution.
src/Confluent.SchemaRegistry.Serdes.Avro/GenericSerializerImpl.cs Awaits async subject name resolution.
src/Confluent.SchemaRegistry.Serdes.Avro/GenericDeserializerImpl.cs Awaits async subject name resolution.
src/Confluent.SchemaRegistry.Serdes.Avro/AvroSerializer.cs Allows strategy.* configs (validation change).
src/Confluent.SchemaRegistry.Serdes.Avro/AvroDeserializer.cs Allows strategy.* configs (validation change).

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

Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Comment thread src/Confluent.SchemaRegistry/ISchemaRegistryClient.cs
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Comment thread src/Confluent.SchemaRegistry/Rest/DataContracts/AssociationResponse.cs Outdated
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Copy link
Copy Markdown
Contributor

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

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


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

Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Copy link
Copy Markdown
Contributor

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

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


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

Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Comment thread src/Confluent.SchemaRegistry/AsyncSerde.cs Outdated
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs
Copy link
Copy Markdown
Contributor

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

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


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

Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Comment thread src/Confluent.SchemaRegistry/Rest/RestService.cs
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs
Copy link
Copy Markdown
Contributor

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

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


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

Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 25 out of 25 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/Confluent.SchemaRegistry.Serdes.Protobuf/ProtobufDeserializer.cs:148

  • The code instantiates new T() twice in this method: once at line 139 to get the Descriptor.FullName, and again at line 148 to create the actual message object. This is wasteful and could cause issues if the constructor has side effects or is expensive. Consider moving the second GetSubjectName call to after line 148 and using message.Descriptor.FullName instead of creating a new instance. This would reduce unnecessary object allocation and potential side effects.
                    if (subject == null)
                    {
                        subject = await GetSubjectName(topic, isKey, new T().Descriptor.FullName).ConfigureAwait(false);
                    }
                }
                payload = await ExecuteRules(context.Component == MessageComponentType.Key,
                        subject, context.Topic, context.Headers, RulePhase.Encoding, RuleMode.Read,
                        null, writerSchema, payload, null)
                    .ContinueWith(t => t.Result is byte[] bytes ? new ReadOnlyMemory<byte>(bytes) : (ReadOnlyMemory<byte>)t.Result)
                    .ConfigureAwait(continueOnCapturedContext: false);

                message = new T();

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

Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs
Copy link
Copy Markdown
Contributor

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

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


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

Comment thread src/Confluent.SchemaRegistry/AsyncSerde.cs Outdated
Comment thread src/Confluent.SchemaRegistry/CachedSchemaRegistryClient.cs Outdated
Comment thread src/Confluent.SchemaRegistry/CachedSchemaRegistryClient.cs Outdated
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs
Comment thread src/Confluent.SchemaRegistry/Rest/RestService.cs
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs Outdated
Copy link
Copy Markdown
Contributor

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

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


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

Comment thread src/Confluent.SchemaRegistry.Serdes.Avro/SpecificSerializerImpl.cs
Comment thread src/Confluent.SchemaRegistry.Serdes.Avro/GenericDeserializerImpl.cs
Comment thread src/Confluent.SchemaRegistry.Serdes.Json/JsonSerializer.cs
Comment thread src/Confluent.SchemaRegistry.Serdes.Json/JsonDeserializer.cs
Comment thread src/Confluent.SchemaRegistry.Serdes.Protobuf/ProtobufSerializer.cs
Comment thread src/Confluent.SchemaRegistry.Serdes.Avro/GenericSerializerImpl.cs
Comment thread src/Confluent.SchemaRegistry/SubjectNameStrategy.cs
@sonarqube-confluent
Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

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

See analysis details on SonarQube

1 similar comment
@sonarqube-confluent
Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

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

See analysis details on SonarQube

@rayokota Robert Yokota (rayokota) merged commit 863f478 into master Mar 12, 2026
2 of 3 checks passed
@rayokota Robert Yokota (rayokota) deleted the assoc-strategy branch March 12, 2026 23:57
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