Skip to content

Conversation

fangnx
Copy link
Member

@fangnx fangnx commented Aug 18, 2025

What

Add the missing endpoints and update the existing ones to SR client, for /compatibility and /mode endpoints.

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-21591

Test & Review

Open questions / Follow-ups

@confluent-cla-assistant
Copy link

🎉 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.

@fangnx fangnx marked this pull request as ready for review August 18, 2025 20:37
@Copilot Copilot AI review requested due to automatic review settings August 18, 2025 20:37
@fangnx fangnx requested review from MSeal and a team as code owners August 18, 2025 20:37
@fangnx fangnx changed the base branch from master to sr-endpoints-add-1 August 18, 2025 20:38
Copilot

This comment was marked as outdated.

@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent

This comment has been minimized.

@fangnx fangnx requested a review from rayokota August 18, 2025 21:08
@sonarqube-confluent

This comment has been minimized.

)
return response['is_compatible'] # TODO: should it return entire response (including error messages)?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe return a tuple [bool, Response] so it's easy to have a simple response vs a parsing the complex object? But I think this should probably return the full response by itself with a reference in the docstring to the is_compatible as a likely attribute for consumption.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern is this would be a breaking change, although in this case I think it might be necessary to just make the change (or add a separate method and mark this one as @deprecated): not sure how customers usually interact with test_compatibility, but intuitively I think the "messages" field for test_compatibility is important to include
cc @rayokota if you have any thoughts on this :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't make any breaking changes, let's keep this as-is for now

`GET Global Mode API Reference <https://docs.confluent.io/current/schema-registry/develop/api.html#get--mode>`_
""" # noqa: E501
result = self._rest_client.get('mode')
return result['mode']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider a debug log here with the result if you're not returning the full payload so the contents aren't lost (or maybe generally have a logging debug level option for all rest requests made to SR service)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, mode is the only field in the JSON returned from this API

@sonarqube-confluent

This comment has been minimized.

1 similar comment
@sonarqube-confluent

This comment has been minimized.

Base automatically changed from sr-endpoints-add-1 to master August 20, 2025 14:19
@sonarqube-confluent

This comment has been minimized.

1 similar comment
@sonarqube-confluent

This comment has been minimized.

@sonarqube-confluent

This comment has been minimized.

@fangnx fangnx requested a review from Copilot August 21, 2025 20:32
Copy link

@Copilot 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 missing endpoints for /compatibility and /mode operations to the Schema Registry Client, expanding the client's API coverage to match the complete Schema Registry REST API.

Key changes include:

  • Added new mode management endpoints for global and subject-level mode operations
  • Enhanced compatibility testing with new all-versions endpoint and query parameters
  • Added configuration deletion endpoint and contexts listing endpoint

Reviewed Changes

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

Show a summary per file
File Description
tests/schema_registry/conftest.py Updated mock server to support new endpoints with proper regex patterns and callback handlers
tests/schema_registry/_sync/test_api_client.py Added comprehensive test coverage for all new sync client methods
tests/schema_registry/_async/test_api_client.py Added comprehensive test coverage for all new async client methods
src/confluent_kafka/schema_registry/_sync/schema_registry_client.py Implemented new endpoint methods and enhanced existing compatibility testing
src/confluent_kafka/schema_registry/_async/schema_registry_client.py Implemented new endpoint methods and enhanced existing compatibility testing
Comments suppressed due to low confidence (1)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@sonarqube-confluent

This comment has been minimized.

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.

Thanks @fangnx , LGTM

@sonarqube-confluent
Copy link

Passed

Analysis Details

7 Issues

  • Bug 0 Bugs
  • Vulnerability 0 Vulnerabilities
  • Code Smell 7 Code Smells

Coverage and Duplications

  • Coverage 100.00% Coverage (66.60% Estimated after merge)
  • Duplications No duplication information (5.60% Estimated after merge)

Project ID: confluent-kafka-python

View in SonarQube

@fangnx fangnx requested a review from MSeal August 25, 2025 15:26
Copy link
Contributor

@MSeal MSeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might need a merge/rebase from master

@fangnx fangnx merged commit 198819f into master Aug 26, 2025
3 checks passed
@fangnx fangnx deleted the sr-endpoints-add-2 branch August 26, 2025 03:52
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