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
DGS-7208 DGS-7474 Add alias/normalize configs #2664
Conversation
An alias allows you to look up a subject using an alternative name. The normalize config allows you to ensure normalization is always used for registration/lookup calls.
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 @rayokota. LGTM. few questions for my own understanding.
private final KafkaSchemaRegistry schemaRegistry; | ||
|
||
public AliasFilter(KafkaSchemaRegistry schemaRegistry) { |
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.
nit: Can these be SchemaRegistry
?
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.
Unfortunately the method getConfig(String subject)
is not on SchemaRegistry
.
@PreMatching | ||
@Priority(Priorities.ENTITY_CODER + 100) // ensure runs after ContextFilter | ||
public class AliasFilter implements ContainerRequestFilter { | ||
private static final Logger log = LoggerFactory.getLogger(AliasFilter.class); |
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.
nit: log
doesn't seem to be used.
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.
I'll remove
core/src/main/java/io/confluent/kafka/schemaregistry/rest/filters/AliasFilter.java
Outdated
Show resolved
Hide resolved
core/src/test/java/io/confluent/kafka/schemaregistry/rest/filters/AliasFilterTest.java
Outdated
Show resolved
Hide resolved
String modifyUriPath(String path) { | ||
boolean subjectPathFound = false; | ||
StringBuilder modifiedPath = new StringBuilder(); | ||
boolean isFirst = 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.
this is being set to false
below but I'm not sure if I understand the significance of it.
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.
I'll remove
config, | ||
restApp.restClient.updateConfig(config, null)); | ||
|
||
Schema schema = restApp.restClient.getVersion("testSubject", 1); |
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.
should this be badSubject
?
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.
This test tests that aliases set at the global level (with no subject specified) don't do anything. The test is called testGlobalAliasNotUsed
. In the future we may want to use these for something, but for now they are not used.
} | ||
|
||
@Test | ||
public void testRoot() throws Exception { |
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.
nit: Exception is never thrown
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.
I'll remove
…ers/AliasFilter.java Co-authored-by: Akhilesh Manjunath <am5156@cs.nyu.edu>
…ers/AliasFilterTest.java Co-authored-by: Akhilesh Manjunath <am5156@cs.nyu.edu>
Thanks for the detailed review and feedback @akhileshm1 ! |
An alias allows you to look up a subject using an alternative name.
The normalize config allows you to ensure normalization is always used for registration/lookup calls.
Also add
QualifiedReferenceSubjectNameStrategy
which is an alternative implementation ofReferenceSubjectNameStrategy
.