-
Notifications
You must be signed in to change notification settings - Fork 933
Set registered schema subject correctly #2020
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
Set registered schema subject correctly #2020
Conversation
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
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 fixes an issue where the register_schema_full_response method doesn't correctly set the subject name on the registered schema when the Schema Registry server returns a response without a subject name (as allowed by the Confluent Schema Registry API).
- Adds logic to set the subject name on the registered schema if it's missing from the server response
- Ensures the returned registered schema object has the correct subject name populated
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/confluent_kafka/schema_registry/_sync/schema_registry_client.py | Adds subject name fallback logic in synchronous schema registry client |
| src/confluent_kafka/schema_registry/_async/schema_registry_client.py | Adds identical subject name fallback logic in asynchronous schema registry client |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| registered_schema = RegisteredSchema.from_dict(response) | ||
|
|
||
| if registered_schema.subject is None: | ||
| registered_schema.subject = subject_name |
Copilot
AI
Aug 13, 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.
[nitpick] Direct mutation of the registered_schema object could lead to unexpected side effects. Consider creating a new RegisteredSchema instance with the correct subject or using a method that returns a properly initialized object.
| registered_schema.subject = subject_name | |
| registered_schema = RegisteredSchema( | |
| registered_schema.schema_id, | |
| registered_schema.schema, | |
| registered_schema.guid, | |
| subject_name, | |
| registered_schema.version | |
| ) |
| registered_schema = RegisteredSchema.from_dict(response) | ||
|
|
||
| if registered_schema.subject is None: | ||
| registered_schema.subject = subject_name |
Copilot
AI
Aug 13, 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.
[nitpick] Direct mutation of the registered_schema object could lead to unexpected side effects. Consider creating a new RegisteredSchema instance with the correct subject or using a method that returns a properly initialized object.
| registered_schema.subject = subject_name | |
| registered_schema = RegisteredSchema( | |
| registered_schema.schema_id, | |
| registered_schema.schema, | |
| registered_schema.guid, | |
| subject_name, | |
| registered_schema.version | |
| ) |
ec8d303 to
c265afb
Compare
|
/sem-approve |
|
/sem-approve |
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.
Thanks @jekel , LGTM
What
Schema Registry server on new schema registration with specifiied subject could return no subject name in response,
like Confluent Schema Registry, so, register_schema_full_response method does not set it correctly, and returned registered schema is without subject.
This pull request fixs this issue.