-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add endpoint for specific schema version #37
base: master
Are you sure you want to change the base?
Conversation
@@ -96,17 +101,19 @@ | |||
private static final String ALL_SUBJECT_PATTERN = "/subjects"; | |||
private static final String SCHEMA_PATH_PATTERN = "/subjects/[^/]+/versions"; | |||
private static final String SCHEMA_BY_ID_PATTERN = "/schemas/ids/"; | |||
private static final String SCHEMA_VERSION_PATTERN = "/subjects/[^/]+\\?deleted=true"; |
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.
Why is deleted=true
part of the pattern?
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 deleted parameter is set to true
when calling getVersion(subject, schema)
and to false when calling getId(subject, schema)
.
Originally, I did not plan to include support for id requests and I wanted to make sure that there are no unexpected responses. Especially, since the parameter is not documented anywhere.
I looked into the behavior of a real schema registry and it responds as expected: When set to false, querying a deleted schema (not subject!) returns `{"error_code": 40403, "message": "Schema not found"}. Otherwise, it returns the complete schema information.
I'll remove the parameter from the pattern and add the logic for both cases in the transformer.
The SR Client Mock doesn't have any information about the version of a deleted schema. Therefore, I suggest that we treat a deleted schema as if it does not exists. This should be sufficient for testing applications. |
This PR adds support for fetching the version for a specific schema. It adds a handler for POST requests matching
/subjects/[^/]+\\?deleted=true
, which is called byschemaRegistryClient.getVersion(topic, schema)
. TheAvroConverter
uses this method internally.