Skip to content
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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

torbsto
Copy link
Contributor

@torbsto torbsto commented Nov 20, 2019

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 by schemaRegistryClient.getVersion(topic, schema) . The AvroConverter uses this method internally.

@@ -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";
Copy link
Member

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?

Copy link
Contributor Author

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.

@torbsto
Copy link
Contributor Author

torbsto commented Nov 26, 2019

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.

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.

2 participants