Skip to content

Commit d66b7cf

Browse files
authored
Deprecate apis (#4634)
* Add deprecation warning for IBM api on usage * Add CNCF api deprecation warning on usage * Add deprecation warning to ccompat v6 api
1 parent 3ab2112 commit d66b7cf

File tree

7 files changed

+70
-5
lines changed

7 files changed

+70
-5
lines changed

app/src/main/java/io/apicurio/registry/ccompat/rest/v6/impl/CompatibilityResourceImpl.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
import io.apicurio.registry.rules.UnprocessableSchemaException;
3333
import io.apicurio.registry.storage.dto.ArtifactVersionMetaDataDto;
3434
import jakarta.enterprise.context.ApplicationScoped;
35+
import jakarta.inject.Inject;
3536
import jakarta.interceptor.Interceptors;
37+
import org.slf4j.Logger;
3638

3739
import java.util.Collections;
3840
import java.util.List;
@@ -47,13 +49,16 @@
4749
@Logged
4850
public class CompatibilityResourceImpl extends AbstractResource implements CompatibilityResource {
4951

52+
@Inject
53+
Logger logger;
54+
5055
@Override
5156
@Authorized(style = AuthorizedStyle.ArtifactOnly, level = AuthorizedLevel.Write)
5257
public CompatibilityCheckResponse testCompatibilityBySubjectName(
5358
String subject,
5459
String versionString,
5560
SchemaContent request) throws Exception {
56-
61+
logger.warn("The Confluent V6 compatibility API is deprecated and will be removed in future versions");
5762
try {
5863
final List<String> versions = getStorage().getArtifactVersions(null, subject);
5964
for (String version : versions) {

app/src/main/java/io/apicurio/registry/ccompat/rest/v6/impl/ConfigResourceImpl.java

+8
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
import io.apicurio.registry.storage.dto.RuleConfigurationDto;
3434
import io.apicurio.registry.types.RuleType;
3535

36+
import jakarta.inject.Inject;
3637
import jakarta.interceptor.Interceptors;
38+
import org.slf4j.Logger;
3739

3840
import java.util.Optional;
3941
import java.util.function.Consumer;
@@ -47,6 +49,8 @@
4749
@Logged
4850
public class ConfigResourceImpl extends AbstractResource implements ConfigResource {
4951

52+
@Inject
53+
Logger logger;
5054

5155
private CompatibilityLevelParamDto getCompatibilityLevel(Supplier<String> supplyLevel) {
5256
try {
@@ -85,6 +89,7 @@ private void updateCompatibilityLevel(CompatibilityLevelDto.Level level,
8589
@Override
8690
@Authorized(style=AuthorizedStyle.None, level=AuthorizedLevel.Admin)
8791
public CompatibilityLevelParamDto getGlobalCompatibilityLevel() {
92+
logger.warn("The Confluent V6 compatibility API is deprecated and will be removed in future versions");
8893
return getCompatibilityLevel(() -> getStorage().getGlobalRule(RuleType.COMPATIBILITY).getConfiguration());
8994
}
9095

@@ -94,6 +99,7 @@ public CompatibilityLevelParamDto getGlobalCompatibilityLevel() {
9499
@Authorized(style=AuthorizedStyle.None, level=AuthorizedLevel.Admin)
95100
public CompatibilityLevelDto updateGlobalCompatibilityLevel(
96101
CompatibilityLevelDto request) {
102+
logger.warn("The Confluent V6 compatibility API is deprecated and will be removed in future versions");
97103
updateCompatibilityLevel(request.getCompatibility(),
98104
dto -> {
99105
if (!doesGlobalRuleExist(RuleType.COMPATIBILITY)) {
@@ -113,6 +119,7 @@ public CompatibilityLevelDto updateGlobalCompatibilityLevel(
113119
public CompatibilityLevelDto updateSubjectCompatibilityLevel(
114120
String subject,
115121
CompatibilityLevelDto request) {
122+
logger.warn("The Confluent V6 compatibility API is deprecated and will be removed in future versions");
116123
updateCompatibilityLevel(request.getCompatibility(),
117124
dto -> {
118125
if (!doesArtifactRuleExist(subject, RuleType.COMPATIBILITY, null)) {
@@ -134,6 +141,7 @@ public CompatibilityLevelDto updateSubjectCompatibilityLevel(
134141
@Override
135142
@Authorized(style=AuthorizedStyle.ArtifactOnly, level=AuthorizedLevel.Read)
136143
public CompatibilityLevelParamDto getSubjectCompatibilityLevel(String subject) {
144+
logger.warn("The Confluent V6 compatibility API is deprecated and will be removed in future versions");
137145
return getCompatibilityLevel(() -> getStorage().getArtifactRule(null, subject, RuleType.COMPATIBILITY).getConfiguration());
138146
}
139147
}

app/src/main/java/io/apicurio/registry/ccompat/rest/v6/impl/SchemasResourceImpl.java

+8
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
import io.apicurio.registry.storage.impl.sql.RegistryContentUtils;
3636
import io.apicurio.registry.types.ArtifactType;
3737
import io.apicurio.registry.util.ArtifactTypeUtil;
38+
import jakarta.inject.Inject;
3839
import jakarta.interceptor.Interceptors;
40+
import org.slf4j.Logger;
3941

4042
import java.util.Arrays;
4143
import java.util.Collections;
@@ -52,9 +54,13 @@
5254
@Logged
5355
public class SchemasResourceImpl extends AbstractResource implements SchemasResource {
5456

57+
@Inject
58+
Logger logger;
59+
5560
@Override
5661
@Authorized(style = AuthorizedStyle.GlobalId, level = AuthorizedLevel.Read)
5762
public SchemaInfo getSchema(int id) {
63+
logger.warn("The Confluent V6 compatibility API is deprecated and will be removed in future versions");
5864
ContentHandle contentHandle;
5965
List<ArtifactReferenceDto> references;
6066
if (getCconfig().getLegacyIdModeEnabled().get()) {
@@ -85,6 +91,7 @@ public SchemaInfo getSchema(int id) {
8591
@Override
8692
@Authorized(style = AuthorizedStyle.GlobalId, level = AuthorizedLevel.Read)
8793
public List<SubjectVersion> getSubjectVersions(int id) {
94+
logger.warn("The Confluent V6 compatibility API is deprecated and will be removed in future versions");
8895
if (getCconfig().getLegacyIdModeEnabled().get()) {
8996
ArtifactMetaDataDto artifactMetaData = getStorage().getArtifactMetaData(id);
9097
return Collections.singletonList(getConverter().convert(artifactMetaData.getId(), artifactMetaData.getVersionId()));
@@ -100,6 +107,7 @@ public List<SubjectVersion> getSubjectVersions(int id) {
100107
@Override
101108
@Authorized(style = AuthorizedStyle.None, level = AuthorizedLevel.Read)
102109
public List<String> getRegisteredTypes() {
110+
logger.warn("The Confluent V6 compatibility API is deprecated and will be removed in future versions");
103111
return Arrays.asList(ArtifactType.JSON, ArtifactType.PROTOBUF, ArtifactType.AVRO);
104112
}
105113
}

app/src/main/java/io/apicurio/registry/ccompat/rest/v6/impl/SubjectVersionsResourceImpl.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import io.apicurio.registry.types.ArtifactState;
3838
import io.apicurio.registry.util.ArtifactTypeUtil;
3939
import io.apicurio.registry.util.VersionUtil;
40+
import jakarta.inject.Inject;
4041
import jakarta.interceptor.Interceptors;
4142
import jakarta.ws.rs.BadRequestException;
4243

@@ -51,6 +52,7 @@
5152
import io.apicurio.common.apps.logging.audit.Audited;
5253
import io.apicurio.registry.metrics.health.liveness.ResponseErrorLivenessCheck;
5354
import io.apicurio.registry.metrics.health.readiness.ResponseTimeoutReadinessCheck;
55+
import org.slf4j.Logger;
5456

5557
/**
5658
* @author Ales Justin
@@ -60,17 +62,21 @@
6062
@Logged
6163
public class SubjectVersionsResourceImpl extends AbstractResource implements SubjectVersionsResource {
6264

65+
@Inject
66+
Logger logger;
6367

6468
@Override
6569
@Authorized(style=AuthorizedStyle.ArtifactOnly, level=AuthorizedLevel.Read)
6670
public List<Integer> listVersions(String subject) throws Exception {
67-
return getStorage().getArtifactVersions(null, subject).stream().map(VersionUtil::toLong).map(getConverter()::convertUnsigned).sorted().collect(Collectors.toList());
71+
logger.warn("The Confluent V6 compatibility API is deprecated and will be removed in future versions");
72+
return getStorage().getArtifactVersions(null, subject).stream().map(VersionUtil::toLong).map(getConverter()::convertUnsigned).sorted().collect(Collectors.toList());
6873
}
6974

7075
@Override
7176
@Audited(extractParameters = {"0", KEY_ARTIFACT_ID})
7277
@Authorized(style=AuthorizedStyle.ArtifactOnly, level=AuthorizedLevel.Write)
7378
public SchemaId register(String subject, SchemaInfo request) throws Exception {
79+
logger.warn("The Confluent V6 compatibility API is deprecated and will be removed in future versions");
7480
// Check to see if this content is already registered - return the global ID of that content
7581
// if it exists. If not, then register the new content.
7682
long sid = -1;
@@ -117,6 +123,7 @@ public SchemaId register(String subject, SchemaInfo request) throws Exception {
117123
public Schema getSchemaByVersion(
118124
String subject,
119125
String version) throws Exception {
126+
logger.warn("The Confluent V6 compatibility API is deprecated and will be removed in future versions");
120127
return getSchema(null, subject, version, false);
121128
}
122129

@@ -126,6 +133,7 @@ public Schema getSchemaByVersion(
126133
public int deleteSchemaVersion(
127134
String subject,
128135
String versionString) throws Exception {
136+
logger.warn("The Confluent V6 compatibility API is deprecated and will be removed in future versions");
129137
try {
130138
if (doesArtifactExist(subject, null)) {
131139

@@ -154,12 +162,14 @@ public int deleteSchemaVersion(
154162
public String getSchemaOnly(
155163
String subject,
156164
String version) throws Exception {
165+
logger.warn("The Confluent V6 compatibility API is deprecated and will be removed in future versions");
157166
return getSchema(null, subject, version, false).getSchema();
158167
}
159168

160169
@Override
161170
@Authorized(style=AuthorizedStyle.ArtifactOnly, level=AuthorizedLevel.Read)
162171
public List<Long> getSchemasReferencedBy(String subject, String versionString) throws Exception {
172+
logger.warn("The Confluent V6 compatibility API is deprecated and will be removed in future versions");
163173
if (getCconfig().getLegacyIdModeEnabled().get()) {
164174
return parseVersionString(subject, versionString, null, version -> getStorage().getGlobalIdsReferencingArtifact(null, subject, version));
165175
}

app/src/main/java/io/apicurio/registry/ccompat/rest/v6/impl/SubjectsResourceImpl.java

+8
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
import io.apicurio.registry.storage.dto.StoredArtifactDto;
3838
import io.apicurio.registry.types.ArtifactState;
3939
import io.apicurio.registry.util.VersionUtil;
40+
import jakarta.inject.Inject;
4041
import jakarta.interceptor.Interceptors;
42+
import org.slf4j.Logger;
4143

4244
import java.util.List;
4345
import java.util.Set;
@@ -53,15 +55,20 @@
5355
@Logged
5456
public class SubjectsResourceImpl extends AbstractResource implements SubjectsResource {
5557

58+
@Inject
59+
Logger logger;
60+
5661
@Override
5762
@Authorized(style = AuthorizedStyle.None, level = AuthorizedLevel.Read)
5863
public List<String> listSubjects() {
64+
logger.warn("The Confluent V6 compatibility API is deprecated and will be removed in future versions");
5965
return getStorage().searchArtifacts(Set.of(SearchFilter.ofGroup(null)), OrderBy.createdOn, OrderDirection.asc, 0, getCconfig().getMaxSubjects().get()).getArtifacts().stream().filter(searchedArtifactDto -> isCcompatManagedType(searchedArtifactDto.getType()) && shouldFilterState(false, searchedArtifactDto.getState())).map(SearchedArtifactDto::getId).collect(Collectors.toList());
6066
}
6167

6268
@Override
6369
@Authorized(style = AuthorizedStyle.ArtifactOnly, level = AuthorizedLevel.Read)
6470
public Schema findSchemaByContent(String subject, SchemaInfo request) throws Exception {
71+
logger.warn("The Confluent V6 compatibility API is deprecated and will be removed in future versions");
6572
if (doesArtifactExist(subject, null)) {
6673
try {
6774
ArtifactVersionMetaDataDto amd;
@@ -85,6 +92,7 @@ public Schema findSchemaByContent(String subject, SchemaInfo request) throws Exc
8592
@Audited(extractParameters = {"0", KEY_ARTIFACT_ID})
8693
@Authorized(style = AuthorizedStyle.ArtifactOnly, level = AuthorizedLevel.Write)
8794
public List<Integer> deleteSubject(String subject) throws Exception {
95+
logger.warn("The Confluent V6 compatibility API is deprecated and will be removed in future versions");
8896
return deleteSubjectPermanent(null, subject);
8997
}
9098

app/src/main/java/io/apicurio/registry/cncf/schemaregistry/impl/SchemagroupsResourceImpl.java

+16-1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
import jakarta.ws.rs.BadRequestException;
6767
import jakarta.ws.rs.core.Context;
6868
import jakarta.ws.rs.core.Response;
69+
import org.slf4j.Logger;
6970

7071
import static io.apicurio.registry.cncf.schemaregistry.impl.CNCFApiUtil.dtoToSchemaGroup;
7172
import static io.apicurio.registry.storage.RegistryStorage.ArtifactRetrievalBehavior.DEFAULT;
@@ -97,22 +98,28 @@ public class SchemagroupsResourceImpl implements SchemagroupsResource {
9798
@Inject
9899
ArtifactTypeUtilProviderFactory factory;
99100

101+
@Inject
102+
Logger logger;
103+
100104
@Override
101105
@Authorized(style=AuthorizedStyle.None, level=AuthorizedLevel.Read)
102106
public List<String> getGroups() {
107+
logger.warn("The CNCF Schema Registry API is deprecated and will be removed in future versions");
103108
return storage.getGroupIds(GET_GROUPS_LIMIT);
104109
}
105110

106111
@Override
107112
@Authorized(style=AuthorizedStyle.GroupAndArtifact, level=AuthorizedLevel.Read)
108113
public SchemaGroup getGroup(String groupId) {
114+
logger.warn("The CNCF Schema Registry API is deprecated and will be removed in future versions");
109115
GroupMetaDataDto group = storage.getGroupMetaData(groupId);
110116
return dtoToSchemaGroup(group);
111117
}
112118

113119
@Override
114120
@Authorized(style=AuthorizedStyle.None, level=AuthorizedLevel.Write)
115121
public void createGroup(String groupId, SchemaGroup data) {
122+
logger.warn("The CNCF Schema Registry API is deprecated and will be removed in future versions");
116123
//createdOn and modifiedOn are set by the storage
117124
GroupMetaDataDto.GroupMetaDataDtoBuilder group = GroupMetaDataDto.builder()
118125
.groupId(groupId)
@@ -142,12 +149,14 @@ public void createGroup(String groupId, SchemaGroup data) {
142149
@Override
143150
@Authorized(style=AuthorizedStyle.GroupOnly, level=AuthorizedLevel.Write)
144151
public void deleteGroup(String groupId) {
152+
logger.warn("The CNCF Schema Registry API is deprecated and will be removed in future versions");
145153
storage.deleteGroup(groupId);
146154
}
147155

148156
@Override
149157
@Authorized(style=AuthorizedStyle.GroupOnly, level=AuthorizedLevel.Read)
150158
public List<String> getSchemasByGroup(String groupId) {
159+
logger.warn("The CNCF Schema Registry API is deprecated and will be removed in future versions");
151160
verifyGroupExists(groupId);
152161
Set<SearchFilter> filters = new HashSet<>();
153162
filters.add(SearchFilter.ofGroup(groupId));
@@ -163,13 +172,15 @@ public List<String> getSchemasByGroup(String groupId) {
163172
@Override
164173
@Authorized(style=AuthorizedStyle.GroupOnly, level=AuthorizedLevel.Write)
165174
public void deleteSchemasByGroup(String groupId) {
175+
logger.warn("The CNCF Schema Registry API is deprecated and will be removed in future versions");
166176
verifyGroupExists(groupId);
167177
storage.deleteArtifacts(groupId);
168178
}
169179

170180
@Override
171181
@Authorized(style=AuthorizedStyle.GroupAndArtifact, level=AuthorizedLevel.Read)
172182
public Response getLatestSchema(String groupId, String schemaId) {
183+
logger.warn("The CNCF Schema Registry API is deprecated and will be removed in future versions");
173184
verifyGroupExists(groupId);
174185
StoredArtifactDto artifact = storage.getArtifact(groupId, schemaId);
175186

@@ -183,7 +194,7 @@ public Response getLatestSchema(String groupId, String schemaId) {
183194
@Override
184195
@Authorized(style=AuthorizedStyle.GroupAndArtifact, level=AuthorizedLevel.Write)
185196
public SchemaId createSchema(String groupId, String schemaId, InputStream data) {
186-
197+
logger.warn("The CNCF Schema Registry API is deprecated and will be removed in future versions");
187198
ContentHandle content = ContentHandle.create(data);
188199
if (content.bytes().length == 0) {
189200
throw new BadRequestException("Error: Empty content");
@@ -244,13 +255,15 @@ public SchemaId createSchema(String groupId, String schemaId, InputStream data)
244255
@Override
245256
@Authorized(style=AuthorizedStyle.GroupAndArtifact, level=AuthorizedLevel.Write)
246257
public void deleteSchema(String groupId, String schemaId) {
258+
logger.warn("The CNCF Schema Registry API is deprecated and will be removed in future versions");
247259
verifyGroupExists(groupId);
248260
storage.deleteArtifact(groupId, schemaId);
249261
}
250262

251263
@Override
252264
@Authorized(style=AuthorizedStyle.GroupAndArtifact, level=AuthorizedLevel.Read)
253265
public List<Integer> getSchemaVersions(String groupId, String schemaId) {
266+
logger.warn("The CNCF Schema Registry API is deprecated and will be removed in future versions");
254267
verifyGroupExists(groupId);
255268
return storage.getArtifactVersions(groupId, schemaId).stream()
256269
.map(v -> Long.valueOf(v).intValue())
@@ -260,6 +273,7 @@ public List<Integer> getSchemaVersions(String groupId, String schemaId) {
260273
@Override
261274
@Authorized(style=AuthorizedStyle.GroupAndArtifact, level=AuthorizedLevel.Read)
262275
public Response getSchemaVersion(String groupId, String schemaId, Integer versionNumber) {
276+
logger.warn("The CNCF Schema Registry API is deprecated and will be removed in future versions");
263277
verifyGroupExists(groupId);
264278
StoredArtifactDto artifact = storage.getArtifactVersion(groupId, schemaId, VersionUtil.toString(versionNumber));
265279

@@ -272,6 +286,7 @@ public Response getSchemaVersion(String groupId, String schemaId, Integer versio
272286
@Override
273287
@Authorized(style=AuthorizedStyle.GroupAndArtifact, level=AuthorizedLevel.Write)
274288
public void deleteSchemaVersion(String groupId, String schemaId, Integer versionNumber) {
289+
logger.warn("The CNCF Schema Registry API is deprecated and will be removed in future versions");
275290
verifyGroupExists(groupId);
276291
storage.deleteArtifactVersion(groupId, schemaId, VersionUtil.toString(versionNumber));
277292
}

0 commit comments

Comments
 (0)