Github user markap14 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2523#discussion_r174821838
--- Diff:
nifi-nar-bundles/nifi-confluent-platform-bundle/nifi-confluent-schema-registry-service/src/main/java/org/apache/nifi/confluent/schemaregistry/ConfluentSchemaRegistry.java
---
@@ -176,28 +178,33 @@ public void onEnabled(final ConfigurationContext
context) {
return baseUrls;
}
- @Override
- public String retrieveSchemaText(final String schemaName) throws
IOException, SchemaNotFoundException {
- final RecordSchema schema = retrieveSchema(schemaName);
- return schema.getSchemaText().get();
- }
+ private RecordSchema retrieveSchemaByName(final SchemaIdentifier
schemaIdentifier) throws IOException, SchemaNotFoundException {
+ final Optional<String> schemaName = schemaIdentifier.getName();
+ if (!schemaName.isPresent()) {
+ throw new
org.apache.nifi.schema.access.SchemaNotFoundException("Cannot retrieve schema
because Schema Name is not present");
+ }
- @Override
- public String retrieveSchemaText(final long schemaId, final int
version) throws IOException, SchemaNotFoundException {
- final RecordSchema schema = retrieveSchema(schemaId, version);
- return schema.getSchemaText().get();
+ final RecordSchema schema = client.getSchema(schemaName.get());
+ return schema;
}
- @Override
- public RecordSchema retrieveSchema(final String schemaName) throws
IOException, SchemaNotFoundException {
- final RecordSchema schema = client.getSchema(schemaName);
+ private RecordSchema retrieveSchemaByIdAndVersion(final
SchemaIdentifier schemaIdentifier) throws IOException, SchemaNotFoundException {
--- End diff --
This doesn't appear to take into account a version at all - which I think
is correct because the Confluent Schema Registry I don't supports ID + Version,
as each version would get a different ID? But in this case perhaps the name of
the method should just be `retrieveSchemaById` and not
`retrieveSchemaByIdAndVersion`?
---