-
Notifications
You must be signed in to change notification settings - Fork 23
Support RecordNameStrategy for SR client #423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 RecordNameStrategy in the Schema Registry client, enabling schemas to be shared across topics with compatibility enforced per record type rather than per topic. The implementation includes comprehensive helper functions for extracting record names from Avro, Protobuf, and JSON schemas.
Key changes:
- Introduced
RecordNameStrategyfunction that derives subject names from schema record names instead of topic names - Added schema-type-specific helper functions (
getAvroRecordName,getProtobufRecordName,getJsonRecordName) to extract fully qualified record names - Modified error handling in
ErrorAction.run()to simplify error messages
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| schemaregistry/serde/serde.ts | Implements RecordNameStrategy with helper functions for extracting record names from different schema types and updates error handling |
| schemaregistry/test/serde/serde.spec.ts | Adds comprehensive test coverage for both TopicNameStrategy and RecordNameStrategy across all schema types with edge cases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| // Get package name | ||
| const packageName = fileDesc.package || null |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assignment || null is unnecessary since fileDesc.package is already optional. The ternary on line 717 already handles falsy values correctly. Consider simplifying to const packageName = fileDesc.package.
| const packageName = fileDesc.package || null | |
| const packageName = fileDesc.package |
|
|
||
| async run(ctx: RuleContext, msg: any, err: Error): Promise<void> { | ||
| throw new SerializationError(`rule ${ctx.rule.name} failed: ${err.message}`) | ||
| throw new SerializationError(err.message) |
Copilot
AI
Dec 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the rule context information (rule ${ctx.rule.name} failed:) makes error messages less informative for debugging. This change reduces the ability to identify which rule caused the failure. Consider preserving the rule name in the error message.
| throw new SerializationError(err.message) | |
| throw new SerializationError(`rule ${ctx.rule.name} failed: ${err.message}`) |
|
rayokota
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's hold off on these changes until I make the changes for AssociatedNameStrategy




Please prefix all TypeScript pull-requests with
[Typescript]What
Checklist
References
Jira: https://confluentinc.atlassian.net/browse/DGS-22381
Test & Review
Open questions / Follow-ups