Skip to content

Commit

Permalink
allegro#1569 | Changed default value of schema.repository.deleteSchem…
Browse files Browse the repository at this point in the history
…aPathSuffix to empty string. This has been done to make requests to default Confluent schema registry match its delete url.
  • Loading branch information
adriansobolewski committed Oct 18, 2023
1 parent 4e9f8c7 commit f8fa305
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
18 changes: 9 additions & 9 deletions docs/docs/configuration/schema-repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ Option | Description

### Management

Option | Description | Default value
---------------------------------------- | ------------------------------------------------------------------ | -------------
schema.repository.serverUrl | URL of a repository | `http://localhost:8888/`
schema.repository.validationEnabled | Allows to use validation API in schema repository | `false`
schema.repository.connectionTimeoutMillis| Connection timeout used in http client (specified in milliseconds) | 1000
schema.repository.socketTimeoutMillis | Read socket timeout used in http client (specified in milliseconds)| 3000
schema.repository.deleteSchemaPathSuffix | A suffix of the URL to delete all schema versions: `/subjects/{subject}/{deleteSchemaPathSuffix}| `versions`
schema.repository.subjectSuffixEnabled | Add `-value` suffix to every subject name | `false`
schema.repository.subjectNamespaceEnabled| Add `kafka.defaultNamespace` property value as a prefix to every subject name | `false`
Option | Description | Default value
---------------------------------------- |----------------------------------------------------------------------------------------------------| -------------
schema.repository.serverUrl | URL of a repository | `http://localhost:8888/`
schema.repository.validationEnabled | Allows to use validation API in schema repository | `false`
schema.repository.connectionTimeoutMillis| Connection timeout used in http client (specified in milliseconds) | 1000
schema.repository.socketTimeoutMillis | Read socket timeout used in http client (specified in milliseconds) | 3000
schema.repository.deleteSchemaPathSuffix | A suffix of the URL to delete all schema versions: `/subjects/{subject}/{deleteSchemaPathSuffix}` | `""`
schema.repository.subjectSuffixEnabled | Add `-value` suffix to every subject name | `false`
schema.repository.subjectNamespaceEnabled| Add `kafka.defaultNamespace` property value as a prefix to every subject name | `false`

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class SchemaRepositoryProperties {
private int connectionTimeoutMillis = 1000;

private int socketTimeoutMillis = 3000;
private String deleteSchemaPathSuffix = "versions";
private String deleteSchemaPathSuffix = "";

private boolean subjectSuffixEnabled = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

/**
* This implementation of RawSchemaClient is compatible with Confluent Schema Registry API
* except for the deleteAllSchemaVersions and validation endpoint which are not fully supported by the Confluent project.
* except for the validation endpoint which is not fully supported by the Confluent project.
*/
public class SchemaRegistryRawSchemaClient implements RawSchemaClient {

Expand All @@ -48,7 +48,7 @@ public class SchemaRegistryRawSchemaClient implements RawSchemaClient {
public SchemaRegistryRawSchemaClient(SchemaRepositoryInstanceResolver schemaRepositoryInstanceResolver,
ObjectMapper objectMapper,
SubjectNamingStrategy subjectNamingStrategy) {
this(schemaRepositoryInstanceResolver, objectMapper, false, "versions", subjectNamingStrategy);
this(schemaRepositoryInstanceResolver, objectMapper, false, "", subjectNamingStrategy);
}

public SchemaRegistryRawSchemaClient(SchemaRepositoryInstanceResolver schemaRepositoryInstanceResolver,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,13 @@ class SchemaRegistryRawSchemaClientTest extends Specification {

def "should delete all schema versions"() {
given:
wireMock.stubFor(WireMock.delete(versionsUrl(topicName, subjectNamingStrategy)).willReturn(okResponse()))
wireMock.stubFor(WireMock.delete(deleteUrl(topicName, subjectNamingStrategy)).willReturn(okResponse()))

when:
client.deleteAllSchemaVersions(topicName)

then:
wireMock.verify(1, deleteRequestedFor(versionsUrl(topicName, subjectNamingStrategy)))
wireMock.verify(1, deleteRequestedFor(deleteUrl(topicName, subjectNamingStrategy)))

where:
client << clients
Expand Down Expand Up @@ -409,6 +409,10 @@ class SchemaRegistryRawSchemaClientTest extends Specification {
urlEqualTo("/subjects/${subjectNamingStrategy.apply(topic)}/versions")
}

private UrlPattern deleteUrl(TopicName topic, SubjectNamingStrategy subjectNamingStrategy) {
urlEqualTo("/subjects/${subjectNamingStrategy.apply(topic)}")
}

private UrlPattern schemaVersionUrl(TopicName topic, int version, SubjectNamingStrategy subjectNamingStrategy) {
urlEqualTo("/subjects/${subjectNamingStrategy.apply(topic)}/versions/$version")
}
Expand Down

0 comments on commit f8fa305

Please sign in to comment.