Skip to content

Conversation

@fangnx
Copy link
Member

@fangnx fangnx commented Dec 18, 2025

Please prefix all TypeScript pull-requests with [Typescript]

What

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: https://confluentinc.atlassian.net/browse/DGS-22381

Test & Review

Open questions / Follow-ups

Copilot AI review requested due to automatic review settings December 18, 2025 20:52
@fangnx fangnx requested review from a team as code owners December 18, 2025 20:52
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 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 RecordNameStrategy function 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
Copy link

Copilot AI Dec 18, 2025

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.

Suggested change
const packageName = fileDesc.package || null
const packageName = fileDesc.package

Copilot uses AI. Check for mistakes.

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)
Copy link

Copilot AI Dec 18, 2025

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.

Suggested change
throw new SerializationError(err.message)
throw new SerializationError(`rule ${ctx.rule.name} failed: ${err.message}`)

Copilot uses AI. Check for mistakes.
@sonarqube-confluent
Copy link

Copy link
Member

@rayokota rayokota left a 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

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