Skip to content

Commit 2e3a2c7

Browse files
authored
REVERT: DGS-20986 - (Breaking API Change) (#3922) (#3932)
1 parent 62b9036 commit 2e3a2c7

File tree

2 files changed

+1
-42
lines changed

2 files changed

+1
-42
lines changed

core/src/main/java/io/confluent/kafka/schemaregistry/rest/resources/SubjectsResource.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ public void lookUpSchemaUnderSubject(
121121
subject, lookupDeletedSchema, request.getSchemaType());
122122

123123
subject = QualifiedSubject.normalize(schemaRegistry.tenant(), subject);
124+
124125
// returns version if the schema exists. Otherwise returns 404
125126
Schema schema = new Schema(subject, request);
126127
io.confluent.kafka.schemaregistry.client.rest.entities.Schema matchingSchema;
@@ -130,15 +131,6 @@ public void lookUpSchemaUnderSubject(
130131
}
131132
matchingSchema = schemaRegistry.lookUpSchemaUnderSubjectUsingContexts(
132133
subject, schema, normalize, lookupDeletedSchema);
133-
134-
// If first attempt failed with normalize=false, try again with normalize=true
135-
if (matchingSchema == null && !normalize) {
136-
log.debug("No matching schema found with normalize = false,"
137-
+ " retrying with normalize = true");
138-
matchingSchema = schemaRegistry.lookUpSchemaUnderSubjectUsingContexts(
139-
subject, schema, true, lookupDeletedSchema);
140-
}
141-
142134
if (matchingSchema == null) {
143135
if (!schemaRegistry.hasSubjects(subject, lookupDeletedSchema)) {
144136
throw Errors.subjectNotFoundException(subject);

core/src/test/java/io/confluent/kafka/schemaregistry/rest/RestApiTest.java

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,39 +1423,6 @@ public void testSchemaNormalization() throws Exception {
14231423
assertTrue(!messages.isEmpty() && messages.get(0).contains("Invalid schema"));
14241424
}
14251425

1426-
@Test
1427-
public void testLookUpSchemaWithNormalizationRetry() throws Exception {
1428-
String subject = "testSubject";
1429-
1430-
String schemaString1 = "{\"type\":\"record\",\"name\":\"User\",\"fields\":[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"email4\",\"type\":\"string\"}]}";
1431-
1432-
// Register the original schema
1433-
TestUtils.registerAndVerifySchema(restApp.restClient, schemaString1, 1, subject);
1434-
1435-
// Same schema with different field ordering (semantically equivalent)
1436-
String schemaString2 = "{\"type\":\"record\",\"name\":\"User\",\"fields\":[{\"type\":\"int\",\"name\":\"id\"},{\"type\":\"string\",\"name\":\"email4\"}]}";
1437-
1438-
RegisterSchemaRequest request = new RegisterSchemaRequest();
1439-
request.setSchema(schemaString2);
1440-
1441-
io.confluent.kafka.schemaregistry.client.rest.entities.Schema schema =
1442-
restApp.restClient.lookUpSubjectVersion(request, subject, false, false);
1443-
assertNotNull(schema);
1444-
assertEquals(1, schema.getVersion().intValue());
1445-
1446-
// Different schema with different field name (not semantically equivalent)
1447-
String invalidSchema = "{\"type\":\"record\",\"name\":\"User\",\"fields\":[{\"type\":\"int\",\"name\":\"id\"},{\"type\":\"string\",\"name\":\"email6\"}]}";
1448-
request.setSchema(invalidSchema);
1449-
1450-
// Should fail since schemas are actually different
1451-
try {
1452-
restApp.restClient.lookUpSubjectVersion(request, subject, true, false);
1453-
fail("Should fail as schemas are not semantically equivalent");
1454-
} catch (RestClientException e) {
1455-
assertEquals(Errors.SCHEMA_NOT_FOUND_ERROR_CODE, e.getErrorCode());
1456-
}
1457-
}
1458-
14591426
@Test
14601427
public void testBad() throws Exception {
14611428
String subject1 = "testTopic1";

0 commit comments

Comments
 (0)