diff --git a/app/src/main/java/io/apicurio/registry/ccompat/rest/v7/impl/CompatibilityResourceImpl.java b/app/src/main/java/io/apicurio/registry/ccompat/rest/v7/impl/CompatibilityResourceImpl.java index 285af14e42..b440c32d80 100644 --- a/app/src/main/java/io/apicurio/registry/ccompat/rest/v7/impl/CompatibilityResourceImpl.java +++ b/app/src/main/java/io/apicurio/registry/ccompat/rest/v7/impl/CompatibilityResourceImpl.java @@ -31,7 +31,7 @@ public CompatibilityCheckResponse testCompatibilityBySubjectName(String subject, final List versions = storage.getArtifactVersions(groupId, subject); for (String version : versions) { final ArtifactVersionMetaDataDto artifactVersionMetaData = storage.getArtifactVersionMetaData(groupId, subject, version); - rulesService.applyRules(groupId, subject, version, artifactVersionMetaData.getType(), ContentHandle.create(request.getSchema()), Collections.emptyList(), Collections.emptyMap()); + rulesService.applyRules(groupId, subject, version, artifactVersionMetaData.getArtifactType(), ContentHandle.create(request.getSchema()), Collections.emptyList(), Collections.emptyMap()); } return CompatibilityCheckResponse.IS_COMPATIBLE; } catch (RuleViolationException ex) { @@ -53,7 +53,7 @@ public CompatibilityCheckResponse testCompatibilityByVersion(String subject, Str return parseVersionString(subject, versionString, groupId, v -> { try { final ArtifactVersionMetaDataDto artifact = storage.getArtifactVersionMetaData(groupId, subject, v); - rulesService.applyRules(groupId, subject, v, artifact.getType(), ContentHandle.create(request.getSchema()), Collections.emptyList(), Collections.emptyMap()); + rulesService.applyRules(groupId, subject, v, artifact.getArtifactType(), ContentHandle.create(request.getSchema()), Collections.emptyList(), Collections.emptyMap()); return CompatibilityCheckResponse.IS_COMPATIBLE; } catch (RuleViolationException ex) { if (fverbose) { diff --git a/app/src/main/java/io/apicurio/registry/ccompat/rest/v7/impl/SubjectVersionsResourceImpl.java b/app/src/main/java/io/apicurio/registry/ccompat/rest/v7/impl/SubjectVersionsResourceImpl.java index 1d7892bacd..bc984f7185 100644 --- a/app/src/main/java/io/apicurio/registry/ccompat/rest/v7/impl/SubjectVersionsResourceImpl.java +++ b/app/src/main/java/io/apicurio/registry/ccompat/rest/v7/impl/SubjectVersionsResourceImpl.java @@ -186,7 +186,7 @@ protected Schema getSchema(String groupId, String subject, String versionString, ArtifactVersionMetaDataDto amd = storage.getArtifactVersionMetaData(groupId, subject, version); if (amd.getState() != VersionState.DISABLED || deleted) { StoredArtifactVersionDto storedArtifact = storage.getArtifactVersionContent(groupId, subject, amd.getVersion()); - return converter.convert(subject, storedArtifact, amd.getType()); + return converter.convert(subject, storedArtifact, amd.getArtifactType()); } else { throw new VersionNotFoundException(groupId, subject, version); } diff --git a/app/src/main/java/io/apicurio/registry/ccompat/rest/v7/impl/SubjectsResourceImpl.java b/app/src/main/java/io/apicurio/registry/ccompat/rest/v7/impl/SubjectsResourceImpl.java index f95bfbf91c..6b759b54a7 100644 --- a/app/src/main/java/io/apicurio/registry/ccompat/rest/v7/impl/SubjectsResourceImpl.java +++ b/app/src/main/java/io/apicurio/registry/ccompat/rest/v7/impl/SubjectsResourceImpl.java @@ -44,14 +44,14 @@ public class SubjectsResourceImpl extends AbstractResource implements SubjectsRe public List listSubjects(String subjectPrefix, Boolean deleted, String groupId) { //Since contexts are not supported, subjectPrefix is not used final boolean fdeleted = deleted == null ? Boolean.FALSE : deleted; - Set filters = new HashSet<>(Set.of(SearchFilter.ofGroup(groupId))); + Set filters = new HashSet<>(Set.of(SearchFilter.ofGroupId(groupId))); if (!fdeleted) { filters.add(SearchFilter.ofState(VersionState.DISABLED).negated()); } ArtifactSearchResultsDto searchResults = storage.searchArtifacts(filters, OrderBy.createdOn, OrderDirection.asc, 0, cconfig.maxSubjects.get()); return searchResults.getArtifacts().stream() - .filter(searchedArtifactDto -> isCcompatManagedType(searchedArtifactDto.getType()) /* && shouldFilterState(fdeleted, searchedArtifactDto.getState())*/) + .filter(searchedArtifactDto -> isCcompatManagedType(searchedArtifactDto.getArtifactType()) /* && shouldFilterState(fdeleted, searchedArtifactDto.getState())*/) .map(SearchedArtifactDto::getArtifactId) .collect(Collectors.toList()); } diff --git a/app/src/main/java/io/apicurio/registry/rest/v2/GroupsResourceImpl.java b/app/src/main/java/io/apicurio/registry/rest/v2/GroupsResourceImpl.java index fd2304a334..ea0ec0d76d 100644 --- a/app/src/main/java/io/apicurio/registry/rest/v2/GroupsResourceImpl.java +++ b/app/src/main/java/io/apicurio/registry/rest/v2/GroupsResourceImpl.java @@ -156,7 +156,7 @@ public class GroupsResourceImpl extends AbstractResourceImpl implements GroupsRe io.apicurio.registry.rest.v3.GroupsResourceImpl v3; /** - * @see io.apicurio.registry.rest.v2.GroupsResource#getLatestArtifact(java.lang.String, java.lang.String, boolean) + * @see io.apicurio.registry.rest.v2.GroupsResource#getLatestArtifact(java.lang.String, java.lang.String, Boolean) */ @Override @Authorized(style = AuthorizedStyle.GroupAndArtifact, level = AuthorizedLevel.Read) @@ -173,10 +173,10 @@ public Response getLatestArtifact(String groupId, String artifactId, Boolean der ArtifactVersionMetaDataDto metaData = storage.getArtifactVersionMetaData(latestGAV.getRawGroupIdWithNull(), latestGAV.getRawArtifactId(), latestGAV.getRawVersionId()); StoredArtifactVersionDto artifact = storage.getArtifactVersionContent(defaultGroupIdToNull(groupId), artifactId, latestGAV.getRawVersionId()); - MediaType contentType = factory.getArtifactMediaType(metaData.getType()); + MediaType contentType = factory.getArtifactMediaType(metaData.getArtifactType()); ContentHandle contentToReturn = artifact.getContent(); - contentToReturn = handleContentReferences(dereference, metaData.getType(), contentToReturn, artifact.getReferences()); + contentToReturn = handleContentReferences(dereference, metaData.getArtifactType(), contentToReturn, artifact.getReferences()); Response.ResponseBuilder builder = Response.ok(contentToReturn, contentType); checkIfDeprecated(metaData::getState, groupId, artifactId, metaData.getVersion(), builder); @@ -272,7 +272,7 @@ public ArtifactMetaData getArtifactMetaData(String groupId, String artifactId) { GAV latestGAV = storage.getArtifactBranchTip(new GA(groupId, artifactId), BranchId.LATEST, ArtifactRetrievalBehavior.SKIP_DISABLED_LATEST); ArtifactVersionMetaDataDto vdto = storage.getArtifactVersionMetaData(latestGAV.getRawGroupIdWithNull(), latestGAV.getRawArtifactId(), latestGAV.getRawVersionId()); - ArtifactMetaData amd = V2ApiUtil.dtoToMetaData(defaultGroupIdToNull(groupId), artifactId, dto.getType(), dto); + ArtifactMetaData amd = V2ApiUtil.dtoToMetaData(defaultGroupIdToNull(groupId), artifactId, dto.getArtifactType(), dto); amd.setContentId(vdto.getContentId()); amd.setGlobalId(vdto.getGlobalId()); amd.setVersion(vdto.getVersion()); @@ -415,7 +415,7 @@ private VersionMetaData getArtifactVersionMetaDataByContent(String groupId, Stri final List artifactReferenceDtos = toReferenceDtos(artifactReferences); ArtifactVersionMetaDataDto dto = storage.getArtifactVersionMetaDataByContent(defaultGroupIdToNull(groupId), artifactId, canonical, content, artifactReferenceDtos); - return V2ApiUtil.dtoToVersionMetaData(defaultGroupIdToNull(groupId), artifactId, dto.getType(), dto); + return V2ApiUtil.dtoToVersionMetaData(defaultGroupIdToNull(groupId), artifactId, dto.getArtifactType(), dto); } /** @@ -579,10 +579,10 @@ public Response getArtifactVersion(String groupId, String artifactId, String ver } StoredArtifactVersionDto artifact = storage.getArtifactVersionContent(defaultGroupIdToNull(groupId), artifactId, version); - MediaType contentType = factory.getArtifactMediaType(metaData.getType()); + MediaType contentType = factory.getArtifactMediaType(metaData.getArtifactType()); ContentHandle contentToReturn = artifact.getContent(); - contentToReturn = handleContentReferences(dereference, metaData.getType(), contentToReturn, artifact.getReferences()); + contentToReturn = handleContentReferences(dereference, metaData.getArtifactType(), contentToReturn, artifact.getReferences()); Response.ResponseBuilder builder = Response.ok(contentToReturn, contentType); checkIfDeprecated(metaData::getState, groupId, artifactId, version, builder); @@ -617,7 +617,7 @@ public VersionMetaData getArtifactVersionMetaData(String groupId, String artifac requireParameter("version", version); ArtifactVersionMetaDataDto dto = storage.getArtifactVersionMetaData(defaultGroupIdToNull(groupId), artifactId, version); - return V2ApiUtil.dtoToVersionMetaData(defaultGroupIdToNull(groupId), artifactId, dto.getType(), dto); + return V2ApiUtil.dtoToVersionMetaData(defaultGroupIdToNull(groupId), artifactId, dto.getArtifactType(), dto); } /** @@ -754,7 +754,7 @@ public ArtifactSearchResults listArtifactsInGroup(String groupId, BigInteger lim final OrderDirection oDir = order == null || order == SortOrder.asc ? OrderDirection.asc : OrderDirection.desc; Set filters = new HashSet<>(); - filters.add(SearchFilter.ofGroup(defaultGroupIdToNull(groupId))); + filters.add(SearchFilter.ofGroupId(defaultGroupIdToNull(groupId))); ArtifactSearchResultsDto resultsDto = storage.searchArtifacts(filters, oBy, oDir, offset.intValue(), limit.intValue()); return V2ApiUtil.dtoToSearchResults(resultsDto); @@ -1005,6 +1005,9 @@ public VersionSearchResults listArtifactVersions(String groupId, String artifact requireParameter("groupId", groupId); requireParameter("artifactId", artifactId); + // This will check if the artifact exists (throws 404 if not). + storage.getArtifactMetaData(defaultGroupIdToNull(groupId), artifactId); + if (offset == null) { offset = BigInteger.valueOf(0); } @@ -1012,8 +1015,11 @@ public VersionSearchResults listArtifactVersions(String groupId, String artifact limit = BigInteger.valueOf(20); } - VersionSearchResultsDto resultsDto = storage.searchVersions(defaultGroupIdToNull(groupId), - artifactId, OrderBy.createdOn, OrderDirection.asc, offset.intValue(), limit.intValue()); + Set filters = Set.of( + SearchFilter.ofGroupId(defaultGroupIdToNull(groupId)), + SearchFilter.ofArtifactId(artifactId) + ); + VersionSearchResultsDto resultsDto = storage.searchVersions(filters, OrderBy.createdOn, OrderDirection.asc, offset.intValue(), limit.intValue()); return V2ApiUtil.dtoToSearchResults(resultsDto); } @@ -1116,7 +1122,7 @@ private void checkIfDeprecated(Supplier stateSupplier, String grou * @param artifactId */ private String lookupArtifactType(String groupId, String artifactId) { - return storage.getArtifactMetaData(defaultGroupIdToNull(groupId), artifactId).getType(); + return storage.getArtifactMetaData(defaultGroupIdToNull(groupId), artifactId).getArtifactType(); } /** diff --git a/app/src/main/java/io/apicurio/registry/rest/v2/IdsResourceImpl.java b/app/src/main/java/io/apicurio/registry/rest/v2/IdsResourceImpl.java index a26c4a976c..65c69e4175 100644 --- a/app/src/main/java/io/apicurio/registry/rest/v2/IdsResourceImpl.java +++ b/app/src/main/java/io/apicurio/registry/rest/v2/IdsResourceImpl.java @@ -1,9 +1,5 @@ package io.apicurio.registry.rest.v2; -import java.util.List; -import java.util.function.Supplier; -import java.util.stream.Collectors; - import io.apicurio.common.apps.logging.Logged; import io.apicurio.registry.auth.Authorized; import io.apicurio.registry.auth.AuthorizedLevel; @@ -28,6 +24,10 @@ import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; +import java.util.List; +import java.util.function.Supplier; +import java.util.stream.Collectors; + @ApplicationScoped @Interceptors({ResponseErrorLivenessCheck.class, ResponseTimeoutReadinessCheck.class}) @Logged @@ -52,7 +52,7 @@ public Response getContentById(long contentId) { } /** - * @see io.apicurio.registry.rest.v2.IdsResource#getContentByGlobalId(long, io.apicurio.registry.rest.v2.beans.HandleReferencesType) + * @see io.apicurio.registry.rest.v2.IdsResource#getContentByGlobalId(long, Boolean) */ @Override @Authorized(style = AuthorizedStyle.GlobalId, level = AuthorizedLevel.Read) @@ -68,10 +68,10 @@ public Response getContentByGlobalId(long globalId, Boolean dereference) { StoredArtifactVersionDto artifact = storage.getArtifactVersionContent(globalId); - MediaType contentType = factory.getArtifactMediaType(metaData.getType()); + MediaType contentType = factory.getArtifactMediaType(metaData.getArtifactType()); ContentHandle contentToReturn = artifact.getContent(); - handleContentReferences(dereference, metaData.getType(), contentToReturn, artifact.getReferences()); + handleContentReferences(dereference, metaData.getArtifactType(), contentToReturn, artifact.getReferences()); Response.ResponseBuilder builder = Response.ok(contentToReturn, contentType); checkIfDeprecated(metaData::getState, metaData.getArtifactId(), metaData.getVersion(), builder); diff --git a/app/src/main/java/io/apicurio/registry/rest/v2/SearchResourceImpl.java b/app/src/main/java/io/apicurio/registry/rest/v2/SearchResourceImpl.java index 619d06f108..993f8c7b64 100644 --- a/app/src/main/java/io/apicurio/registry/rest/v2/SearchResourceImpl.java +++ b/app/src/main/java/io/apicurio/registry/rest/v2/SearchResourceImpl.java @@ -1,28 +1,11 @@ package io.apicurio.registry.rest.v2; -import java.io.InputStream; -import java.math.BigInteger; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.interceptor.Interceptors; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.ws.rs.BadRequestException; -import jakarta.ws.rs.core.Context; - -import org.apache.commons.codec.digest.DigestUtils; -import org.slf4j.Logger; - +import io.apicurio.common.apps.logging.Logged; import io.apicurio.registry.auth.Authorized; import io.apicurio.registry.auth.AuthorizedLevel; import io.apicurio.registry.auth.AuthorizedStyle; import io.apicurio.registry.content.ContentHandle; import io.apicurio.registry.content.canon.ContentCanonicalizer; -import io.apicurio.common.apps.logging.Logged; import io.apicurio.registry.metrics.health.liveness.ResponseErrorLivenessCheck; import io.apicurio.registry.metrics.health.readiness.ResponseTimeoutReadinessCheck; import io.apicurio.registry.rest.v2.beans.ArtifactSearchResults; @@ -38,6 +21,21 @@ import io.apicurio.registry.types.provider.ArtifactTypeUtilProviderFactory; import io.apicurio.registry.util.ContentTypeUtil; import io.apicurio.registry.utils.StringUtil; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.interceptor.Interceptors; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.ws.rs.BadRequestException; +import jakarta.ws.rs.core.Context; +import org.apache.commons.codec.digest.DigestUtils; +import org.slf4j.Logger; + +import java.io.InputStream; +import java.math.BigInteger; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; @ApplicationScoped @Interceptors({ResponseErrorLivenessCheck.class, ResponseTimeoutReadinessCheck.class}) @@ -61,7 +59,7 @@ public class SearchResourceImpl implements SearchResource { HttpServletRequest request; /** - * @see io.apicurio.registry.rest.v2.SearchResource#searchArtifacts(java.lang.String, java.lang.Integer, java.lang.Integer, io.apicurio.registry.rest.v2.beans.SortOrder, io.apicurio.registry.rest.v2.beans.SortBy, java.util.List, java.util.List, java.lang.String, java.lang.String, java.lang.Long, java.lang.Long) + * @see io.apicurio.registry.rest.v2.SearchResource#searchArtifacts(String, BigInteger, BigInteger, SortOrder, SortBy, List, List, String, String, Long, Long) */ @Override @Authorized(style=AuthorizedStyle.None, level=AuthorizedLevel.Read) @@ -90,7 +88,7 @@ public ArtifactSearchResults searchArtifacts(String name, BigInteger offset, Big filters.add(SearchFilter.ofDescription(description)); } if (!StringUtil.isEmpty(group)) { - filters.add(SearchFilter.ofGroup(gidOrNull(group))); + filters.add(SearchFilter.ofGroupId(gidOrNull(group))); } if (properties != null && !properties.isEmpty()) { @@ -128,7 +126,7 @@ public ArtifactSearchResults searchArtifacts(String name, BigInteger offset, Big } /** - * @see io.apicurio.registry.rest.v2.SearchResource#searchArtifactsByContent(java.lang.Boolean, io.apicurio.registry.types.ArtifactType, java.lang.Integer, java.lang.Integer, io.apicurio.registry.rest.v2.beans.SortOrder, io.apicurio.registry.rest.v2.beans.SortBy, java.io.InputStream) + * @see io.apicurio.registry.rest.v2.SearchResource#searchArtifactsByContent(Boolean, String, BigInteger, BigInteger, SortOrder, SortBy, InputStream) */ @Override @Authorized(style=AuthorizedStyle.None, level=AuthorizedLevel.Read) diff --git a/app/src/main/java/io/apicurio/registry/rest/v2/V2ApiUtil.java b/app/src/main/java/io/apicurio/registry/rest/v2/V2ApiUtil.java index 9047ae6c29..d83548374a 100644 --- a/app/src/main/java/io/apicurio/registry/rest/v2/V2ApiUtil.java +++ b/app/src/main/java/io/apicurio/registry/rest/v2/V2ApiUtil.java @@ -66,7 +66,7 @@ public static ArtifactMetaData dtoToMetaData(String groupId, String artifactId, if (artifactType != null) { metaData.setType(artifactType); } else { - metaData.setType(dto.getType()); + metaData.setType(dto.getArtifactType()); } metaData.setState(ArtifactState.ENABLED); // TODO artifact state has gone away from the storage layer metaData.setLabels(toV2Labels(dto.getLabels())); @@ -152,7 +152,7 @@ public static ArtifactMetaData dtoToMetaData(String groupId, String artifactId, if (artifactType != null) { metaData.setType(artifactType); } else { - metaData.setType(dto.getType()); + metaData.setType(dto.getArtifactType()); } metaData.setVersion(dto.getVersion()); metaData.setGlobalId(dto.getGlobalId()); @@ -265,7 +265,7 @@ public static ArtifactSearchResults dtoToSearchResults(ArtifactSearchResultsDto sa.setModifiedOn(artifact.getModifiedOn()); sa.setName(artifact.getName()); sa.setState(ArtifactState.ENABLED); - sa.setType(artifact.getType()); + sa.setType(artifact.getArtifactType()); results.getArtifacts().add(sa); }); return results; @@ -301,7 +301,7 @@ public static VersionSearchResults dtoToSearchResults(VersionSearchResultsDto dt sv.setContentId(version.getContentId()); sv.setName(version.getName()); sv.setState(ArtifactState.fromValue(version.getState().name())); - sv.setType(version.getType()); + sv.setType(version.getArtifactType()); sv.setVersion(version.getVersion()); results.getVersions().add(sv); }); diff --git a/app/src/main/java/io/apicurio/registry/rest/v3/GroupsResourceImpl.java b/app/src/main/java/io/apicurio/registry/rest/v3/GroupsResourceImpl.java index cbfee54882..56d10b59bd 100644 --- a/app/src/main/java/io/apicurio/registry/rest/v3/GroupsResourceImpl.java +++ b/app/src/main/java/io/apicurio/registry/rest/v3/GroupsResourceImpl.java @@ -39,7 +39,6 @@ import io.apicurio.registry.rest.v3.beans.NewComment; import io.apicurio.registry.rest.v3.beans.Rule; import io.apicurio.registry.rest.v3.beans.SortOrder; -import io.apicurio.registry.rest.v3.beans.VersionContent; import io.apicurio.registry.rest.v3.beans.VersionMetaData; import io.apicurio.registry.rest.v3.beans.VersionSearchResults; import io.apicurio.registry.rest.v3.beans.VersionSortBy; @@ -74,9 +73,7 @@ import io.apicurio.registry.types.VersionState; import io.apicurio.registry.util.ArtifactIdGenerator; import io.apicurio.registry.util.ArtifactTypeUtil; -import io.apicurio.registry.util.ContentTypeUtil; import io.apicurio.registry.utils.ArtifactIdValidator; -import io.apicurio.registry.utils.IoUtil; import io.quarkus.security.identity.SecurityIdentity; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; @@ -285,42 +282,6 @@ public GroupMetaData createGroup(CreateGroup data) { return V3ApiUtil.groupDtoToGroup(storage.getGroupMetaData(data.getGroupId())); } - @Override - @Authorized(style = AuthorizedStyle.GroupAndArtifact, level = AuthorizedLevel.Read) - public VersionMetaData getArtifactVersionMetaDataByContent(String groupId, String artifactId, Boolean canonical, VersionContent artifactContent) { - return getArtifactVersionMetaDataByContent(groupId, artifactId, canonical, IoUtil.toStream(artifactContent.getContent()), artifactContent.getReferences()); - } - - /** - * @see io.apicurio.registry.rest.v3.GroupsResource#getArtifactVersionMetaDataByContent(java.lang.String, java.lang.String, java.lang.Boolean, java.io.InputStream) - */ - @Override - @Authorized(style = AuthorizedStyle.GroupAndArtifact, level = AuthorizedLevel.Read) - public VersionMetaData getArtifactVersionMetaDataByContent(String groupId, String artifactId, Boolean canonical, InputStream data) { - return getArtifactVersionMetaDataByContent(groupId, artifactId, canonical, data, Collections.emptyList()); - } - - private VersionMetaData getArtifactVersionMetaDataByContent(String groupId, String artifactId, Boolean canonical, InputStream data, List artifactReferences) { - requireParameter("groupId", groupId); - requireParameter("artifactId", artifactId); - - if (canonical == null) { - canonical = Boolean.FALSE; - } - ContentHandle content = ContentHandle.create(data); - if (content.bytes().length == 0) { - throw new BadRequestException(EMPTY_CONTENT_ERROR_MESSAGE); - } - if (ContentTypeUtil.isApplicationYaml(getContentType())) { - content = ContentTypeUtil.yamlToJson(content); - } - - final List artifactReferenceDtos = toReferenceDtos(artifactReferences); - - ArtifactVersionMetaDataDto dto = storage.getArtifactVersionMetaDataByContent(new GroupId(groupId).getRawGroupIdWithNull(), artifactId, canonical, content, artifactReferenceDtos); - return V3ApiUtil.dtoToVersionMetaData(dto); - } - /** * @see io.apicurio.registry.rest.v3.GroupsResource#listArtifactRules(java.lang.String, java.lang.String) */ @@ -447,7 +408,7 @@ public Response getArtifactVersionContent(String groupId, String artifactId, Str StoredArtifactVersionDto artifact = storage.getArtifactVersionContent(gav.getRawGroupIdWithNull(), gav.getRawArtifactId(), gav.getRawVersionId()); ContentHandle contentToReturn = artifact.getContent(); - contentToReturn = handleContentReferences(references, metaData.getType(), contentToReturn, artifact.getReferences()); + contentToReturn = handleContentReferences(references, metaData.getArtifactType(), contentToReturn, artifact.getReferences()); Response.ResponseBuilder builder = Response.ok(contentToReturn, artifact.getContentType()); checkIfDeprecated(metaData::getState, groupId, artifactId, versionExpression, builder); @@ -609,7 +570,7 @@ public ArtifactSearchResults listArtifactsInGroup(String groupId, BigInteger lim final OrderDirection oDir = order == null || order == SortOrder.asc ? OrderDirection.asc : OrderDirection.desc; Set filters = new HashSet<>(); - filters.add(SearchFilter.ofGroup(new GroupId(groupId).getRawGroupIdWithNull())); + filters.add(SearchFilter.ofGroupId(new GroupId(groupId).getRawGroupIdWithNull())); ArtifactSearchResultsDto resultsDto = storage.searchArtifacts(filters, oBy, oDir, offset.intValue(), limit.intValue()); return V3ApiUtil.dtoToSearchResults(resultsDto); @@ -684,7 +645,7 @@ public CreateArtifactResponse createArtifact(String groupId, IfArtifactExists if throw new InvalidArtifactIdException(ArtifactIdValidator.ARTIFACT_ID_ERROR_MESSAGE); } - String artifactType = ArtifactTypeUtil.determineArtifactType(content, data.getType(), contentType, factory.getAllArtifactTypes()); + String artifactType = ArtifactTypeUtil.determineArtifactType(content, data.getArtifactType(), contentType, factory.getAllArtifactTypes()); // Convert references to DTOs final List referencesAsDtos = toReferenceDtos(references); @@ -695,11 +656,6 @@ public CreateArtifactResponse createArtifact(String groupId, IfArtifactExists if // Apply any configured rules rulesService.applyRules(new GroupId(groupId).getRawGroupIdWithNull(), artifactId, artifactType, content, RuleApplicationType.CREATE, references, resolvedReferences); -// EditableArtifactMetaDataDto metaData = getEditableArtifactMetaData(artifactName, artifactDescription); - -// ArtifactVersionMetaDataDto vmd = storage.createArtifactWithMetadata(new GroupId(groupId).getRawGroupIdWithNull(), artifactId, -// xRegistryVersion, artifactType, content, metaData, referencesAsDtos); - // Create the artifact (with optional first version) EditableArtifactMetaDataDto artifactMetaData = EditableArtifactMetaDataDto.builder() .description(data.getDescription()) @@ -738,7 +694,7 @@ public CreateArtifactResponse createArtifact(String groupId, IfArtifactExists if .name(artifactMetaData.getName()) .description(artifactMetaData.getDescription()) .labels(artifactMetaData.getLabels()) - .type(artifactType) + .artifactType(artifactType) .build()) .build(); } @@ -782,11 +738,19 @@ public VersionSearchResults listArtifactVersions(String groupId, String artifact limit = BigInteger.valueOf(20); } + GroupId gid = new GroupId(groupId); + + // This will result in a 404 if the artifact does not exist. + storage.getArtifactMetaData(gid.getRawGroupIdWithNull(), artifactId); + final OrderBy oBy = OrderBy.valueOf(orderby.name()); final OrderDirection oDir = order == null || order == SortOrder.desc ? OrderDirection.asc : OrderDirection.desc; - VersionSearchResultsDto resultsDto = storage.searchVersions(new GroupId(groupId).getRawGroupIdWithNull(), - artifactId, oBy, oDir, offset.intValue(), limit.intValue()); + Set filters = Set.of( + SearchFilter.ofGroupId(new GroupId(groupId).getRawGroupIdWithNull()), + SearchFilter.ofArtifactId(artifactId) + ); + VersionSearchResultsDto resultsDto = storage.searchVersions(filters, oBy, oDir, offset.intValue(), limit.intValue()); return V3ApiUtil.dtoToSearchResults(resultsDto); } @@ -841,7 +805,7 @@ public VersionMetaData createArtifactVersion(String groupId, String artifactId, .labels(metaDataDto.getLabels()) .state(VersionState.ENABLED) .globalId(-1L) - .type(artifactType) + .artifactType(artifactType) .build(); } @@ -1004,7 +968,7 @@ private void checkIfDeprecated(Supplier stateSupplier, String grou * @param artifactId */ private String lookupArtifactType(String groupId, String artifactId) { - return storage.getArtifactMetaData(new GroupId(groupId).getRawGroupIdWithNull(), artifactId).getType(); + return storage.getArtifactMetaData(new GroupId(groupId).getRawGroupIdWithNull(), artifactId).getArtifactType(); } /** diff --git a/app/src/main/java/io/apicurio/registry/rest/v3/IdsResourceImpl.java b/app/src/main/java/io/apicurio/registry/rest/v3/IdsResourceImpl.java index 9a92f83031..0c8cd9eb44 100644 --- a/app/src/main/java/io/apicurio/registry/rest/v3/IdsResourceImpl.java +++ b/app/src/main/java/io/apicurio/registry/rest/v3/IdsResourceImpl.java @@ -1,9 +1,5 @@ package io.apicurio.registry.rest.v3; -import java.util.List; -import java.util.function.Supplier; -import java.util.stream.Collectors; - import io.apicurio.common.apps.logging.Logged; import io.apicurio.registry.auth.Authorized; import io.apicurio.registry.auth.AuthorizedLevel; @@ -28,6 +24,10 @@ import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.Response; +import java.util.List; +import java.util.function.Supplier; +import java.util.stream.Collectors; + @ApplicationScoped @Interceptors({ResponseErrorLivenessCheck.class, ResponseTimeoutReadinessCheck.class}) @Logged @@ -68,10 +68,10 @@ public Response getContentByGlobalId(long globalId, HandleReferencesType referen StoredArtifactVersionDto artifact = storage.getArtifactVersionContent(globalId); - MediaType contentType = factory.getArtifactMediaType(metaData.getType()); + MediaType contentType = factory.getArtifactMediaType(metaData.getArtifactType()); ContentHandle contentToReturn = artifact.getContent(); - contentToReturn = handleContentReferences(references, metaData.getType(), contentToReturn, artifact.getReferences()); + contentToReturn = handleContentReferences(references, metaData.getArtifactType(), contentToReturn, artifact.getReferences()); Response.ResponseBuilder builder = Response.ok(contentToReturn, contentType); checkIfDeprecated(metaData::getState, metaData.getArtifactId(), metaData.getVersion(), builder); diff --git a/app/src/main/java/io/apicurio/registry/rest/v3/SearchResourceImpl.java b/app/src/main/java/io/apicurio/registry/rest/v3/SearchResourceImpl.java index db3d95c1bc..93404f43cc 100644 --- a/app/src/main/java/io/apicurio/registry/rest/v3/SearchResourceImpl.java +++ b/app/src/main/java/io/apicurio/registry/rest/v3/SearchResourceImpl.java @@ -13,12 +13,15 @@ import io.apicurio.registry.rest.v3.beans.GroupSearchResults; import io.apicurio.registry.rest.v3.beans.GroupSortBy; import io.apicurio.registry.rest.v3.beans.SortOrder; +import io.apicurio.registry.rest.v3.beans.VersionSearchResults; +import io.apicurio.registry.rest.v3.beans.VersionSortBy; import io.apicurio.registry.storage.RegistryStorage; import io.apicurio.registry.storage.dto.ArtifactSearchResultsDto; import io.apicurio.registry.storage.dto.GroupSearchResultsDto; import io.apicurio.registry.storage.dto.OrderBy; import io.apicurio.registry.storage.dto.OrderDirection; import io.apicurio.registry.storage.dto.SearchFilter; +import io.apicurio.registry.storage.dto.VersionSearchResultsDto; import io.apicurio.registry.storage.impl.sql.RegistryStorageContentUtils; import io.apicurio.registry.types.Current; import io.apicurio.registry.util.ContentTypeUtil; @@ -81,7 +84,7 @@ public ArtifactSearchResults searchArtifacts(String name, BigInteger offset, Big filters.add(SearchFilter.ofDescription(description)); } if (!StringUtil.isEmpty(groupId)) { - filters.add(SearchFilter.ofGroup(new GroupId(groupId).getRawGroupIdWithNull())); + filters.add(SearchFilter.ofGroupId(new GroupId(groupId).getRawGroupIdWithNull())); } if (labels != null && !labels.isEmpty()) { @@ -120,8 +123,8 @@ public ArtifactSearchResults searchArtifacts(String name, BigInteger offset, Big @Override @Authorized(style=AuthorizedStyle.None, level=AuthorizedLevel.Read) - public ArtifactSearchResults searchArtifactsByContent(Boolean canonical, String artifactType, BigInteger offset, - BigInteger limit, SortOrder order, ArtifactSortBy orderby, InputStream data) { + public ArtifactSearchResults searchArtifactsByContent(Boolean canonical, String artifactType, String groupId, + BigInteger offset, BigInteger limit, SortOrder order, ArtifactSortBy orderby, InputStream data) { if (orderby == null) { orderby = ArtifactSortBy.name; @@ -156,6 +159,10 @@ public ArtifactSearchResults searchArtifactsByContent(Boolean canonical, String } else { throw new BadRequestException(CANONICAL_QUERY_PARAM_ERROR_MESSAGE); } + if (!StringUtil.isEmpty(groupId)) { + filters.add(SearchFilter.ofGroupId(new GroupId(groupId).getRawGroupIdWithNull())); + } + ArtifactSearchResultsDto results = storage.searchArtifacts(filters, oBy, oDir, offset.intValue(), limit.intValue()); return V3ApiUtil.dtoToSearchResults(results); } @@ -178,7 +185,7 @@ public GroupSearchResults searchGroups(BigInteger offset, BigInteger limit, Sort Set filters = new HashSet(); if (!StringUtil.isEmpty(groupId)) { - filters.add(SearchFilter.ofGroup(groupId)); + filters.add(SearchFilter.ofGroupId(groupId)); } if (!StringUtil.isEmpty(description)) { filters.add(SearchFilter.ofDescription(description)); @@ -212,6 +219,120 @@ public GroupSearchResults searchGroups(BigInteger offset, BigInteger limit, Sort return V3ApiUtil.dtoToSearchResults(results); } + @Override + public VersionSearchResults searchVersions(String version, BigInteger offset, BigInteger limit, SortOrder order, + VersionSortBy orderby, List labels, String description, String groupId, Long globalId, Long contentId, + String artifactId, String name) { + if (orderby == null) { + orderby = VersionSortBy.globalId; + } + if (offset == null) { + offset = BigInteger.valueOf(0); + } + if (limit == null) { + limit = BigInteger.valueOf(20); + } + + final OrderBy oBy = OrderBy.valueOf(orderby.name()); + final OrderDirection oDir = (order == null || order == SortOrder.asc) ? OrderDirection.asc : OrderDirection.desc; + + Set filters = new HashSet(); + if (!StringUtil.isEmpty(groupId)) { + filters.add(SearchFilter.ofGroupId(new GroupId(groupId).getRawGroupIdWithNull())); + } + if (!StringUtil.isEmpty(artifactId)) { + filters.add(SearchFilter.ofArtifactId(artifactId)); + } + if (!StringUtil.isEmpty(version)) { + filters.add(SearchFilter.ofVersion(version)); + } + + if (!StringUtil.isEmpty(name)) { + filters.add(SearchFilter.ofName(name)); + } + if (!StringUtil.isEmpty(description)) { + filters.add(SearchFilter.ofDescription(description)); + } + if (labels != null && !labels.isEmpty()) { + labels.stream() + .map(prop -> { + int delimiterIndex = prop.indexOf(":"); + String labelKey; + String labelValue; + if (delimiterIndex == 0) { + throw new BadRequestException("label search filter wrong formatted, missing left side of ':' delimiter"); + } + if (delimiterIndex == (prop.length() - 1)) { + throw new BadRequestException("label search filter wrong formatted, missing right side of ':' delimiter"); + } + if (delimiterIndex < 0) { + labelKey = prop; + labelValue = null; + } else{ + labelKey = prop.substring(0, delimiterIndex); + labelValue = prop.substring(delimiterIndex + 1); + } + return SearchFilter.ofLabel(labelKey, labelValue); + }) + .forEach(filters::add); + } + if (globalId != null && globalId > 0) { + filters.add(SearchFilter.ofGlobalId(globalId)); + } + if (contentId != null && contentId > 0) { + filters.add(SearchFilter.ofContentId(contentId)); + } + + VersionSearchResultsDto results = storage.searchVersions(filters, oBy, oDir, offset.intValue(), limit.intValue()); + return V3ApiUtil.dtoToSearchResults(results); + } + + @Override + public VersionSearchResults searchVersionsByContent(Boolean canonical, String artifactType, BigInteger offset, + BigInteger limit, SortOrder order, VersionSortBy orderby, String groupId, String artifactId, InputStream data) { + + if (orderby == null) { + orderby = VersionSortBy.globalId; + } + if (offset == null) { + offset = BigInteger.valueOf(0); + } + if (limit == null) { + limit = BigInteger.valueOf(20); + } + + final OrderBy oBy = OrderBy.valueOf(orderby.name()); + final OrderDirection oDir = (order == null || order == SortOrder.asc) ? OrderDirection.asc : OrderDirection.desc; + + Set filters = new HashSet(); + if (!StringUtil.isEmpty(groupId)) { + filters.add(SearchFilter.ofGroupId(new GroupId(groupId).getRawGroupIdWithNull())); + } + if (!StringUtil.isEmpty(artifactId)) { + filters.add(SearchFilter.ofArtifactId(artifactId)); + } + + if (canonical == null) { + canonical = Boolean.FALSE; + } + ContentHandle content = ContentHandle.create(data); + if (content.bytes().length == 0) { + throw new BadRequestException(EMPTY_CONTENT_ERROR_MESSAGE); + } + if (canonical && artifactType != null) { + String canonicalHash = contentUtils.getCanonicalContentHash(content, artifactType, null, null); + filters.add(SearchFilter.ofCanonicalHash(canonicalHash)); + } else if (!canonical) { + String contentHash = content.getSha256Hash(); + filters.add(SearchFilter.ofContentHash(contentHash)); + } else { + throw new BadRequestException(CANONICAL_QUERY_PARAM_ERROR_MESSAGE); + } + + VersionSearchResultsDto results = storage.searchVersions(filters, oBy, oDir, offset.intValue(), limit.intValue()); + return V3ApiUtil.dtoToSearchResults(results); + } + /** * Make sure this is ONLY used when request instance is active. * e.g. in actual http request diff --git a/app/src/main/java/io/apicurio/registry/rest/v3/V3ApiUtil.java b/app/src/main/java/io/apicurio/registry/rest/v3/V3ApiUtil.java index 1b7f94a9c4..b8b45a2c56 100644 --- a/app/src/main/java/io/apicurio/registry/rest/v3/V3ApiUtil.java +++ b/app/src/main/java/io/apicurio/registry/rest/v3/V3ApiUtil.java @@ -1,10 +1,5 @@ package io.apicurio.registry.rest.v3; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.Date; -import java.util.stream.Collectors; - import io.apicurio.common.apps.config.DynamicConfigPropertyDef; import io.apicurio.common.apps.config.DynamicConfigPropertyDto; import io.apicurio.registry.rest.v3.beans.ArtifactMetaData; @@ -34,7 +29,11 @@ import io.apicurio.registry.storage.dto.RoleMappingSearchResultsDto; import io.apicurio.registry.storage.dto.VersionSearchResultsDto; import io.apicurio.registry.types.RoleType; -import io.apicurio.registry.types.VersionState; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.Date; +import java.util.stream.Collectors; public final class V3ApiUtil { @@ -43,10 +42,6 @@ private V3ApiUtil() { /** * Creates a jax-rs meta-data entity from the id, type, and artifactStore meta-data. - * - * @param groupId - * @param artifactId - * @param artifactType * @param dto */ public static ArtifactMetaData dtoToArtifactMetaData(ArtifactMetaDataDto dto) { @@ -59,60 +54,16 @@ public static ArtifactMetaData dtoToArtifactMetaData(ArtifactMetaDataDto dto) { metaData.setModifiedBy(dto.getModifiedBy()); metaData.setModifiedOn(new Date(dto.getModifiedOn())); metaData.setName(dto.getName()); - metaData.setType(dto.getType()); - metaData.setLabels(dto.getLabels()); - return metaData; - } - - /** - * @param dto - */ - public static final ArtifactMetaData dtoToArtifactMetaData(ArtifactVersionMetaDataDto dto) { - ArtifactMetaData metaData = new ArtifactMetaData(); - metaData.setOwner(dto.getOwner()); - metaData.setCreatedOn(new Date(dto.getCreatedOn())); - metaData.setDescription(dto.getDescription()); - metaData.setGroupId(dto.getGroupId()); - metaData.setArtifactId(dto.getArtifactId()); - metaData.setModifiedBy(dto.getOwner()); - metaData.setModifiedOn(new Date(dto.getCreatedOn())); - metaData.setName(dto.getName()); - metaData.setType(dto.getType()); - metaData.setLabels(dto.getLabels()); - return metaData; - } - - - /** - * Creates a jax-rs version meta-data entity from the id, type, and artifactStore meta-data. - * - * @param groupId - * @param artifactId - * @param artifactType - * @param dto - */ - public static final VersionMetaData dtoToVersionMetaData(ArtifactMetaDataDto dto) { - VersionMetaData metaData = new VersionMetaData(); - metaData.setGroupId(dto.getGroupId()); - metaData.setArtifactId(dto.getArtifactId()); - metaData.setOwner(dto.getOwner()); - metaData.setCreatedOn(new Date(dto.getCreatedOn())); - metaData.setDescription(dto.getDescription()); - metaData.setName(dto.getName()); - metaData.setType(dto.getType()); - metaData.setState(VersionState.ENABLED); + metaData.setArtifactType(dto.getArtifactType()); metaData.setLabels(dto.getLabels()); return metaData; } /** * Creates a jax-rs version meta-data entity from the id, type, and artifactStore meta-data. - * - * @param artifactId - * @param artifactType * @param dto */ - public static final VersionMetaData dtoToVersionMetaData(ArtifactVersionMetaDataDto dto) { + public static VersionMetaData dtoToVersionMetaData(ArtifactVersionMetaDataDto dto) { VersionMetaData metaData = new VersionMetaData(); metaData.setGroupId(dto.getGroupId()); metaData.setArtifactId(dto.getArtifactId()); @@ -120,7 +71,7 @@ public static final VersionMetaData dtoToVersionMetaData(ArtifactVersionMetaData metaData.setCreatedOn(new Date(dto.getCreatedOn())); metaData.setDescription(dto.getDescription()); metaData.setName(dto.getName()); - metaData.setType(dto.getType()); + metaData.setArtifactType(dto.getArtifactType()); metaData.setVersion(dto.getVersion()); metaData.setGlobalId(dto.getGlobalId()); metaData.setContentId(dto.getContentId()); @@ -136,7 +87,7 @@ public static final VersionMetaData dtoToVersionMetaData(ArtifactVersionMetaData * @param editableArtifactMetaData * @return the updated ArtifactMetaDataDto object */ - public static final ArtifactMetaDataDto setEditableMetaDataInArtifact(ArtifactMetaDataDto dto, EditableArtifactMetaDataDto editableArtifactMetaData) { + public static ArtifactMetaDataDto setEditableMetaDataInArtifact(ArtifactMetaDataDto dto, EditableArtifactMetaDataDto editableArtifactMetaData) { if (editableArtifactMetaData.getName() != null) { dto.setName(editableArtifactMetaData.getName()); } @@ -179,7 +130,7 @@ public static ArtifactSearchResults dtoToSearchResults(ArtifactSearchResultsDto sa.setModifiedBy(artifact.getModifiedBy()); sa.setModifiedOn(artifact.getModifiedOn()); sa.setName(artifact.getName()); - sa.setType(artifact.getType()); + sa.setArtifactType(artifact.getArtifactType()); results.getArtifacts().add(sa); }); return results; @@ -208,6 +159,9 @@ public static VersionSearchResults dtoToSearchResults(VersionSearchResultsDto dt results.setVersions(new ArrayList<>(dto.getVersions().size())); dto.getVersions().forEach(version -> { SearchedVersion sv = new SearchedVersion(); + sv.setGroupId(version.getGroupId()); + sv.setArtifactId(version.getArtifactId()); + sv.setVersion(version.getVersion()); sv.setOwner(version.getOwner()); sv.setCreatedOn(version.getCreatedOn()); sv.setDescription(version.getDescription()); @@ -215,8 +169,7 @@ public static VersionSearchResults dtoToSearchResults(VersionSearchResultsDto dt sv.setContentId(version.getContentId()); sv.setName(version.getName()); sv.setState(version.getState()); - sv.setType(version.getType()); - sv.setVersion(version.getVersion()); + sv.setArtifactType(version.getArtifactType()); results.getVersions().add(sv); }); return results; diff --git a/app/src/main/java/io/apicurio/registry/storage/RegistryStorage.java b/app/src/main/java/io/apicurio/registry/storage/RegistryStorage.java index 5254356671..e3a07f3e62 100644 --- a/app/src/main/java/io/apicurio/registry/storage/RegistryStorage.java +++ b/app/src/main/java/io/apicurio/registry/storage/RegistryStorage.java @@ -311,15 +311,14 @@ void updateArtifactRule(String groupId, String artifactId, RuleType rule, RuleCo /** * Fetch the versions of the given artifact * - * @param groupId (optional) - * @param artifactId the artifact used to fetch versions + * @param filters the search filters * @param limit the result size limit * @param offset the number of versions to skip * @return the artifact versions, limited * @throws ArtifactNotFoundException * @throws RegistryStorageException */ - VersionSearchResultsDto searchVersions(String groupId, String artifactId, OrderBy orderBy, + VersionSearchResultsDto searchVersions(Set filters, OrderBy orderBy, OrderDirection orderDirection, int offset, int limit) throws ArtifactNotFoundException, RegistryStorageException; /** diff --git a/app/src/main/java/io/apicurio/registry/storage/decorator/RegistryStorageDecoratorReadOnlyBase.java b/app/src/main/java/io/apicurio/registry/storage/decorator/RegistryStorageDecoratorReadOnlyBase.java index 60fdee2c67..e569d8a6f1 100644 --- a/app/src/main/java/io/apicurio/registry/storage/decorator/RegistryStorageDecoratorReadOnlyBase.java +++ b/app/src/main/java/io/apicurio/registry/storage/decorator/RegistryStorageDecoratorReadOnlyBase.java @@ -130,10 +130,10 @@ public List getArtifactVersions(String groupId, String artifactId) return delegate.getArtifactVersions(groupId, artifactId); } + @Override - public VersionSearchResultsDto searchVersions(String groupId, String artifactId, OrderBy orderBy, OrderDirection orderDirection, int offset, int limit) - throws RegistryStorageException { - return delegate.searchVersions(groupId, artifactId, orderBy, orderDirection, offset, limit); + public VersionSearchResultsDto searchVersions(Set filters, OrderBy orderBy, OrderDirection orderDirection, int offset, int limit) throws RegistryStorageException { + return delegate.searchVersions(filters, orderBy, orderDirection, offset, limit); } @Override diff --git a/app/src/main/java/io/apicurio/registry/storage/dto/ArtifactMetaDataDto.java b/app/src/main/java/io/apicurio/registry/storage/dto/ArtifactMetaDataDto.java index 1ee19bf9f8..87db162e7f 100644 --- a/app/src/main/java/io/apicurio/registry/storage/dto/ArtifactMetaDataDto.java +++ b/app/src/main/java/io/apicurio/registry/storage/dto/ArtifactMetaDataDto.java @@ -1,7 +1,5 @@ package io.apicurio.registry.storage.dto; -import java.util.Map; - import lombok.AllArgsConstructor; import lombok.Builder; import lombok.EqualsAndHashCode; @@ -10,6 +8,8 @@ import lombok.Setter; import lombok.ToString; +import java.util.Map; + @NoArgsConstructor @AllArgsConstructor @Builder @@ -27,6 +27,6 @@ public class ArtifactMetaDataDto { private long createdOn; private String modifiedBy; private long modifiedOn; - private String type; + private String artifactType; private Map labels; } diff --git a/app/src/main/java/io/apicurio/registry/storage/dto/ArtifactVersionMetaDataDto.java b/app/src/main/java/io/apicurio/registry/storage/dto/ArtifactVersionMetaDataDto.java index a7691bd98d..d47787200e 100644 --- a/app/src/main/java/io/apicurio/registry/storage/dto/ArtifactVersionMetaDataDto.java +++ b/app/src/main/java/io/apicurio/registry/storage/dto/ArtifactVersionMetaDataDto.java @@ -1,7 +1,5 @@ package io.apicurio.registry.storage.dto; -import java.util.Map; - import io.apicurio.registry.types.VersionState; import lombok.AllArgsConstructor; import lombok.Builder; @@ -11,6 +9,8 @@ import lombok.Setter; import lombok.ToString; +import java.util.Map; + @NoArgsConstructor @AllArgsConstructor @Builder @@ -30,7 +30,7 @@ public class ArtifactVersionMetaDataDto { private String description; private String owner; private long createdOn; - private String type; + private String artifactType; private VersionState state; private Map labels; } diff --git a/app/src/main/java/io/apicurio/registry/storage/dto/SearchFilter.java b/app/src/main/java/io/apicurio/registry/storage/dto/SearchFilter.java index d5f6bbe6c6..375876fe67 100644 --- a/app/src/main/java/io/apicurio/registry/storage/dto/SearchFilter.java +++ b/app/src/main/java/io/apicurio/registry/storage/dto/SearchFilter.java @@ -50,8 +50,16 @@ public static SearchFilter ofDescription(String value) { return new SearchFilter(SearchFilterType.description, value); } - public static SearchFilter ofGroup(String value) { - return new SearchFilter(SearchFilterType.group, value); + public static SearchFilter ofGroupId(String value) { + return new SearchFilter(SearchFilterType.groupId, value); + } + + public static SearchFilter ofArtifactId(String value) { + return new SearchFilter(SearchFilterType.artifactId, value); + } + + public static SearchFilter ofVersion(String value) { + return new SearchFilter(SearchFilterType.version, value); } public static SearchFilter ofCanonicalHash(String value) { diff --git a/app/src/main/java/io/apicurio/registry/storage/dto/SearchFilterType.java b/app/src/main/java/io/apicurio/registry/storage/dto/SearchFilterType.java index b5f88e7867..889871f60f 100644 --- a/app/src/main/java/io/apicurio/registry/storage/dto/SearchFilterType.java +++ b/app/src/main/java/io/apicurio/registry/storage/dto/SearchFilterType.java @@ -2,6 +2,6 @@ public enum SearchFilterType { - group, name, description, labels, contentHash, canonicalHash, globalId, contentId, state + groupId, artifactId, version, name, description, labels, contentHash, canonicalHash, globalId, contentId, state } diff --git a/app/src/main/java/io/apicurio/registry/storage/dto/SearchedArtifactDto.java b/app/src/main/java/io/apicurio/registry/storage/dto/SearchedArtifactDto.java index 27d825d542..19f55d3bbd 100644 --- a/app/src/main/java/io/apicurio/registry/storage/dto/SearchedArtifactDto.java +++ b/app/src/main/java/io/apicurio/registry/storage/dto/SearchedArtifactDto.java @@ -1,7 +1,5 @@ package io.apicurio.registry.storage.dto; -import java.util.Date; - import lombok.AllArgsConstructor; import lombok.Builder; import lombok.EqualsAndHashCode; @@ -10,6 +8,8 @@ import lombok.Setter; import lombok.ToString; +import java.util.Date; + @NoArgsConstructor @AllArgsConstructor @Builder @@ -25,7 +25,7 @@ public class SearchedArtifactDto { private String description; private Date createdOn; private String owner; - private String type; + private String artifactType; private Date modifiedOn; private String modifiedBy; } diff --git a/app/src/main/java/io/apicurio/registry/storage/dto/SearchedVersionDto.java b/app/src/main/java/io/apicurio/registry/storage/dto/SearchedVersionDto.java index a6f6c1edfa..54e3c07ed7 100644 --- a/app/src/main/java/io/apicurio/registry/storage/dto/SearchedVersionDto.java +++ b/app/src/main/java/io/apicurio/registry/storage/dto/SearchedVersionDto.java @@ -1,7 +1,5 @@ package io.apicurio.registry.storage.dto; -import java.util.Date; - import io.apicurio.registry.types.VersionState; import lombok.AllArgsConstructor; import lombok.Builder; @@ -11,6 +9,8 @@ import lombok.Setter; import lombok.ToString; +import java.util.Date; + @NoArgsConstructor @AllArgsConstructor @Builder @@ -20,14 +20,16 @@ @ToString public class SearchedVersionDto { + private String groupId; + private String artifactId; + private String version; private String name; private String description; private Date createdOn; private String owner; - private String type; + private String artifactType; private VersionState state; private long globalId; private long contentId; - private String version; private int versionOrder; } diff --git a/app/src/main/java/io/apicurio/registry/storage/impl/gitops/GitOpsRegistryStorage.java b/app/src/main/java/io/apicurio/registry/storage/impl/gitops/GitOpsRegistryStorage.java index 7b34519945..b7d0b47042 100644 --- a/app/src/main/java/io/apicurio/registry/storage/impl/gitops/GitOpsRegistryStorage.java +++ b/app/src/main/java/io/apicurio/registry/storage/impl/gitops/GitOpsRegistryStorage.java @@ -247,6 +247,10 @@ public ArtifactSearchResultsDto searchArtifacts(Set filters, Order return proxy(storage -> storage.searchArtifacts(filters, orderBy, orderDirection, offset, limit)); } + @Override + public VersionSearchResultsDto searchVersions(Set filters, OrderBy orderBy, OrderDirection orderDirection, int offset, int limit) throws RegistryStorageException { + return proxy(storage -> storage.searchVersions(filters, orderBy, orderDirection, offset, limit)); + } @Override public ArtifactMetaDataDto getArtifactMetaData(String groupId, String artifactId) { @@ -282,11 +286,6 @@ public List getArtifactVersions(String groupId, String artifactId, Artif return proxy(storage -> storage.getArtifactVersions(groupId, artifactId, behavior)); } - @Override - public VersionSearchResultsDto searchVersions(String groupId, String artifactId, OrderBy orderBy, OrderDirection orderDirection, int offset, int limit) throws RegistryStorageException { - return proxy(storage -> storage.searchVersions(groupId, artifactId, orderBy, orderDirection, offset, limit)); - } - @Override public StoredArtifactVersionDto getArtifactVersionContent(long globalId) { diff --git a/app/src/main/java/io/apicurio/registry/storage/impl/sql/AbstractSqlRegistryStorage.java b/app/src/main/java/io/apicurio/registry/storage/impl/sql/AbstractSqlRegistryStorage.java index d3cf0c1e8e..ff3c520d50 100644 --- a/app/src/main/java/io/apicurio/registry/storage/impl/sql/AbstractSqlRegistryStorage.java +++ b/app/src/main/java/io/apicurio/registry/storage/impl/sql/AbstractSqlRegistryStorage.java @@ -528,7 +528,7 @@ public Pair createArtifact(Stri .owner(owner) .modifiedOn(createdOn.getTime()) .modifiedBy(owner) - .type(artifactType) + .artifactType(artifactType) .labels(labels) .build(); @@ -925,7 +925,7 @@ public ArtifactSearchResultsDto searchArtifacts(Set filters, Order query.bind(idx, "%" + filter.getStringValue() + "%"); }); break; - case group: + case groupId: op = filter.isNot() ? "!=" : "="; where.append("a.groupId " + op + " ?"); binders.add((query, idx) -> { @@ -1094,7 +1094,7 @@ private String getContentHash(String groupId, String artifactId, boolean canonic ContentHandle content, List references) { if (canonical) { var artifactMetaData = getArtifactMetaData(groupId, artifactId); - return utils.getCanonicalContentHash(content, artifactMetaData.getType(), + return utils.getCanonicalContentHash(content, artifactMetaData.getArtifactType(), references, this::resolveReferences); } else { return utils.getContentHash(content, references); @@ -1398,62 +1398,165 @@ public List getArtifactVersions(String groupId, String artifactId, Artif @Override @Transactional - public VersionSearchResultsDto searchVersions(String groupId, String artifactId, OrderBy orderBy, OrderDirection orderDirection, int offset, int limit) throws RegistryStorageException { // TODO: Rename to differentiate from other search* methods. - log.debug("Searching for versions of artifact {} {}", groupId, artifactId); + public VersionSearchResultsDto searchVersions(Set filters, OrderBy orderBy, + OrderDirection orderDirection, int offset, int limit) throws RegistryStorageException { + + log.debug("Searching for versions"); return handles.withHandleNoException(handle -> { - VersionSearchResultsDto rval = new VersionSearchResultsDto(); + List binders = new LinkedList<>(); + String op; - Integer count = handle.createQuery(sqlStatements.selectAllArtifactVersionsCount()) - .bind(0, normalizeGroupId(groupId)) - .bind(1, artifactId) - .mapTo(Integer.class) - .one(); - rval.setCount(count); + StringBuilder selectTemplate = new StringBuilder(); + StringBuilder where = new StringBuilder(); + StringBuilder orderByQuery = new StringBuilder(); + StringBuilder limitOffset = new StringBuilder(); - if (!isArtifactExists(groupId, artifactId)) { - throw new ArtifactNotFoundException(groupId, artifactId); + // Formulate the SELECT clause for the query + selectTemplate.append("SELECT {{selectColumns}} FROM versions v JOIN artifacts a ON v.groupId = a.groupId AND v.artifactId = a.artifactId"); + + // Formulate the WHERE clause for both queries + where.append(" WHERE (1 = 1)"); + for (SearchFilter filter : filters) { + where.append(" AND ("); + switch (filter.getType()) { + case groupId: + op = filter.isNot() ? "!=" : "="; + where.append("a.groupId " + op + " ?"); + binders.add((query, idx) -> { + query.bind(idx, normalizeGroupId(filter.getStringValue())); + }); + break; + case artifactId: + case contentId: + case globalId: + case version: + op = filter.isNot() ? "!=" : "="; + where.append("v."); + where.append(filter.getType().name()); + where.append(" "); + where.append(op); + where.append(" ?"); + binders.add((query, idx) -> { + query.bind(idx, filter.getStringValue()); + }); + break; + case name: + case description: + op = filter.isNot() ? "NOT LIKE" : "LIKE"; + where.append("v."); + where.append(filter.getType().name()); + where.append(" "); + where.append(op); + where.append(" ?"); + binders.add((query, idx) -> { + query.bind(idx, "%" + filter.getStringValue() + "%"); + }); + break; + case labels: + op = filter.isNot() ? "!=" : "="; + Pair label = filter.getLabelFilterValue(); + // Note: convert search to lowercase when searching for labels (case-insensitivity support). + String labelKey = label.getKey().toLowerCase(); + where.append("EXISTS(SELECT l.* FROM version_labels l WHERE l.labelKey " + op + " ?"); + binders.add((query, idx) -> { + query.bind(idx, labelKey); + }); + if (label.getValue() != null) { + String labelValue = label.getValue().toLowerCase(); + where.append(" AND l.labelValue " + op + " ?"); + binders.add((query, idx) -> { + query.bind(idx, labelValue); + }); + } + where.append(" AND l.globalId = v.globalId)"); + break; + case contentHash: + op = filter.isNot() ? "!=" : "="; + where.append("EXISTS(SELECT c.* FROM content c WHERE c.contentId = v.contentId AND "); + where.append("c.contentHash " + op + " ?"); + binders.add((query, idx) -> { + query.bind(idx, filter.getStringValue()); + }); + where.append(")"); + break; + case canonicalHash: + op = filter.isNot() ? "!=" : "="; + where.append("EXISTS(SELECT c.* FROM content c WHERE c.contentId = v.contentId AND "); + where.append("c.canonicalHash " + op + " ?"); + binders.add((query, idx) -> { + query.bind(idx, filter.getStringValue()); + }); + where.append(")"); + break; + default: + break; + } + where.append(")"); } - StringBuilder selectAllArtifactVersions = new StringBuilder(); - selectAllArtifactVersions.append(sqlStatements.selectAllArtifactVersions()); - selectAllArtifactVersions.append(" ORDER BY "); + // Add order by to artifact query switch (orderBy) { + case globalId: + orderByQuery.append(" ORDER BY v.globalId"); + break; + case version: + orderByQuery.append(" ORDER BY v.version"); + break; case name: - selectAllArtifactVersions.append("v.name"); + orderByQuery.append(" ORDER BY v.name"); break; case createdOn: - selectAllArtifactVersions.append("v.createdOn"); + orderByQuery.append(" ORDER BY v.createdOn"); break; - case globalId: - selectAllArtifactVersions.append("v.globalId"); + case modifiedOn: + orderByQuery.append(" ORDER BY v.modifiedOn"); + break; + default: break; } - selectAllArtifactVersions.append(orderDirection == OrderDirection.asc ? " ASC " : " DESC "); + orderByQuery.append(" ").append(orderDirection.name()); + + // Add limit and offset to artifact query if ("mssql".equals(sqlStatements.dbType())) { - // OFFSET ? ROWS FETCH NEXT ? ROWS ONLY - selectAllArtifactVersions.append("OFFSET "); - selectAllArtifactVersions.append(offset); - selectAllArtifactVersions.append(" ROWS FETCH NEXT "); - selectAllArtifactVersions.append(limit); - selectAllArtifactVersions.append("ROWS ONLY"); + limitOffset.append(" OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"); } else { - // LIMIT ? OFFSET ? - selectAllArtifactVersions.append("LIMIT "); - selectAllArtifactVersions.append(limit); - selectAllArtifactVersions.append(" OFFSET "); - selectAllArtifactVersions.append(offset); + limitOffset.append(" LIMIT ? OFFSET ?"); } - Query query = handle.createQuery(selectAllArtifactVersions.toString()) - .bind(0, normalizeGroupId(groupId)) - .bind(1, artifactId); + // Query for the group + String groupsQuerySql = new StringBuilder(selectTemplate) + .append(where) + .append(orderByQuery) + .append(limitOffset) + .toString() + .replace("{{selectColumns}}", "v.*, a.type"); + Query groupsQuery = handle.createQuery(groupsQuerySql); + // Query for the total row count + String countQuerySql = new StringBuilder(selectTemplate) + .append(where) + .toString() + .replace("{{selectColumns}}", "count(v.globalId)"); + Query countQuery = handle.createQuery(countQuerySql); - List versions = query - .map(SearchedVersionMapper.instance) - .list(); - rval.setVersions(versions); + // Bind all query parameters + int idx = 0; + for (SqlStatementVariableBinder binder : binders) { + binder.bind(groupsQuery, idx); + binder.bind(countQuery, idx); + idx++; + } + groupsQuery.bind(idx++, limit); + groupsQuery.bind(idx++, offset); - return rval; + // Execute query + List versions = groupsQuery.map(SearchedVersionMapper.instance).list(); + // Execute count query + Integer count = countQuery.mapTo(Integer.class).one(); + + VersionSearchResultsDto results = new VersionSearchResultsDto(); + results.setVersions(versions); + results.setCount(count); + return results; }); } @@ -2600,13 +2703,13 @@ public GroupSearchResultsDto searchGroups(Set filters, OrderBy ord query.bind(idx, "%" + filter.getStringValue() + "%"); }); break; - case group: - op = filter.isNot() ? "NOT LIKE" : "LIKE"; + case groupId: + op = filter.isNot() ? "!=" : "="; where.append("g.groupId "); where.append(op); where.append(" ?"); binders.add((query, idx) -> { - query.bind(idx, "%" + filter.getStringValue() + "%"); + query.bind(idx, filter.getStringValue()); }); break; case labels: @@ -2646,8 +2749,12 @@ public GroupSearchResultsDto searchGroups(Set filters, OrderBy ord } orderByQuery.append(" ").append(orderDirection.name()); - // Add limit and offset to artifact query - limitOffset.append(" LIMIT ? OFFSET ?"); + // Add limit and offset to query + if ("mssql".equals(sqlStatements.dbType())) { + limitOffset.append(" OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"); + } else { + limitOffset.append(" LIMIT ? OFFSET ?"); + } // Query for the group String groupsQuerySql = new StringBuilder(selectTemplate) @@ -2674,7 +2781,7 @@ public GroupSearchResultsDto searchGroups(Set filters, OrderBy ord groupsQuery.bind(idx++, limit); groupsQuery.bind(idx++, offset); - // Execute artifact query + // Execute query List groups = groupsQuery.map(SearchedGroupMapper.instance).list(); // Execute count query Integer count = countQuery.mapTo(Integer.class).one(); diff --git a/app/src/main/java/io/apicurio/registry/storage/impl/sql/SqlUtil.java b/app/src/main/java/io/apicurio/registry/storage/impl/sql/SqlUtil.java index 948695e51d..81652c9e09 100644 --- a/app/src/main/java/io/apicurio/registry/storage/impl/sql/SqlUtil.java +++ b/app/src/main/java/io/apicurio/registry/storage/impl/sql/SqlUtil.java @@ -3,10 +3,8 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; -import io.apicurio.registry.storage.dto.ArtifactMetaDataDto; -import io.apicurio.registry.storage.dto.ArtifactReferenceDto; -import io.apicurio.registry.storage.dto.ArtifactVersionMetaDataDto; import io.apicurio.registry.model.GroupId; +import io.apicurio.registry.storage.dto.ArtifactReferenceDto; import io.apicurio.registry.utils.StringUtil; import java.util.Collections; @@ -94,16 +92,4 @@ public static String denormalizeGroupId(String groupId) { return new GroupId(groupId).getRawGroupIdWithNull(); } - public static ArtifactMetaDataDto asArtifactMetaData(ArtifactVersionMetaDataDto versionMeta) { - ArtifactMetaDataDto artifactMeta = new ArtifactMetaDataDto(); - artifactMeta.setGroupId(versionMeta.getGroupId()); - artifactMeta.setArtifactId(versionMeta.getArtifactId()); - artifactMeta.setModifiedBy(versionMeta.getOwner()); - artifactMeta.setModifiedOn(versionMeta.getCreatedOn()); - artifactMeta.setName(versionMeta.getName()); - artifactMeta.setDescription(versionMeta.getDescription()); - artifactMeta.setLabels(versionMeta.getLabels()); - artifactMeta.setType(versionMeta.getType()); - return artifactMeta; - } } diff --git a/app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/ArtifactMetaDataDtoMapper.java b/app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/ArtifactMetaDataDtoMapper.java index 0abcebc41d..5ae0f59c81 100644 --- a/app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/ArtifactMetaDataDtoMapper.java +++ b/app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/ArtifactMetaDataDtoMapper.java @@ -1,12 +1,12 @@ package io.apicurio.registry.storage.impl.sql.mappers; -import java.sql.ResultSet; -import java.sql.SQLException; - import io.apicurio.registry.storage.dto.ArtifactMetaDataDto; import io.apicurio.registry.storage.impl.sql.SqlUtil; import io.apicurio.registry.storage.impl.sql.jdb.RowMapper; +import java.sql.ResultSet; +import java.sql.SQLException; + public class ArtifactMetaDataDtoMapper implements RowMapper { public static final ArtifactMetaDataDtoMapper instance = new ArtifactMetaDataDtoMapper(); @@ -32,7 +32,7 @@ public ArtifactMetaDataDto map(ResultSet rs) throws SQLException { dto.setLabels(SqlUtil.deserializeLabels(rs.getString("labels"))); dto.setModifiedBy(rs.getString("modifiedBy")); dto.setModifiedOn(rs.getTimestamp("modifiedOn").getTime()); - dto.setType(rs.getString("type")); + dto.setArtifactType(rs.getString("type")); return dto; } diff --git a/app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/ArtifactVersionMetaDataDtoMapper.java b/app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/ArtifactVersionMetaDataDtoMapper.java index cc54742960..5dbdc59a1c 100644 --- a/app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/ArtifactVersionMetaDataDtoMapper.java +++ b/app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/ArtifactVersionMetaDataDtoMapper.java @@ -1,13 +1,13 @@ package io.apicurio.registry.storage.impl.sql.mappers; -import java.sql.ResultSet; -import java.sql.SQLException; - import io.apicurio.registry.storage.dto.ArtifactVersionMetaDataDto; import io.apicurio.registry.storage.impl.sql.SqlUtil; import io.apicurio.registry.storage.impl.sql.jdb.RowMapper; import io.apicurio.registry.types.VersionState; +import java.sql.ResultSet; +import java.sql.SQLException; + /** * Used to map a single row in the versions table to a {@link ArtifactVersionMetaDataDto} instance. */ @@ -38,7 +38,7 @@ public ArtifactVersionMetaDataDto map(ResultSet rs) throws SQLException { dto.setDescription(rs.getString("description")); dto.setVersion(rs.getString("version")); dto.setVersionOrder(rs.getInt("versionOrder")); - dto.setType(rs.getString("type")); + dto.setArtifactType(rs.getString("type")); dto.setLabels(SqlUtil.deserializeLabels(rs.getString("labels"))); return dto; } diff --git a/app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/SearchedArtifactMapper.java b/app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/SearchedArtifactMapper.java index 8c9fbf1bdc..d81a0e67d6 100644 --- a/app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/SearchedArtifactMapper.java +++ b/app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/SearchedArtifactMapper.java @@ -1,12 +1,12 @@ package io.apicurio.registry.storage.impl.sql.mappers; -import java.sql.ResultSet; -import java.sql.SQLException; - import io.apicurio.registry.storage.dto.SearchedArtifactDto; import io.apicurio.registry.storage.impl.sql.SqlUtil; import io.apicurio.registry.storage.impl.sql.jdb.RowMapper; +import java.sql.ResultSet; +import java.sql.SQLException; + public class SearchedArtifactMapper implements RowMapper { public static final SearchedArtifactMapper instance = new SearchedArtifactMapper(); @@ -31,7 +31,7 @@ public SearchedArtifactDto map(ResultSet rs) throws SQLException { dto.setDescription(rs.getString("description")); dto.setModifiedBy(rs.getString("modifiedBy")); dto.setModifiedOn(rs.getTimestamp("modifiedOn")); - dto.setType(rs.getString("type")); + dto.setArtifactType(rs.getString("type")); return dto; } diff --git a/app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/SearchedVersionMapper.java b/app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/SearchedVersionMapper.java index 3c3ad12b57..48cec20018 100644 --- a/app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/SearchedVersionMapper.java +++ b/app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/SearchedVersionMapper.java @@ -1,12 +1,13 @@ package io.apicurio.registry.storage.impl.sql.mappers; -import java.sql.ResultSet; -import java.sql.SQLException; - import io.apicurio.registry.storage.dto.SearchedVersionDto; +import io.apicurio.registry.storage.impl.sql.SqlUtil; import io.apicurio.registry.storage.impl.sql.jdb.RowMapper; import io.apicurio.registry.types.VersionState; +import java.sql.ResultSet; +import java.sql.SQLException; + public class SearchedVersionMapper implements RowMapper { public static final SearchedVersionMapper instance = new SearchedVersionMapper(); @@ -23,16 +24,18 @@ private SearchedVersionMapper() { @Override public SearchedVersionDto map(ResultSet rs) throws SQLException { SearchedVersionDto dto = new SearchedVersionDto(); - dto.setGlobalId(rs.getLong("globalId")); + dto.setGroupId(SqlUtil.denormalizeGroupId(rs.getString("groupId"))); + dto.setArtifactId(rs.getString("artifactId")); dto.setVersion(rs.getString("version")); dto.setVersionOrder(rs.getInt("versionOrder")); + dto.setGlobalId(rs.getLong("globalId")); dto.setContentId(rs.getLong("contentId")); dto.setState(VersionState.valueOf(rs.getString("state"))); dto.setOwner(rs.getString("owner")); dto.setCreatedOn(rs.getTimestamp("createdOn")); dto.setName(rs.getString("name")); dto.setDescription(rs.getString("description")); - dto.setType(rs.getString("type")); + dto.setArtifactType(rs.getString("type")); return dto; } diff --git a/app/src/test/java/io/apicurio/registry/AbstractRegistryTestBase.java b/app/src/test/java/io/apicurio/registry/AbstractRegistryTestBase.java index 09ac9daea9..644513dd31 100644 --- a/app/src/test/java/io/apicurio/registry/AbstractRegistryTestBase.java +++ b/app/src/test/java/io/apicurio/registry/AbstractRegistryTestBase.java @@ -7,6 +7,7 @@ import org.eclipse.microprofile.config.inject.ConfigProperty; import org.junit.jupiter.api.Assertions; import java.io.BufferedReader; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -60,4 +61,9 @@ protected final ContentHandle resourceToContentHandle(String resourceName) { public static void assertMultilineTextEquals(String expected, String actual) throws Exception { Assertions.assertEquals(TestUtils.normalizeMultiLineString(expected), TestUtils.normalizeMultiLineString(actual)); } + + public static InputStream asInputStream(String value) { + return new ByteArrayInputStream(value.getBytes(StandardCharsets.UTF_8)); + } + } diff --git a/app/src/test/java/io/apicurio/registry/AbstractResourceTestBase.java b/app/src/test/java/io/apicurio/registry/AbstractResourceTestBase.java index d5b41dae4e..54080c8004 100644 --- a/app/src/test/java/io/apicurio/registry/AbstractResourceTestBase.java +++ b/app/src/test/java/io/apicurio/registry/AbstractResourceTestBase.java @@ -123,7 +123,7 @@ protected CreateArtifactResponse createArtifact(String groupId, String artifactI String contentType, Consumer requestCustomizer) throws Exception { CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactId); - createArtifact.setType(artifactType); + createArtifact.setArtifactType(artifactType); CreateVersion createVersion = new CreateVersion(); createArtifact.setFirstVersion(createVersion); VersionContent versionContent = new VersionContent(); @@ -143,7 +143,7 @@ protected CreateArtifactResponse createArtifact(String groupId, String artifactI ; assert( result.getArtifact().getArtifactId().equals(artifactId) ); - assert( result.getArtifact().getType().equals(artifactType) ); + assert( result.getArtifact().getArtifactType().equals(artifactType) ); return result; } @@ -152,7 +152,7 @@ protected CreateArtifactResponse createArtifactWithReferences(String groupId, St String contentType, List artifactReferences) throws Exception { var response = createArtifactExtendedRaw(groupId, artifactId, artifactType, content, contentType, artifactReferences); - assert( response.getArtifact().getType().equals(artifactType) ); + assert( response.getArtifact().getArtifactType().equals(artifactType) ); assert( response.getArtifact().getArtifactId().equals(artifactId) ); return response; @@ -162,7 +162,7 @@ protected CreateArtifactResponse createArtifactExtendedRaw(String groupId, Strin String content, String contentType, List versionReferences) throws Exception { CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactId); - createArtifact.setType(artifactType); + createArtifact.setArtifactType(artifactType); CreateVersion createVersion = new CreateVersion(); createArtifact.setFirstVersion(createVersion); VersionContent versionContent = new VersionContent(); diff --git a/app/src/test/java/io/apicurio/registry/auth/AuthTestNoRoles.java b/app/src/test/java/io/apicurio/registry/auth/AuthTestNoRoles.java index 90ab74555c..fc2b658acc 100644 --- a/app/src/test/java/io/apicurio/registry/auth/AuthTestNoRoles.java +++ b/app/src/test/java/io/apicurio/registry/auth/AuthTestNoRoles.java @@ -68,7 +68,7 @@ public void testAdminRole() throws Exception { client.groups().byGroupId(GroupId.DEFAULT.getRawGroupIdWithDefaultString()).artifacts().get(); CreateArtifact createArtifact = new CreateArtifact(); - createArtifact.setType(ArtifactType.JSON); + createArtifact.setArtifactType(ArtifactType.JSON); createArtifact.setArtifactId(artifactId); CreateVersion createVersion = new CreateVersion(); createArtifact.setFirstVersion(createVersion); diff --git a/app/src/test/java/io/apicurio/registry/auth/AuthTestProfileBasicClientCredentials.java b/app/src/test/java/io/apicurio/registry/auth/AuthTestProfileBasicClientCredentials.java index 06c2ca9f35..1e830f617f 100644 --- a/app/src/test/java/io/apicurio/registry/auth/AuthTestProfileBasicClientCredentials.java +++ b/app/src/test/java/io/apicurio/registry/auth/AuthTestProfileBasicClientCredentials.java @@ -67,7 +67,7 @@ public void testBasicAuthClientCredentials() throws Exception { client.groups().byGroupId(GroupId.DEFAULT.getRawGroupIdWithDefaultString()).artifacts().get(); CreateArtifact createArtifact = new CreateArtifact(); - createArtifact.setType(ArtifactType.JSON); + createArtifact.setArtifactType(ArtifactType.JSON); createArtifact.setArtifactId(artifactId); CreateVersion createVersion = new CreateVersion(); createArtifact.setFirstVersion(createVersion); diff --git a/app/src/test/java/io/apicurio/registry/auth/SimpleAuthTest.java b/app/src/test/java/io/apicurio/registry/auth/SimpleAuthTest.java index 07d16389b7..0db30e20b4 100644 --- a/app/src/test/java/io/apicurio/registry/auth/SimpleAuthTest.java +++ b/app/src/test/java/io/apicurio/registry/auth/SimpleAuthTest.java @@ -59,7 +59,7 @@ protected RegistryClient createRestClientV3() { private static final CreateArtifact createArtifact = new CreateArtifact(); static { - createArtifact.setType(ArtifactType.JSON); + createArtifact.setArtifactType(ArtifactType.JSON); CreateVersion createVersion = new CreateVersion(); createArtifact.setFirstVersion(createVersion); VersionContent versionContent = new VersionContent(); diff --git a/app/src/test/java/io/apicurio/registry/limits/LimitsTest.java b/app/src/test/java/io/apicurio/registry/limits/LimitsTest.java index 8f78a8719a..3973e0bbc2 100644 --- a/app/src/test/java/io/apicurio/registry/limits/LimitsTest.java +++ b/app/src/test/java/io/apicurio/registry/limits/LimitsTest.java @@ -104,7 +104,7 @@ public void testLimits() throws Exception { var exception2 = Assertions.assertThrows(io.apicurio.registry.rest.client.models.Error.class, () -> { CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactId); - createArtifact.setType(ArtifactType.JSON); + createArtifact.setArtifactType(ArtifactType.JSON); CreateVersion createVersion = new CreateVersion(); createArtifact.setFirstVersion(createVersion); VersionContent versionContent = new VersionContent(); diff --git a/app/src/test/java/io/apicurio/registry/noprofile/compatibility/CompatibilityRuleApplicationTest.java b/app/src/test/java/io/apicurio/registry/noprofile/compatibility/CompatibilityRuleApplicationTest.java index 6b85a70c5f..f065dad052 100644 --- a/app/src/test/java/io/apicurio/registry/noprofile/compatibility/CompatibilityRuleApplicationTest.java +++ b/app/src/test/java/io/apicurio/registry/noprofile/compatibility/CompatibilityRuleApplicationTest.java @@ -126,7 +126,7 @@ public class CompatibilityRuleApplicationTest extends AbstractResourceTestBase { private static final CreateArtifact createArtifact = new CreateArtifact(); static { - createArtifact.setType(ArtifactType.JSON); + createArtifact.setArtifactType(ArtifactType.JSON); CreateVersion createVersion = new CreateVersion(); createArtifact.setFirstVersion(createVersion); VersionContent versionContent = new VersionContent(); diff --git a/app/src/test/java/io/apicurio/registry/noprofile/maven/RegistryMojoTestBase.java b/app/src/test/java/io/apicurio/registry/noprofile/maven/RegistryMojoTestBase.java index 5d4ddc666f..3d7b298006 100644 --- a/app/src/test/java/io/apicurio/registry/noprofile/maven/RegistryMojoTestBase.java +++ b/app/src/test/java/io/apicurio/registry/noprofile/maven/RegistryMojoTestBase.java @@ -71,14 +71,14 @@ private static List createArtifacts(String groupId, File keySc RegisterArtifact keySchemaArtifact = new RegisterArtifact(); keySchemaArtifact.setGroupId(groupId); keySchemaArtifact.setArtifactId(KEY_SUBJECT); - keySchemaArtifact.setType(ArtifactType.AVRO); + keySchemaArtifact.setArtifactType(ArtifactType.AVRO); keySchemaArtifact.setFile(keySchemaFile); artifacts.add(keySchemaArtifact); RegisterArtifact valueSchemaArtifact = new RegisterArtifact(); valueSchemaArtifact.setGroupId(groupId); valueSchemaArtifact.setArtifactId(VALUE_SUBJECT); - valueSchemaArtifact.setType(ArtifactType.AVRO); + valueSchemaArtifact.setArtifactType(ArtifactType.AVRO); valueSchemaArtifact.setFile(valueSchemaFile); artifacts.add(valueSchemaArtifact); return artifacts; diff --git a/app/src/test/java/io/apicurio/registry/noprofile/maven/RegistryMojoWithAutoReferencesTest.java b/app/src/test/java/io/apicurio/registry/noprofile/maven/RegistryMojoWithAutoReferencesTest.java index 4ae94e7233..df4fc9a569 100644 --- a/app/src/test/java/io/apicurio/registry/noprofile/maven/RegistryMojoWithAutoReferencesTest.java +++ b/app/src/test/java/io/apicurio/registry/noprofile/maven/RegistryMojoWithAutoReferencesTest.java @@ -66,7 +66,7 @@ public void autoRegisterAvroWithReferences() throws Exception { RegisterArtifact tradeRawArtifact = new RegisterArtifact(); tradeRawArtifact.setGroupId(groupId); tradeRawArtifact.setArtifactId(artifactId); - tradeRawArtifact.setType(ArtifactType.AVRO); + tradeRawArtifact.setArtifactType(ArtifactType.AVRO); tradeRawArtifact.setFile(tradeRawFile); tradeRawArtifact.setAnalyzeDirectory(true); tradeRawArtifact.setIfExists(IfArtifactExists.FAIL); @@ -100,7 +100,7 @@ public void autoRegisterProtoWithReferences() throws Exception { RegisterArtifact tableNotification = new RegisterArtifact(); tableNotification.setGroupId(groupId); tableNotification.setArtifactId(artifactId); - tableNotification.setType(ArtifactType.PROTOBUF); + tableNotification.setArtifactType(ArtifactType.PROTOBUF); tableNotification.setFile(tableNotificationFile); tableNotification.setAnalyzeDirectory(true); tableNotification.setIfExists(IfArtifactExists.FAIL); @@ -136,7 +136,7 @@ public void autoRegisterJsonSchemaWithReferences() throws Exception { RegisterArtifact citizen = new RegisterArtifact(); citizen.setGroupId(groupId); citizen.setArtifactId(artifactId); - citizen.setType(ArtifactType.JSON); + citizen.setArtifactType(ArtifactType.JSON); citizen.setFile(citizenFile); citizen.setAnalyzeDirectory(true); citizen.setIfExists(IfArtifactExists.FAIL); diff --git a/app/src/test/java/io/apicurio/registry/noprofile/maven/RegistryMojoWithMinifyTest.java b/app/src/test/java/io/apicurio/registry/noprofile/maven/RegistryMojoWithMinifyTest.java index f573466b49..b052917d5d 100644 --- a/app/src/test/java/io/apicurio/registry/noprofile/maven/RegistryMojoWithMinifyTest.java +++ b/app/src/test/java/io/apicurio/registry/noprofile/maven/RegistryMojoWithMinifyTest.java @@ -33,14 +33,14 @@ public void testMinify() throws Exception { RegisterArtifact avroMinifiedArtifact = new RegisterArtifact(); avroMinifiedArtifact.setGroupId(groupId); avroMinifiedArtifact.setArtifactId("userInfoMinified"); - avroMinifiedArtifact.setType(ArtifactType.AVRO); + avroMinifiedArtifact.setArtifactType(ArtifactType.AVRO); avroMinifiedArtifact.setMinify(true); avroMinifiedArtifact.setFile(avroFile); RegisterArtifact avroNotMinifiedArtifact = new RegisterArtifact(); avroNotMinifiedArtifact.setGroupId(groupId); avroNotMinifiedArtifact.setArtifactId("userInfoNotMinified"); - avroNotMinifiedArtifact.setType(ArtifactType.AVRO); + avroNotMinifiedArtifact.setArtifactType(ArtifactType.AVRO); avroNotMinifiedArtifact.setFile(avroFile); registerMojo.setArtifacts(List.of(avroMinifiedArtifact, avroNotMinifiedArtifact)); diff --git a/app/src/test/java/io/apicurio/registry/noprofile/maven/RegistryMojoWithReferencesTest.java b/app/src/test/java/io/apicurio/registry/noprofile/maven/RegistryMojoWithReferencesTest.java index 901ef47053..7837cdf7c4 100644 --- a/app/src/test/java/io/apicurio/registry/noprofile/maven/RegistryMojoWithReferencesTest.java +++ b/app/src/test/java/io/apicurio/registry/noprofile/maven/RegistryMojoWithReferencesTest.java @@ -44,20 +44,20 @@ public void testMojosWithReferences() throws IOException, MojoFailureException, RegisterArtifact tradeRawArtifact = new RegisterArtifact(); tradeRawArtifact.setGroupId(groupId); tradeRawArtifact.setArtifactId("tradeRaw"); - tradeRawArtifact.setType(ArtifactType.AVRO); + tradeRawArtifact.setArtifactType(ArtifactType.AVRO); tradeRawArtifact.setFile(tradeRawFile); RegisterArtifactReference tradeKeyArtifact = new RegisterArtifactReference(); tradeKeyArtifact.setGroupId(groupId); tradeKeyArtifact.setArtifactId("tradeKey"); - tradeKeyArtifact.setType(ArtifactType.AVRO); + tradeKeyArtifact.setArtifactType(ArtifactType.AVRO); tradeKeyArtifact.setFile(tradeKeyFile); tradeKeyArtifact.setName("tradeKey"); RegisterArtifactReference exchangeArtifact = new RegisterArtifactReference(); exchangeArtifact.setGroupId(groupId); exchangeArtifact.setArtifactId("exchange"); - exchangeArtifact.setType(ArtifactType.AVRO); + exchangeArtifact.setArtifactType(ArtifactType.AVRO); exchangeArtifact.setFile(exchangeFile); exchangeArtifact.setName("exchange"); diff --git a/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/EmptyArtifactTest.java b/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/EmptyArtifactTest.java index 4894d1a201..a6e6976200 100644 --- a/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/EmptyArtifactTest.java +++ b/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/EmptyArtifactTest.java @@ -23,7 +23,7 @@ public void testCreateEmptyArtifact() throws Exception { CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactId); - createArtifact.setType(ArtifactType.JSON); + createArtifact.setArtifactType(ArtifactType.JSON); clientV3.groups().byGroupId(groupId).artifacts().post(createArtifact); @@ -43,7 +43,7 @@ public void testCreateFirstVersion() throws Exception { CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactId); - createArtifact.setType(ArtifactType.JSON); + createArtifact.setArtifactType(ArtifactType.JSON); clientV3.groups().byGroupId(groupId).artifacts().post(createArtifact); @@ -66,7 +66,7 @@ public void testCreateFirstCustomVersion() throws Exception { CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactId); - createArtifact.setType(ArtifactType.JSON); + createArtifact.setArtifactType(ArtifactType.JSON); clientV3.groups().byGroupId(groupId).artifacts().post(createArtifact); diff --git a/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/GroupsResourceTest.java b/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/GroupsResourceTest.java index 67eecb52e8..d5f95457ce 100644 --- a/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/GroupsResourceTest.java +++ b/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/GroupsResourceTest.java @@ -330,7 +330,7 @@ public void testCreateArtifact() throws Exception { .body("artifact.groupId", equalTo(GROUP)) .body("version.version", equalTo("1")) .body("artifact.artifactId", equalTo("testCreateArtifact/EmptyAPI/2")) - .body("artifact.type", equalTo(ArtifactType.OPENAPI)); + .body("artifact.artifactType", equalTo(ArtifactType.OPENAPI)); // Try to create a duplicate artifact ID (should fail) given() @@ -366,7 +366,7 @@ public void testCreateArtifact() throws Exception { .then() .statusCode(200) .body("artifact.artifactId", equalTo("testCreateArtifact/EmptyAPI/detect")) - .body("artifact.type", equalTo(ArtifactType.OPENAPI)); + .body("artifact.artifactType", equalTo(ArtifactType.OPENAPI)); // Create artifact with empty content (should fail) createArtifact = TestUtils.serverCreateArtifact("testCreateArtifact/EmptyContent", null, "", ContentTypes.APPLICATION_JSON); @@ -393,7 +393,7 @@ public void testCreateArtifact() throws Exception { .body("artifact.groupId", equalTo(GROUP)) .body("version.version", equalTo("1.0.2")) .body("artifact.artifactId", equalTo("testCreateArtifact/EmptyAPI-customVersion")) - .body("artifact.type", equalTo(ArtifactType.OPENAPI)); + .body("artifact.artifactType", equalTo(ArtifactType.OPENAPI)); // Create OpenAPI artifact - provide a custom name String customName = "CUSTOM NAME"; @@ -410,7 +410,7 @@ public void testCreateArtifact() throws Exception { .body("artifact.groupId", equalTo(GROUP)) .body("artifact.name", equalTo(customName)) .body("artifact.artifactId", equalTo("testCreateArtifact/EmptyAPI-customName")) - .body("artifact.type", equalTo(ArtifactType.OPENAPI)); + .body("artifact.artifactType", equalTo(ArtifactType.OPENAPI)); // Create OpenAPI artifact - provide a custom description String customDescription = "CUSTOM DESCRIPTION"; @@ -427,7 +427,7 @@ public void testCreateArtifact() throws Exception { .body("artifact.groupId", equalTo(GROUP)) .body("artifact.description", equalTo(customDescription)) .body("artifact.artifactId", equalTo("testCreateArtifact/EmptyAPI-customDescription")) - .body("artifact.type", equalTo(ArtifactType.OPENAPI)); + .body("artifact.artifactType", equalTo(ArtifactType.OPENAPI)); } @Test @@ -450,7 +450,7 @@ public void testCreateArtifactNoAscii() { .statusCode(200) .body("artifact.groupId", equalTo(GROUP)) .body("artifact.artifactId", equalTo("testCreateArtifact/EmptyAPI-customNameEncoded")) - .body("artifact.type", equalTo(ArtifactType.OPENAPI)) + .body("artifact.artifactType", equalTo(ArtifactType.OPENAPI)) .body("artifact.name", equalTo(customNoASCIIName)); // Create OpenAPI artifact - provide a custom No-ASCII description @@ -467,7 +467,7 @@ public void testCreateArtifactNoAscii() { .statusCode(200) .body("artifact.groupId", equalTo(GROUP)) .body("artifact.artifactId", equalTo("testCreateArtifact/EmptyAPI-customDescriptionEncoded")) - .body("artifact.type", equalTo(ArtifactType.OPENAPI)) + .body("artifact.artifactType", equalTo(ArtifactType.OPENAPI)) .body("artifact.description", equalTo(customNoASCIIDescription)); } @@ -521,7 +521,7 @@ public void testUpdateArtifact() throws Exception { .then() .statusCode(200) .body("artifactId", equalTo("testUpdateArtifact/EmptyAPI")) - .body("type", equalTo(ArtifactType.OPENAPI)); + .body("artifactType", equalTo(ArtifactType.OPENAPI)); // Get the artifact content (should be the updated content) given() @@ -572,7 +572,7 @@ public void testUpdateArtifact() throws Exception { .statusCode(200) .body("version", equalTo("3.0.0.Final")) .body("artifactId", equalTo("testUpdateArtifact/EmptyAPI")) - .body("type", equalTo(ArtifactType.OPENAPI)); + .body("artifactType", equalTo(ArtifactType.OPENAPI)); // Update OpenAPI artifact with a custom name String customName = "CUSTOM NAME"; @@ -589,7 +589,7 @@ public void testUpdateArtifact() throws Exception { .statusCode(200) .body("name", equalTo(customName)) .body("artifactId", equalTo("testUpdateArtifact/EmptyAPI")) - .body("type", equalTo(ArtifactType.OPENAPI)); + .body("artifactType", equalTo(ArtifactType.OPENAPI)); // Update OpenAPI artifact with a custom description String customDescription = "CUSTOM DESCRIPTION"; @@ -606,7 +606,7 @@ public void testUpdateArtifact() throws Exception { .statusCode(200) .body("description", equalTo(customDescription)) .body("artifactId", equalTo("testUpdateArtifact/EmptyAPI")) - .body("type", equalTo(ArtifactType.OPENAPI)); + .body("artifactType", equalTo(ArtifactType.OPENAPI)); } @@ -722,7 +722,7 @@ public void testUpdateArtifactNoAscii() throws Exception { .statusCode(200) .body("name", equalTo(customNoASCIIName)) .body("artifactId", equalTo("testUpdateArtifactNoAscii/EmptyAPI")) - .body("type", equalTo(ArtifactType.OPENAPI)); + .body("artifactType", equalTo(ArtifactType.OPENAPI)); // Update OpenAPI artifact with a custom no-ascii description String customNoASCIIDescription = "CUSTOM DESCRIPTION with NO-ASCII char Ä›"; @@ -741,7 +741,7 @@ public void testUpdateArtifactNoAscii() throws Exception { .statusCode(200) .body("description", equalTo(customNoASCIIDescription)) .body("artifactId", equalTo("testUpdateArtifactNoAscii/EmptyAPI")) - .body("type", equalTo(ArtifactType.OPENAPI)); + .body("artifactType", equalTo(ArtifactType.OPENAPI)); } @Test @@ -823,7 +823,7 @@ public void testDeleteArtifactVersion() throws Exception { .then() .statusCode(200) .body("version", equalTo("2")) - .body("type", equalTo(ArtifactType.OPENAPI)); + .body("artifactType", equalTo(ArtifactType.OPENAPI)); //Get the artifact version 1 given() @@ -1045,7 +1045,7 @@ public void testListArtifactVersions() throws Exception { .then() .statusCode(200) .body("artifactId", equalTo(artifactId)) - .body("type", equalTo(ArtifactType.OPENAPI)); + .body("artifactType", equalTo(ArtifactType.OPENAPI)); } // List the artifact versions @@ -1091,7 +1091,7 @@ public void testCreateArtifactVersion() throws Exception { .then() .statusCode(200) .body("version", equalTo("2")) - .body("type", equalTo(ArtifactType.OPENAPI)); + .body("artifactType", equalTo(ArtifactType.OPENAPI)); // Get the artifact content (should be the updated content) given() @@ -1141,7 +1141,7 @@ public void testCreateArtifactVersion() throws Exception { .then() .statusCode(200) .body("version", equalTo("3.0.0.Final")) - .body("type", equalTo(ArtifactType.OPENAPI)); + .body("artifactType", equalTo(ArtifactType.OPENAPI)); // Create another new version of the artifact with a custom name String customName = "CUSTOM NAME"; @@ -1342,7 +1342,7 @@ public void testGetArtifactVersion() throws Exception { .then() .statusCode(200) .body("artifactId", equalTo("testGetArtifactVersion/EmptyAPI")) - .body("type", equalTo(ArtifactType.OPENAPI)) + .body("artifactType", equalTo(ArtifactType.OPENAPI)) .extract().body().path("version"); versions.add(version); } @@ -1383,89 +1383,6 @@ public void testGetArtifactVersion() throws Exception { .statusCode(404); } - @Test - public void testGetArtifactMetaDataByContent() throws Exception { - String artifactContent = resourceToString("openapi-empty.json"); - - // Create an artifact - createArtifact(GROUP, "testGetArtifactMetaDataByContent/EmptyAPI", ArtifactType.OPENAPI, artifactContent, ContentTypes.APPLICATION_JSON); - - // Update the artifact 5 times - for (int idx = 0; idx < 5; idx++) { - String versionContent = artifactContent.replace("Empty API", "Empty API (Update " + idx + ")"); - io.apicurio.registry.rest.v3.beans.CreateVersion createVersion = TestUtils.serverCreateVersion(versionContent, ContentTypes.APPLICATION_JSON); - given() - .when() - .contentType(CT_JSON) - .pathParam("groupId", GROUP) - .pathParam("artifactId", "testGetArtifactMetaDataByContent/EmptyAPI") - .body(createVersion) - .post("/registry/v3/groups/{groupId}/artifacts/{artifactId}/versions") - .then() - .statusCode(200) - .body("artifactId", equalTo("testGetArtifactMetaDataByContent/EmptyAPI")) - .body("groupId", equalTo(GROUP)) - .body("type", equalTo(ArtifactType.OPENAPI)) - .extract().body().path("version"); - } - - // Get meta-data by content - String searchContent = artifactContent.replace("Empty API", "Empty API (Update 2)"); - Integer globalId1 = given() - .when() - .contentType(CT_JSON) - .pathParam("groupId", GROUP) - .pathParam("artifactId", "testGetArtifactMetaDataByContent/EmptyAPI") - .body(searchContent) - .post("/registry/v3/groups/{groupId}/artifacts/{artifactId}") - .then() - .statusCode(200) - .body("type", equalTo(ArtifactType.OPENAPI)) - .extract().body().path("globalId"); - - // Now add some extra whitespace/formatting to the content and try again - searchContent = searchContent.replace("{", "{\n").replace("}", "\n}"); - Integer globalId2 = given() - .when() - .contentType(CT_JSON) - .pathParam("groupId", GROUP) - .pathParam("artifactId", "testGetArtifactMetaDataByContent/EmptyAPI") - .queryParam("canonical", "true") - .body(searchContent) - .post("/registry/v3/groups/{groupId}/artifacts/{artifactId}") - .then() - .statusCode(200) - .body("type", equalTo(ArtifactType.OPENAPI)) - .extract().body().path("globalId"); - - // Should return the same meta-data - assertEquals(globalId1, globalId2); - - // Try the same (extra whitespace) content but without the "canonical=true" param (should fail with 404) - searchContent = searchContent.replace("{", "{\n").replace("}", "\n}"); - given() - .when() - .contentType(CT_JSON) - .pathParam("groupId", GROUP) - .pathParam("artifactId", "testGetArtifactMetaDataByContent/EmptyAPI") - .body(searchContent) - .post("/registry/v3/groups/{groupId}/artifacts/{artifactId}") - .then() - .statusCode(404); - - // Get meta-data by empty content (400 error) - given() - .when() - .contentType(CT_JSON) - .pathParam("groupId", GROUP) - .pathParam("artifactId", "testGetArtifactMetaDataByContent/EmptyAPI") - .body("") - .post("/registry/v3/groups/{groupId}/artifacts/{artifactId}") - .then() - .statusCode(400); - - } - @Test public void testArtifactRules() throws Exception { String artifactContent = resourceToString("openapi-empty.json"); @@ -1789,7 +1706,7 @@ public void testArtifactMetaData() throws Exception { .statusCode(200) .body("artifactId", equalTo("testGetArtifactMetaData/EmptyAPI")) .body("version", anything()) - .body("type", equalTo(ArtifactType.OPENAPI)) + .body("artifactType", equalTo(ArtifactType.OPENAPI)) .body("createdOn", anything()) .body("name", equalTo("Empty API")) .body("description", equalTo("An example API design using OpenAPI.")) @@ -1854,7 +1771,7 @@ public void testArtifactMetaData() throws Exception { .then() .statusCode(200) .body("artifactId", equalTo("testGetArtifactMetaData/EmptyAPI")) - .body("type", equalTo(ArtifactType.OPENAPI)); + .body("artifactType", equalTo(ArtifactType.OPENAPI)); // Verify the artifact meta-data name and description are still set. given() @@ -1937,7 +1854,7 @@ public void testArtifactVersionMetaData() throws Exception { .then() .statusCode(200) .body("version", notNullValue()) - .body("type", equalTo(ArtifactType.OPENAPI)) + .body("artifactType", equalTo(ArtifactType.OPENAPI)) .extract().body().path("version"); // Create another new version of the artifact @@ -1954,7 +1871,7 @@ public void testArtifactVersionMetaData() throws Exception { .then() .statusCode(200) .body("version", notNullValue()) - .body("type", equalTo(ArtifactType.OPENAPI)) + .body("artifactType", equalTo(ArtifactType.OPENAPI)) .extract().body().path("version"); // Get meta-data for v2 @@ -1967,7 +1884,7 @@ public void testArtifactVersionMetaData() throws Exception { .then() .statusCode(200) .body("version", equalTo(version2)) - .body("type", equalTo(ArtifactType.OPENAPI)) + .body("artifactType", equalTo(ArtifactType.OPENAPI)) .body("createdOn", anything()) .body("name", equalTo("Empty API (VERSION 2)")) .body("description", equalTo("An example API design using OpenAPI.")) @@ -1997,7 +1914,7 @@ public void testArtifactVersionMetaData() throws Exception { .then() .statusCode(200) .body("version", equalTo(version2)) - .body("type", equalTo(ArtifactType.OPENAPI)) + .body("artifactType", equalTo(ArtifactType.OPENAPI)) .body("createdOn", anything()) .body("name", equalTo("Updated Name")) .body("description", equalTo("Updated description.")); @@ -2012,7 +1929,7 @@ public void testArtifactVersionMetaData() throws Exception { .then() .statusCode(200) .body("version", equalTo(version3)) - .body("type", equalTo(ArtifactType.OPENAPI)) + .body("artifactType", equalTo(ArtifactType.OPENAPI)) .body("createdOn", anything()) .body("name", equalTo("Empty API (VERSION 3)")) .body("description", equalTo("An example API design using OpenAPI.")); @@ -2050,7 +1967,7 @@ public void testYamlContentType() throws Exception { .body("artifact.artifactId", equalTo(artifactId)) .body("artifact.name", equalTo("Empty API")) .body("artifact.description", equalTo("An example API design using OpenAPI.")) - .body("artifact.type", equalTo(artifactType)); + .body("artifact.artifactType", equalTo(artifactType)); // Get the artifact content (should still be YAML) RestAssured.registerParser("application/x-yaml", Parser.JSON); @@ -2082,7 +1999,7 @@ public void testWsdlArtifact() throws Exception { .then() .statusCode(200) .body("artifact.artifactId", equalTo(artifactId)) - .body("artifact.type", equalTo(artifactType)); + .body("artifact.artifactType", equalTo(artifactType)); // Get the artifact content (should be XML) given() @@ -2131,7 +2048,7 @@ public void testCreateAlreadyExistingArtifact() throws Exception { .post("/registry/v3/groups/{groupId}/artifacts") .then() .statusCode(200) - .body("artifact.type", equalTo(ArtifactType.OPENAPI)) + .body("artifact.artifactType", equalTo(ArtifactType.OPENAPI)) .body("version.version", equalTo("1")) .body("artifact.createdOn", anything()); @@ -2146,7 +2063,7 @@ public void testCreateAlreadyExistingArtifact() throws Exception { .post("/registry/v3/groups/{groupId}/artifacts") .then() .statusCode(200) - .body("artifact.type", equalTo(ArtifactType.OPENAPI)) + .body("artifact.artifactType", equalTo(ArtifactType.OPENAPI)) .body("artifact.createdOn", anything()) .body("version.version", equalTo("2")); /*Integer globalId2 = */ @@ -2163,7 +2080,7 @@ public void testCreateAlreadyExistingArtifact() throws Exception { .post("/registry/v3/groups/{groupId}/artifacts") .then() .statusCode(200) - .body("artifact.type", equalTo(ArtifactType.OPENAPI)); + .body("artifact.artifactType", equalTo(ArtifactType.OPENAPI)); Integer globalId3 = resp.extract().body().path("version.globalId"); @@ -2186,7 +2103,7 @@ public void testCreateAlreadyExistingArtifact() throws Exception { .body("version.version", equalTo("3")) .body("version.name", equalTo(artifactName)) .body("version.description", equalTo(artifactDescription)) - .body("artifact.type", equalTo(ArtifactType.OPENAPI)); + .body("artifact.artifactType", equalTo(ArtifactType.OPENAPI)); } @Test @@ -2340,7 +2257,7 @@ public void testCustomArtifactVersion() throws Exception { .statusCode(200) .body("artifactId", equalTo(artifactId)) .body("version", equalTo("1.0.1")) - .body("type", equalTo(ArtifactType.OPENAPI)); + .body("artifactType", equalTo(ArtifactType.OPENAPI)); // List the artifact versions given() @@ -2369,7 +2286,7 @@ public void testCustomArtifactVersion() throws Exception { .statusCode(200) .body("artifactId", equalTo(artifactId)) .body("version", equalTo("1.0.2")) - .body("type", equalTo(ArtifactType.OPENAPI)); + .body("artifactType", equalTo(ArtifactType.OPENAPI)); // List the artifact versions given() diff --git a/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/IdsResourceTest.java b/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/IdsResourceTest.java index ecdcb1264d..53abcf0be3 100644 --- a/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/IdsResourceTest.java +++ b/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/IdsResourceTest.java @@ -73,7 +73,7 @@ public void testIdsAfterCreate() throws Exception { .get("/registry/v3/groups/{groupId}/artifacts/{artifactId}/versions/branch=latest") .then() .statusCode(200) - .body("type", equalTo(ArtifactType.OPENAPI)) + .body("artifactType", equalTo(ArtifactType.OPENAPI)) .body("groupId", equalTo(GROUP)) .body("contentId", equalTo(createArtifactResponse1.getVersion().getContentId().intValue())); @@ -87,7 +87,7 @@ public void testIdsAfterCreate() throws Exception { .get("/registry/v3/groups/{groupId}/artifacts/{artifactId}/versions/branch=latest") .then() .statusCode(200) - .body("type", equalTo(ArtifactType.OPENAPI)) + .body("artifactType", equalTo(ArtifactType.OPENAPI)) .body("groupId", equalTo(GROUP)) .body("contentId", equalTo(createArtifactResponse2.getVersion().getContentId().intValue())); diff --git a/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/SearchGroupsTest.java b/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/SearchGroupsTest.java index 31366a1a8e..9d08724aeb 100644 --- a/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/SearchGroupsTest.java +++ b/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/SearchGroupsTest.java @@ -15,18 +15,18 @@ public class SearchGroupsTest extends AbstractResourceTestBase { @Test public void testSearchGroupsByName() throws Exception { + String groupId = "testSearchGroupsByName"; // Create 5 groups for (int idx = 0; idx < 5; idx++) { - String groupId = "testSearchGroupsByName" + idx; CreateGroup createGroup = new CreateGroup(); - createGroup.setGroupId(groupId); + createGroup.setGroupId(groupId + idx); clientV3.groups().post(createGroup); } GroupSearchResults results = clientV3.search().groups().get(request -> { - request.queryParameters.groupId = "testSearchGroupsByName"; + request.queryParameters.groupId = groupId + "1"; }); - Assertions.assertEquals(5, results.getGroups().size()); + Assertions.assertEquals(1, results.getGroups().size()); results = clientV3.search().groups().get(request -> { request.queryParameters.groupId = "testSearchGroupsByName3"; @@ -37,20 +37,20 @@ public void testSearchGroupsByName() throws Exception { @Test public void testSearchGroupsByDescription() throws Exception { + String groupId = "testSearchGroupsByDescription"; // Create 5 groups for (int idx = 0; idx < 5; idx++) { - String groupId = "testSearchGroupsByDescription" + idx; String description = "Description of group number " + idx; CreateGroup createGroup = new CreateGroup(); - createGroup.setGroupId(groupId); + createGroup.setGroupId(groupId + idx); createGroup.setDescription(description); clientV3.groups().post(createGroup); } GroupSearchResults results = clientV3.search().groups().get(request -> { - request.queryParameters.groupId = "testSearchGroupsByDescription"; + request.queryParameters.groupId = groupId + "1"; }); - Assertions.assertEquals(5, results.getGroups().size()); + Assertions.assertEquals(1, results.getGroups().size()); results = clientV3.search().groups().get(request -> { request.queryParameters.description = "Description of group number 3"; @@ -62,9 +62,9 @@ public void testSearchGroupsByDescription() throws Exception { @Test public void testSearchGroupsByLabels() throws Exception { + String groupId = "testSearchGroupsByLabels"; // Create 5 groups for (int idx = 0; idx < 5; idx++) { - String groupId = "testSearchGroupsByLabels" + idx; Labels labels = new Labels(); labels.setAdditionalData(Map.of( "byLabels", "byLabels-value-" + idx, @@ -72,15 +72,15 @@ public void testSearchGroupsByLabels() throws Exception { )); CreateGroup createGroup = new CreateGroup(); - createGroup.setGroupId(groupId); + createGroup.setGroupId(groupId + idx); createGroup.setLabels(labels); clientV3.groups().post(createGroup); } GroupSearchResults results = clientV3.search().groups().get(request -> { - request.queryParameters.groupId = "testSearchGroupsByLabels"; + request.queryParameters.groupId = groupId + "1"; }); - Assertions.assertEquals(5, results.getGroups().size()); + Assertions.assertEquals(1, results.getGroups().size()); results = clientV3.search().groups().get(request -> { request.queryParameters.labels = new String[]{ "byLabels" }; diff --git a/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/SearchVersionsTest.java b/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/SearchVersionsTest.java new file mode 100644 index 0000000000..63dd9ce364 --- /dev/null +++ b/app/src/test/java/io/apicurio/registry/noprofile/rest/v3/SearchVersionsTest.java @@ -0,0 +1,179 @@ +package io.apicurio.registry.noprofile.rest.v3; + +import io.apicurio.registry.AbstractResourceTestBase; +import io.apicurio.registry.rest.client.models.SearchedVersion; +import io.apicurio.registry.rest.client.models.VersionSearchResults; +import io.apicurio.registry.types.ArtifactType; +import io.apicurio.registry.types.ContentTypes; +import io.apicurio.registry.utils.tests.TestUtils; +import io.quarkus.test.junit.QuarkusTest; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +@QuarkusTest +public class SearchVersionsTest extends AbstractResourceTestBase { + + @Test + public void testSearchVersionsByGroupId() throws Exception { + String artifactContent = resourceToString("openapi-empty.json"); + String group1 = TestUtils.generateGroupId(); + String group2 = TestUtils.generateGroupId(); + + // Create 5 artifacts in group 1 + for (int idx = 0; idx < 5; idx++) { + String artifactId = "testSearchVersionsByGroupId_Group1_Artifact_" + idx; + createArtifact(group1, artifactId, ArtifactType.OPENAPI, artifactContent, ContentTypes.APPLICATION_JSON); + } + // Create 3 artifacts in group 2 + for (int idx = 0; idx < 3; idx++) { + String artifactId = "testSearchVersionsByGroupId_Group2_Artifact_" + idx; + this.createArtifact(group2, artifactId, ArtifactType.OPENAPI, artifactContent, ContentTypes.APPLICATION_JSON); + } + + VersionSearchResults results = clientV3.search().versions().get(config -> { + config.queryParameters.groupId = group1; + }); + Assertions.assertEquals(5, results.getCount()); + for (SearchedVersion version : results.getVersions()) { + Assertions.assertEquals(group1, version.getGroupId()); + } + + results = clientV3.search().versions().get(config -> { + config.queryParameters.groupId = group2; + }); + Assertions.assertEquals(3, results.getCount()); + for (SearchedVersion version : results.getVersions()) { + Assertions.assertEquals(group2, version.getGroupId()); + } + } + + @Test + public void testSearchVersionsByArtifactId() throws Exception { + String artifactContent = resourceToString("openapi-empty.json"); + String group1 = TestUtils.generateGroupId(); + String group2 = TestUtils.generateGroupId(); + + // Create 5 artifacts in group 1 (two versions each) + for (int idx = 0; idx < 5; idx++) { + String artifactId = "testSearchVersionsByArtifactId_Group1_Artifact_" + idx; + createArtifact(group1, artifactId, ArtifactType.OPENAPI, artifactContent, ContentTypes.APPLICATION_JSON); + createArtifactVersion(group1, artifactId, artifactContent, ContentTypes.APPLICATION_JSON); + } + // Create 3 artifacts in group 2 + for (int idx = 0; idx < 3; idx++) { + String artifactId = "testSearchVersionsByArtifactId_Group2_Artifact_" + idx; + createArtifact(group2, artifactId, ArtifactType.OPENAPI, artifactContent, ContentTypes.APPLICATION_JSON); + } + + VersionSearchResults results = clientV3.search().versions().get(config -> { + config.queryParameters.artifactId = "testSearchVersionsByArtifactId_Group1_Artifact_1"; + }); + Assertions.assertEquals(2, results.getCount()); + + results = clientV3.search().versions().get(config -> { + config.queryParameters.artifactId = "testSearchVersionsByArtifactId_Group2_Artifact_0"; + }); + Assertions.assertEquals(1, results.getCount()); + } + + @Test + public void testSearchVersionsByContent() throws Exception { + String artifactContent = resourceToString("openapi-empty.json"); + String group = TestUtils.generateGroupId(); + String searchByCommonContent = artifactContent.replaceAll("Empty API", "testSearchVersionsByContent-empty-api"); + String searchByUniqueContent = artifactContent.replaceAll("Empty API", "testSearchVersionsByContent-empty-api-2"); + String searchByUnknownContent = artifactContent.replaceAll("\\{", " {\n"); + + // Create 5 artifacts with two versions each in the test group + for (int idx = 0; idx < 5; idx++) { + String name = "testSearchVersionsByContent-empty-api-" + idx; + String artifactId = TestUtils.generateArtifactId(); + String uniqueContent = artifactContent.replaceAll("Empty API", name); + String commonContent = searchByCommonContent; + // First version is common content (same for every artifact) + createArtifact(group, artifactId, ArtifactType.OPENAPI, commonContent, ContentTypes.APPLICATION_JSON); + // Second version is unique to each artifact + createArtifactVersion(group, artifactId, uniqueContent, ContentTypes.APPLICATION_JSON); + } + + VersionSearchResults results = clientV3.search().versions().post(asInputStream(searchByCommonContent), ContentTypes.APPLICATION_JSON); + Assertions.assertEquals(5, results.getCount()); + + results = clientV3.search().versions().post(asInputStream(searchByUniqueContent), ContentTypes.APPLICATION_JSON); + Assertions.assertEquals(1, results.getCount()); + + results = clientV3.search().versions().post(asInputStream(searchByUnknownContent), ContentTypes.APPLICATION_JSON); + Assertions.assertEquals(0, results.getCount()); + } + + @Test + public void testSearchVersionsByCanonicalContent() throws Exception { + String artifactContent = resourceToString("openapi-empty.json"); + String group = TestUtils.generateGroupId(); + String searchByCommonContent = artifactContent.replaceAll("Empty API", "testSearchVersionsByCanonicalContent-empty-api"); + String searchByUniqueContent = artifactContent.replaceAll("Empty API", "testSearchVersionsByCanonicalContent-empty-api-2"); + String searchByCanonicalContent = searchByUniqueContent.replaceAll("\\{", " {\n"); + + // Create 5 artifacts with two versions each in the test group + for (int idx = 0; idx < 5; idx++) { + String name = "testSearchVersionsByCanonicalContent-empty-api-" + idx; + String artifactId = TestUtils.generateArtifactId(); + String uniqueContent = artifactContent.replaceAll("Empty API", name); + String commonContent = searchByCommonContent; + // First version is common content (same for every artifact) + createArtifact(group, artifactId, ArtifactType.OPENAPI, commonContent, ContentTypes.APPLICATION_JSON); + // Second version is unique to each artifact + createArtifactVersion(group, artifactId, uniqueContent, ContentTypes.APPLICATION_JSON); + } + + VersionSearchResults results = clientV3.search().versions().post(asInputStream(searchByCommonContent), ContentTypes.APPLICATION_JSON); + Assertions.assertEquals(5, results.getCount()); + + results = clientV3.search().versions().post(asInputStream(searchByUniqueContent), ContentTypes.APPLICATION_JSON); + Assertions.assertEquals(1, results.getCount()); + + results = clientV3.search().versions().post(asInputStream(searchByCanonicalContent), ContentTypes.APPLICATION_JSON); + Assertions.assertEquals(0, results.getCount()); + + results = clientV3.search().versions().post(asInputStream(searchByCanonicalContent), ContentTypes.APPLICATION_JSON, (config) -> { + config.queryParameters.canonical = true; + config.queryParameters.artifactType = ArtifactType.OPENAPI; + }); + Assertions.assertEquals(1, results.getCount()); + } + + @Test + public void testSearchVersionsByContentInGA() throws Exception { + String artifactContent = resourceToString("openapi-empty.json"); + String group = TestUtils.generateGroupId(); + String searchByCommonContent = artifactContent.replaceAll("Empty API", "testSearchVersionsByContentInGA-empty-api"); + String searchByArtifactId = ""; + + // Create 5 artifacts with two versions each in the test group + for (int idx = 0; idx < 5; idx++) { + String name = "testSearchVersionsByContentInGA-empty-api-" + idx; + String artifactId = TestUtils.generateArtifactId(); + String uniqueContent = artifactContent.replaceAll("Empty API", name); + String commonContent = searchByCommonContent; + // First version is common content (same for every artifact) + createArtifact(group, artifactId, ArtifactType.OPENAPI, commonContent, ContentTypes.APPLICATION_JSON); + // Second version is unique to each artifact + createArtifactVersion(group, artifactId, uniqueContent, ContentTypes.APPLICATION_JSON); + + // Save the final artifactId to filter by + searchByArtifactId = artifactId; + } + + VersionSearchResults results = clientV3.search().versions().post(asInputStream(searchByCommonContent), ContentTypes.APPLICATION_JSON); + Assertions.assertEquals(5, results.getCount()); + + // Same search, but also filter by groupId and artifactId - should be just 1 + final String aid = searchByArtifactId; + results = clientV3.search().versions().post(asInputStream(searchByCommonContent), ContentTypes.APPLICATION_JSON, config -> { + config.queryParameters.groupId = group; + config.queryParameters.artifactId = aid; + }); + Assertions.assertEquals(1, results.getCount()); + } + +} diff --git a/app/src/test/java/io/apicurio/registry/rbac/RegistryClientTest.java b/app/src/test/java/io/apicurio/registry/rbac/RegistryClientTest.java index 36732e9a5f..3e14b236c3 100644 --- a/app/src/test/java/io/apicurio/registry/rbac/RegistryClientTest.java +++ b/app/src/test/java/io/apicurio/registry/rbac/RegistryClientTest.java @@ -29,7 +29,6 @@ import io.apicurio.registry.rest.client.models.SortOrder; import io.apicurio.registry.rest.client.models.UpdateConfigurationProperty; import io.apicurio.registry.rest.client.models.UpdateRole; -import io.apicurio.registry.rest.client.models.VersionContent; import io.apicurio.registry.rest.client.models.VersionMetaData; import io.apicurio.registry.rest.client.models.VersionSearchResults; import io.apicurio.registry.rest.client.models.VersionState; @@ -70,7 +69,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -847,45 +845,6 @@ public void testArtifactNotFound() { Assertions.assertEquals("ArtifactNotFoundException", exception.getName()); } - @Test - public void getArtifactVersionMetadataByContent() throws Exception { - //Preparation - final String groupId = "getArtifactVersionMetadataByContent"; - final String artifactId = generateArtifactId(); - - createArtifact(groupId, artifactId); - - //Execution - VersionContent vc = new VersionContent(); - vc.setContent(ARTIFACT_CONTENT); - vc.setContentType(ContentTypes.APPLICATION_JSON); - final VersionMetaData versionMetaData = clientV3.groups().byGroupId(groupId).artifacts().byArtifactId(artifactId).post(vc); - - assertNotNull(versionMetaData); - - //Create a second artifact using the same content but with a reference, since this version has references, a new artifact version must be created. - var secondArtifactId = generateArtifactId(); - var artifactReference = new ArtifactReference(); - - artifactReference.setName("testReference"); - artifactReference.setArtifactId(artifactId); - artifactReference.setGroupId(groupId); - artifactReference.setVersion("1"); - - var artifactReferences = List.of(artifactReference); - - createArtifactWithReferences(groupId, secondArtifactId, artifactReferences); - - VersionContent vc2 = new VersionContent(); - vc2.setContent(ARTIFACT_CONTENT); - vc2.setContentType(ContentTypes.APPLICATION_JSON); - vc2.setReferences(artifactReferences); - - final VersionMetaData secondVersionMetadata = clientV3.groups().byGroupId(groupId).artifacts().byArtifactId(secondArtifactId).post(vc2); - - assertNotEquals(secondVersionMetadata.getContentId(), versionMetaData.getContentId()); - } - @Test public void getContentByHash() throws Exception { //Preparation @@ -1507,7 +1466,7 @@ public void testForceArtifactType() throws Exception { var meta = clientV3.groups().byGroupId(groupId).artifacts().byArtifactId(artifactId).get(); - assertEquals(ArtifactType.AVRO, meta.getType()); + assertEquals(ArtifactType.AVRO, meta.getArtifactType()); assertTrue(clientV3.groups().byGroupId(groupId).artifacts().byArtifactId(artifactId).versions().byVersionExpression("branch=latest").content().get().readAllBytes().length > 0); } @@ -1534,27 +1493,4 @@ public void testClientRateLimitError() { mock.stop(); } } - - @Test - public void testGetArtifactVersionByContent_DuplicateContent() throws Exception { - //Preparation - final String groupId = "testGetArtifactVersionByContent_DuplicateContent"; - final String artifactId = generateArtifactId(); - - final VersionMetaData v1md = createArtifact(groupId, artifactId); - - CreateVersion createVersion = TestUtils.clientCreateVersion(ARTIFACT_CONTENT, ContentTypes.APPLICATION_JSON); - final VersionMetaData v2md = clientV3.groups().byGroupId(groupId).artifacts().byArtifactId(artifactId).versions().post(createVersion); - - //Execution - final VersionMetaData vmd = clientV3.groups().byGroupId(groupId).artifacts().byArtifactId(artifactId).post(createVersion.getContent()); - - //Assertions - assertNotEquals(v1md.getGlobalId(), v2md.getGlobalId()); - assertEquals(v1md.getContentId(), v2md.getContentId()); - - assertEquals(v2md.getGlobalId(), vmd.getGlobalId()); - assertEquals(v2md.getArtifactId(), vmd.getArtifactId()); - assertEquals(v2md.getContentId(), vmd.getContentId()); - } } diff --git a/app/src/test/java/io/apicurio/registry/storage/impl/readonly/ReadOnlyRegistryStorageTest.java b/app/src/test/java/io/apicurio/registry/storage/impl/readonly/ReadOnlyRegistryStorageTest.java index a46184b98f..270987cf52 100644 --- a/app/src/test/java/io/apicurio/registry/storage/impl/readonly/ReadOnlyRegistryStorageTest.java +++ b/app/src/test/java/io/apicurio/registry/storage/impl/readonly/ReadOnlyRegistryStorageTest.java @@ -128,7 +128,7 @@ public class ReadOnlyRegistryStorageTest { entry("resolveReferences1", new State(false, s -> s.resolveReferences(null))), entry("searchArtifacts5", new State(false, s -> s.searchArtifacts(null, null, null, 0, 0))), entry("searchGroups5", new State(false, s -> s.searchGroups(null, null, null, null, null))), - entry("searchVersions6", new State(false, s -> s.searchVersions(null, null, null, null, 0, 0))), + entry("searchVersions5", new State(false, s -> s.searchVersions(null, null, null, 0, 0))), entry("setConfigProperty1", new State(true, s -> { var dto = new DynamicConfigPropertyDto(); dto.setName("test"); diff --git a/common/src/main/resources/META-INF/openapi.json b/common/src/main/resources/META-INF/openapi.json index 208bcefd0d..c387d8299d 100644 --- a/common/src/main/resources/META-INF/openapi.json +++ b/common/src/main/resources/META-INF/openapi.json @@ -1,4635 +1,4771 @@ { - "openapi": "3.0.3", - "info": { - "title": "Apicurio Registry API [v3]", - "version": "3.0.x", - "description": "Apicurio Registry is a datastore for standard event schemas and API designs. Apicurio Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility.\n\nThe Apicurio Registry REST API enables client applications to manage the artifacts in the registry. This API provides create, read, update, and delete operations for schema and API artifacts, rules, versions, and metadata. \n\nThe supported artifact types include:\n- Apache Avro schema\n- AsyncAPI specification\n- Google protocol buffers\n- GraphQL schema\n- JSON Schema\n- Kafka Connect schema\n- OpenAPI specification\n- Web Services Description Language\n- XML Schema Definition\n\n\n**Important**: The Apicurio Registry REST API is available from `https://MY-REGISTRY-URL/apis/registry/v3` by default. Therefore you must prefix all API operation paths with `../apis/registry/v3` in this case. For example: `../apis/registry/v3/ids/globalIds/{globalId}`.\n", - "contact": { - "name": "Apicurio", - "url": "https://github.com/apicurio/apicurio-registry", - "email": "apicurio@lists.jboss.org" - }, - "license": { - "name": "Apache 2.0", - "url": "https://www.apache.org/licenses/LICENSE-2.0" - } + "openapi": "3.0.3", + "info": { + "title": "Apicurio Registry API [v3]", + "version": "3.0.x", + "description": "Apicurio Registry is a datastore for standard event schemas and API designs. Apicurio Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility.\n\nThe Apicurio Registry REST API enables client applications to manage the artifacts in the registry. This API provides create, read, update, and delete operations for schema and API artifacts, rules, versions, and metadata. \n\nThe supported artifact types include:\n- Apache Avro schema\n- AsyncAPI specification\n- Google protocol buffers\n- GraphQL schema\n- JSON Schema\n- Kafka Connect schema\n- OpenAPI specification\n- Web Services Description Language\n- XML Schema Definition\n\n\n**Important**: The Apicurio Registry REST API is available from `https://MY-REGISTRY-URL/apis/registry/v3` by default. Therefore you must prefix all API operation paths with `../apis/registry/v3` in this case. For example: `../apis/registry/v3/ids/globalIds/{globalId}`.\n", + "contact": { + "name": "Apicurio", + "url": "https://github.com/apicurio/apicurio-registry", + "email": "apicurio@lists.jboss.org" }, - "paths": { - "/ids/globalIds/{globalId}": { - "summary": "Access artifact content utilizing an artifact version's globally unique identifier.", - "get": { - "tags": [ - "Artifacts" - ], - "parameters": [ - { - "name": "references", - "description": "Allows the user to specify how references in the content should be treated.", - "schema": { - "$ref": "#/components/schemas/HandleReferencesType" - }, - "in": "query" - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/ArtifactContent" - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getContentByGlobalId", - "summary": "Get artifact by global ID", - "description": "Gets the content for an artifact version in the registry using its globally unique\nidentifier.\n\nThis operation may fail for one of the following reasons:\n\n* No artifact version with this `globalId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + "license": { + "name": "Apache 2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0" + } + }, + "paths": { + "/ids/globalIds/{globalId}": { + "summary": "Access artifact content utilizing an artifact version's globally unique identifier.", + "get": { + "tags": [ + "Artifacts" + ], + "parameters": [ + { + "name": "references", + "description": "Allows the user to specify how references in the content should be treated.", + "schema": { + "$ref": "#/components/schemas/HandleReferencesType" }, - "parameters": [ - { - "name": "globalId", - "description": "Global identifier for an artifact version.", - "schema": { - "format": "int64", - "type": "integer" - }, - "in": "path", - "required": true + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/ArtifactContent" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "getContentByGlobalId", + "summary": "Get artifact by global ID", + "description": "Gets the content for an artifact version in the registry using its globally unique\nidentifier.\n\nThis operation may fail for one of the following reasons:\n\n* No artifact version with this `globalId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "parameters": [ + { + "name": "globalId", + "description": "Global identifier for an artifact version.", + "schema": { + "format": "int64", + "type": "integer" + }, + "in": "path", + "required": true + } + ] + }, + "/admin/rules": { + "summary": "Manage the global rules that apply to all artifacts if not otherwise configured.", + "get": { + "tags": [ + "Global rules", + "Admin" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RuleType" + } } - ] - }, - "/admin/rules": { - "summary": "Manage the global rules that apply to all artifacts if not otherwise configured.", - "get": { - "tags": [ - "Global rules", - "Admin" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RuleType" - } - } - } - }, - "description": "The list of names of the globally configured rules." - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "listGlobalRules", - "summary": "List global rules", - "description": "Gets a list of all the currently configured global rules (if any).\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" - }, - "post": { - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Rule" - } - } - }, - "required": true - }, - "tags": [ - "Global rules", - "Admin" - ], - "responses": { - "204": { - "description": "The global rule was added." - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "409": { - "$ref": "#/components/responses/Conflict" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "createGlobalRule", - "summary": "Create global rule", - "description": "Adds a rule to the list of globally configured rules.\n\nThis operation can fail for the following reasons:\n\n* The rule type is unknown (HTTP error `400`)\n* The rule already exists (HTTP error `409`)\n* A server error occurred (HTTP error `500`)\n" + } }, - "delete": { - "tags": [ - "Global rules", - "Admin" - ], - "responses": { - "204": { - "description": "All global rules have been removed successfully." - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "deleteAllGlobalRules", - "summary": "Delete all global rules", - "description": "Deletes all globally configured rules.\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" - } + "description": "The list of names of the globally configured rules." + }, + "500": { + "$ref": "#/components/responses/ServerError" + } }, - "/admin/rules/{rule}": { - "summary": "Manage the configuration of a single global artifact rule.", - "get": { - "tags": [ - "Global rules", - "Admin" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Rule" - } - } - }, - "description": "The global rule's configuration." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getGlobalRuleConfig", - "summary": "Get global rule configuration", - "description": "Returns information about the named globally configured rule.\n\nThis operation can fail for the following reasons:\n\n* Invalid rule name/type (HTTP error `400`)\n* No rule with name/type `rule` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" - }, - "put": { - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Rule" - } - } - }, - "required": true - }, - "tags": [ - "Global rules", - "Admin" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Rule" - } - } - }, - "description": "The global rule's configuration was successfully updated." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "updateGlobalRuleConfig", - "summary": "Update global rule configuration", - "description": "Updates the configuration for a globally configured rule.\n\nThis operation can fail for the following reasons:\n\n* Invalid rule name/type (HTTP error `400`)\n* No rule with name/type `rule` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" - }, - "delete": { - "tags": [ - "Global rules", - "Admin" - ], - "responses": { - "204": { - "description": "The global rule was successfully deleted." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "deleteGlobalRule", - "summary": "Delete global rule", - "description": "Deletes a single global rule. If this is the only rule configured, this is the same\nas deleting **all** rules.\n\nThis operation can fail for the following reasons:\n\n* Invalid rule name/type (HTTP error `400`)\n* No rule with name/type `rule` exists (HTTP error `404`)\n* Rule cannot be deleted (HTTP error `409`)\n* A server error occurred (HTTP error `500`)\n" - }, - "parameters": [ - { - "name": "rule", - "description": "The unique name/type of a rule.", - "schema": { - "$ref": "#/components/schemas/RuleType" - }, - "in": "path", - "required": true - } - ] - }, - "/system/info": { - "summary": "Retrieve system information", - "get": { - "tags": [ - "System" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SystemInfo" - } - } - }, - "description": "On success, returns the system information." - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getSystemInfo", - "summary": "Get system information", - "description": "This operation retrieves information about the running registry system, such as the version\nof the software and when it was built." + "operationId": "listGlobalRules", + "summary": "List global rules", + "description": "Gets a list of all the currently configured global rules (if any).\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" + }, + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Rule" + } } + }, + "required": true }, - "/search/artifacts": { - "summary": "Search for artifacts in the registry.", - "get": { - "tags": [ - "Search", - "Artifacts" - ], - "parameters": [ - { - "name": "name", - "description": "Filter by artifact name.", - "schema": { - "type": "string" - }, - "in": "query" - }, - { - "name": "offset", - "description": "The number of artifacts to skip before starting to collect the result set. Defaults to 0.", - "schema": { - "default": 0, - "type": "integer" - }, - "in": "query", - "required": false - }, - { - "name": "limit", - "description": "The number of artifacts to return. Defaults to 20.", - "schema": { - "default": 20, - "type": "integer" - }, - "in": "query", - "required": false - }, - { - "name": "order", - "description": "Sort order, ascending (`asc`) or descending (`desc`).", - "schema": { - "$ref": "#/components/schemas/SortOrder" - }, - "in": "query" - }, - { - "name": "orderby", - "description": "The field to sort by. Can be one of:\n\n* `name`\n* `createdOn`\n", - "schema": { - "$ref": "#/components/schemas/ArtifactSortBy" - }, - "in": "query" - }, - { - "name": "labels", - "description": "Filter by one or more name/value label. Separate each name/value pair using a colon. For\nexample `labels=foo:bar` will return only artifacts with a label named `foo`\nand value `bar`.", - "schema": { - "type": "array", - "items": { - "type": "string" - } - }, - "in": "query" - }, - { - "name": "description", - "description": "Filter by description.", - "schema": { - "type": "string" - }, - "in": "query" - }, - { - "name": "groupId", - "description": "Filter by artifact group.", - "schema": { - "type": "string" - }, - "in": "query" - }, - { - "name": "globalId", - "description": "Filter by globalId.", - "schema": { - "format": "int64", - "type": "integer" - }, - "in": "query" - }, - { - "name": "contentId", - "description": "Filter by contentId.", - "schema": { - "format": "int64", - "type": "integer" - }, - "in": "query", - "required": false - }, - { - "name": "artifactId", - "description": "Filter by artifactId.", - "schema": { - "type": "string" - }, - "in": "query" - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ArtifactSearchResults" - } - } - }, - "description": "On a successful response, returns a result set of artifacts - one for each artifact\nin the registry that matches the criteria." - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "searchArtifacts", - "summary": "Search for artifacts", - "description": "Returns a paginated list of all artifacts that match the provided filter criteria.\n" + "tags": [ + "Global rules", + "Admin" + ], + "responses": { + "204": { + "description": "The global rule was added." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "409": { + "$ref": "#/components/responses/Conflict" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "createGlobalRule", + "summary": "Create global rule", + "description": "Adds a rule to the list of globally configured rules.\n\nThis operation can fail for the following reasons:\n\n* The rule type is unknown (HTTP error `400`)\n* The rule already exists (HTTP error `409`)\n* A server error occurred (HTTP error `500`)\n" + }, + "delete": { + "tags": [ + "Global rules", + "Admin" + ], + "responses": { + "204": { + "description": "All global rules have been removed successfully." + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "deleteAllGlobalRules", + "summary": "Delete all global rules", + "description": "Deletes all globally configured rules.\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" + } + }, + "/admin/rules/{rule}": { + "summary": "Manage the configuration of a single global artifact rule.", + "get": { + "tags": [ + "Global rules", + "Admin" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Rule" + } + } }, - "post": { - "requestBody": { - "description": "The content to search for.", - "content": { - "*/*": { - "schema": { - "$ref": "#/components/schemas/FileContent" - } - } - }, - "required": true - }, - "tags": [ - "Search", - "Artifacts" - ], - "parameters": [ - { - "name": "canonical", - "description": "Parameter that can be set to `true` to indicate that the server should \"canonicalize\" the content when searching for matching artifacts. Canonicalization is unique to each artifact type, but typically involves removing any extra whitespace and formatting the content in a consistent manner. Must be used along with the `artifactType` query parameter.", - "schema": { - "type": "boolean" - }, - "in": "query" - }, - { - "name": "artifactType", - "description": "Indicates the type of artifact represented by the content being used for the search. This is only needed when using the `canonical` query parameter, so that the server knows how to canonicalize the content prior to searching for matching artifacts.", - "schema": { - "$ref": "#/components/schemas/ArtifactType" - }, - "in": "query" - }, - { - "name": "offset", - "description": "The number of artifacts to skip before starting to collect the result set. Defaults to 0.", - "schema": { - "default": 0, - "type": "integer" - }, - "in": "query", - "required": false - }, - { - "name": "limit", - "description": "The number of artifacts to return. Defaults to 20.", - "schema": { - "default": 20, - "type": "integer" - }, - "in": "query", - "required": false - }, - { - "name": "order", - "description": "Sort order, ascending (`asc`) or descending (`desc`).", - "schema": { - "$ref": "#/components/schemas/SortOrder" - }, - "in": "query" - }, - { - "name": "orderby", - "description": "The field to sort by. Can be one of:\n\n* `name`\n* `createdOn`\n", - "schema": { - "$ref": "#/components/schemas/ArtifactSortBy" - }, - "in": "query" - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ArtifactSearchResults" - } - } - }, - "description": "On a successful response, returns a result set of artifacts - one for each artifact\nin the registry that matches the criteria." - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "searchArtifactsByContent", - "summary": "Search for artifacts by content", - "description": "Returns a paginated list of all artifacts with at least one version that matches the\nposted content.\n" - } + "description": "The global rule's configuration." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } }, - "/admin/export": { - "summary": "Provides a way to export registry data.", - "get": { - "tags": [ - "Admin" - ], - "parameters": [ - { - "name": "forBrowser", - "description": "Indicates if the operation is done for a browser. If true, the response will be a JSON payload with a property called `href`. This `href` will be a single-use, naked download link suitable for use by a web browser to download the content.", - "schema": { - "type": "boolean" - }, - "in": "query" - } - ], - "responses": { - "200": { - "content": { - "application/zip": { - "schema": { - "$ref": "#/components/schemas/FileContent" - } - }, - "application/json": { - "schema": { - "$ref": "#/components/schemas/DownloadRef" - } - } - }, - "description": "Response when the export is successful." - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "exportData", - "summary": "Export registry data", - "description": "Exports registry data as a ZIP archive." + "operationId": "getGlobalRuleConfig", + "summary": "Get global rule configuration", + "description": "Returns information about the named globally configured rule.\n\nThis operation can fail for the following reasons:\n\n* Invalid rule name/type (HTTP error `400`)\n* No rule with name/type `rule` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "put": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Rule" + } } + }, + "required": true }, - "/admin/import": { - "summary": "Provides a way to import data into the registry.", - "post": { - "requestBody": { - "description": "The ZIP file representing the previously exported registry data.", - "content": { - "application/zip": { - "schema": { - "$ref": "#/components/schemas/FileContent" - } - } - }, - "required": true - }, - "tags": [ - "Admin" - ], - "parameters": [ - { - "name": "X-Registry-Preserve-GlobalId", - "description": "If this header is set to false, global ids of imported data will be ignored and replaced by next id in global id sequence. This allows to import any data even thought the global ids would cause a conflict.", - "schema": { - "type": "boolean" - }, - "in": "header" - }, - { - "name": "X-Registry-Preserve-ContentId", - "description": "If this header is set to false, content ids of imported data will be ignored and replaced by next id in content id sequence. The mapping between content and artifacts will be preserved. This allows to import any data even thought the content ids would cause a conflict.", - "schema": { - "type": "boolean" - }, - "in": "header", - "required": false - } - ], - "responses": { - "201": { - "description": "Indicates that the import was successful." - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "importData", - "summary": "Import registry data", - "description": "Imports registry data that was previously exported using the `/admin/export` operation." - } + "tags": [ + "Global rules", + "Admin" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Rule" + } + } + }, + "description": "The global rule's configuration was successfully updated." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } }, - "/groups/{groupId}/artifacts/{artifactId}/versions/{versionExpression}": { - "summary": "Manage a single version of a single artifact in the registry.", - "get": { - "tags": [ - "Metadata" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VersionMetaData" - } - } - }, - "description": "The artifact version's metadata." - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getArtifactVersionMetaData", - "summary": "Get artifact version metadata", - "description": "Retrieves the metadata for a single version of the artifact. The version metadata is \na subset of the artifact metadata and only includes the metadata that is specific to\nthe version (for example, this doesn't include `modifiedOn`).\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No version with this `version` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + "operationId": "updateGlobalRuleConfig", + "summary": "Update global rule configuration", + "description": "Updates the configuration for a globally configured rule.\n\nThis operation can fail for the following reasons:\n\n* Invalid rule name/type (HTTP error `400`)\n* No rule with name/type `rule` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "delete": { + "tags": [ + "Global rules", + "Admin" + ], + "responses": { + "204": { + "description": "The global rule was successfully deleted." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "deleteGlobalRule", + "summary": "Delete global rule", + "description": "Deletes a single global rule. If this is the only rule configured, this is the same\nas deleting **all** rules.\n\nThis operation can fail for the following reasons:\n\n* Invalid rule name/type (HTTP error `400`)\n* No rule with name/type `rule` exists (HTTP error `404`)\n* Rule cannot be deleted (HTTP error `409`)\n* A server error occurred (HTTP error `500`)\n" + }, + "parameters": [ + { + "name": "rule", + "description": "The unique name/type of a rule.", + "schema": { + "$ref": "#/components/schemas/RuleType" + }, + "in": "path", + "required": true + } + ] + }, + "/system/info": { + "summary": "Retrieve system information", + "get": { + "tags": [ + "System" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SystemInfo" + } + } }, - "put": { - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/EditableVersionMetaData" - } - } - }, - "required": true - }, - "tags": [ - "Metadata" - ], - "responses": { - "204": { - "description": "The artifact version's metadata was successfully updated." - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "updateArtifactVersionMetaData", - "summary": "Update artifact version metadata", - "description": "Updates the user-editable portion of the artifact version's metadata. Only some of \nthe metadata fields are editable by the user. For example, `description` is editable, \nbut `createdOn` is not.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No version with this `version` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + "description": "On success, returns the system information." + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "getSystemInfo", + "summary": "Get system information", + "description": "This operation retrieves information about the running registry system, such as the version\nof the software and when it was built." + } + }, + "/search/artifacts": { + "summary": "Search for artifacts in the registry.", + "get": { + "tags": [ + "Search", + "Artifacts" + ], + "parameters": [ + { + "name": "name", + "description": "Filter by artifact name.", + "schema": { + "type": "string" }, - "delete": { - "tags": [ - "Versions" - ], - "responses": { - "204": { - "description": "The artifact version was successfully deleted." - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "405": { - "$ref": "#/components/responses/MethodNotAllowed" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "deleteArtifactVersion", - "summary": "Delete artifact version", - "description": "Deletes a single version of the artifact. Parameters `groupId`, `artifactId` and the unique `version`\nare needed. If this is the only version of the artifact, this operation is the same as \ndeleting the entire artifact.\n\nThis feature is disabled by default and it's discouraged for normal usage. To enable it, set the `registry.rest.artifact.deletion.enabled` property to true. This operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No version with this `version` exists (HTTP error `404`)\n * Feature is disabled (HTTP error `405`)\n * A server error occurred (HTTP error `500`)\n" + "in": "query" + }, + { + "name": "offset", + "description": "The number of artifacts to skip before starting to collect the result set. Defaults to 0.", + "schema": { + "default": 0, + "type": "integer" }, - "parameters": [ - { - "name": "groupId", - "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/GroupId" - }, - "in": "path", - "required": true - }, - { - "name": "artifactId", - "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/ArtifactId" - }, - "in": "path", - "required": true - }, - { - "name": "versionExpression", - "description": "An expression resolvable to a specific version ID within the given group and artifact. The following rules apply:\n\n - If the expression is in the form \"branch={branchId}\", and artifact branch {branchId} exists: The expression is resolved to a version that the branch points to.\n - Otherwise: The expression is resolved to a version with the same ID, which must follow the \"[a-zA-Z0-9._\\\\-+]{1,256}\" pattern.", - "schema": { - "type": "string" - }, - "in": "path", - "required": true - } - ] - }, - "/groups/{groupId}/artifacts/{artifactId}/rules": { - "summary": "Manage the rules for a single artifact.", - "get": { - "tags": [ - "Artifact rules" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RuleType" - } - } - } - }, - "description": "Returns the names of the rules configured for the artifact." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "listArtifactRules", - "summary": "List artifact rules", - "description": "Returns a list of all rules configured for the artifact. The set of rules determines\nhow the content of an artifact can evolve over time. If no rules are configured for\nan artifact, the set of globally configured rules are used. If no global rules \nare defined, there are no restrictions on content evolution.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)" + "in": "query", + "required": false + }, + { + "name": "limit", + "description": "The number of artifacts to return. Defaults to 20.", + "schema": { + "default": 20, + "type": "integer" }, - "post": { - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Rule" - } - } - }, - "required": true - }, - "tags": [ - "Artifact rules" - ], - "responses": { - "204": { - "description": "The rule was added." - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "createArtifactRule", - "summary": "Create artifact rule", - "description": "Adds a rule to the list of rules that get applied to the artifact when adding new\nversions. All configured rules must pass to successfully add a new artifact version.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* Rule (named in the request body) is unknown (HTTP error `400`)\n* A server error occurred (HTTP error `500`)" + "in": "query", + "required": false + }, + { + "name": "order", + "description": "Sort order, ascending (`asc`) or descending (`desc`).", + "schema": { + "$ref": "#/components/schemas/SortOrder" }, - "delete": { - "tags": [ - "Artifact rules" - ], - "responses": { - "204": { - "description": "The rules were successfully deleted." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "deleteArtifactRules", - "summary": "Delete artifact rules", - "description": "Deletes all of the rules configured for the artifact. After this is done, the global\nrules apply to the artifact again.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)" + "in": "query" + }, + { + "name": "orderby", + "description": "The field to sort by. Can be one of:\n\n* `name`\n* `createdOn`\n", + "schema": { + "$ref": "#/components/schemas/ArtifactSortBy" }, - "parameters": [ - { - "name": "groupId", - "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/GroupId" - }, - "in": "path", - "required": true - }, - { - "name": "artifactId", - "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/ArtifactId" - }, - "in": "path", - "required": true - } - ] - }, - "/groups/{groupId}/artifacts/{artifactId}/rules/{rule}": { - "summary": "Manage the configuration of a single artifact rule.", - "get": { - "tags": [ - "Artifact rules" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Rule" - } - } - }, - "description": "Information about a rule." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getArtifactRuleConfig", - "summary": "Get artifact rule configuration", - "description": "Returns information about a single rule configured for an artifact. This is useful\nwhen you want to know what the current configuration settings are for a specific rule.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No rule with this name/type is configured for this artifact (HTTP error `404`)\n* Invalid rule type (HTTP error `400`)\n* A server error occurred (HTTP error `500`)" + "in": "query" + }, + { + "name": "labels", + "description": "Filter by one or more name/value label. Separate each name/value pair using a colon. For\nexample `labels=foo:bar` will return only artifacts with a label named `foo`\nand value `bar`.", + "schema": { + "type": "array", + "items": { + "type": "string" + } }, - "put": { - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Rule" - } - } - }, - "required": true - }, - "tags": [ - "Artifact rules" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Rule" - } - } - }, - "description": "Rule configuration was updated." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "updateArtifactRuleConfig", - "summary": "Update artifact rule configuration", - "description": "Updates the configuration of a single rule for the artifact. The configuration data\nis specific to each rule type, so the configuration of the `COMPATIBILITY` rule \nis in a different format from the configuration of the `VALIDITY` rule.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No rule with this name/type is configured for this artifact (HTTP error `404`)\n* Invalid rule type (HTTP error `400`)\n* A server error occurred (HTTP error `500`)\n" + "in": "query" + }, + { + "name": "description", + "description": "Filter by description.", + "schema": { + "type": "string" }, - "delete": { - "tags": [ - "Artifact rules" - ], - "responses": { - "204": { - "description": "The rule was successfully deleted." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "deleteArtifactRule", - "summary": "Delete artifact rule", - "description": "Deletes a rule from the artifact. This results in the rule no longer applying for\nthis artifact. If this is the only rule configured for the artifact, this is the \nsame as deleting **all** rules, and the globally configured rules now apply to\nthis artifact.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No rule with this name/type is configured for this artifact (HTTP error `404`)\n* Invalid rule type (HTTP error `400`)\n* A server error occurred (HTTP error `500`)" + "in": "query" + }, + { + "name": "groupId", + "description": "Filter by artifact group.", + "schema": { + "type": "string" }, - "parameters": [ - { - "name": "groupId", - "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/GroupId" - }, - "in": "path", - "required": true - }, - { - "name": "artifactId", - "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/ArtifactId" - }, - "in": "path", - "required": true - }, - { - "name": "rule", - "description": "The unique name/type of a rule.", - "schema": { - "enum": [ - "VALIDITY", - "COMPATIBILITY", - "INTEGRITY" - ], - "type": "string" - }, - "in": "path", - "required": true - } - ] - }, - "/admin/roleMappings/{principalId}": { - "summary": "Manage the configuration of a single role mapping.", - "get": { - "tags": [ - "Admin" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RoleMapping" - } - } - }, - "description": "When successful, returns the details of a role mapping." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getRoleMapping", - "summary": "Return a single role mapping", - "description": "Gets the details of a single role mapping (by `principalId`).\n\nThis operation can fail for the following reasons:\n\n* No role mapping for the `principalId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + "in": "query" + }, + { + "name": "globalId", + "description": "Filter by globalId.", + "schema": { + "format": "int64", + "type": "integer" }, - "put": { - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateRole" - } - } - }, - "required": true - }, - "tags": [ - "Admin" - ], - "responses": { - "204": { - "description": "Response when the update is successful." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "updateRoleMapping", - "summary": "Update a role mapping", - "description": "Updates a single role mapping for one user/principal.\n\nThis operation can fail for the following reasons:\n\n* No role mapping for the principalId exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + "in": "query" + }, + { + "name": "contentId", + "description": "Filter by contentId.", + "schema": { + "format": "int64", + "type": "integer" }, - "delete": { - "tags": [ - "Admin" - ], - "responses": { - "204": { - "description": "Response returned when the delete was successful." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "deleteRoleMapping", - "summary": "Delete a role mapping", - "description": "Deletes a single role mapping, effectively denying access to a user/principal.\n\nThis operation can fail for the following reasons:\n\n* No role mapping for the principalId exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + "in": "query", + "required": false + }, + { + "name": "artifactId", + "description": "Filter by artifactId.", + "schema": { + "type": "string" }, - "parameters": [ - { - "name": "principalId", - "description": "Unique id of a principal (typically either a user or service account).", - "schema": { - "type": "string" - }, - "in": "path", - "required": true + "in": "query" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ArtifactSearchResults" } - ] - }, - "/users/me": { - "summary": "Retrieves information about the current user", - "get": { - "tags": [ - "Users" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserInfo" - } - } - }, - "description": "Response when the endpoint is successfully invoked." - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getCurrentUserInfo", - "summary": "Get current user", - "description": "Returns information about the currently authenticated user." + } + }, + "description": "On a successful response, returns a result set of artifacts - one for each artifact\nin the registry that matches the criteria." + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "searchArtifacts", + "summary": "Search for artifacts", + "description": "Returns a paginated list of all artifacts that match the provided filter criteria.\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" + }, + "post": { + "requestBody": { + "description": "The content to search for.", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/FileContent" + } } + }, + "required": true }, - "/ids/contentIds/{contentId}/references": { - "get": { - "tags": [ - "Artifacts" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ArtifactReference" - } - } - } - }, - "description": "A list containing all the references for the artifact with the given content id." - } - }, - "operationId": "referencesByContentId", - "summary": "List artifact references by content ID", - "description": "Returns a list containing all the artifact references using the artifact content ID.\n\nThis operation may fail for one of the following reasons:\n\n* A server error occurred (HTTP error `500`)" + "tags": [ + "Search", + "Artifacts" + ], + "parameters": [ + { + "name": "canonical", + "description": "Parameter that can be set to `true` to indicate that the server should \"canonicalize\" the content when searching for matching artifacts. Canonicalization is unique to each artifact type, but typically involves removing any extra whitespace and formatting the content in a consistent manner. Must be used along with the `artifactType` query parameter.", + "schema": { + "type": "boolean" }, - "parameters": [ - { - "name": "contentId", - "description": "Global identifier for a single artifact content.", - "schema": { - "format": "int64", - "type": "integer" - }, - "in": "path", - "required": true - } - ] - }, - "/ids/globalIds/{globalId}/references": { - "get": { - "tags": [ - "Artifacts" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ArtifactReference" - } - } - } - }, - "description": "A list containing all the references for the artifact with the given global id." - } - }, - "operationId": "referencesByGlobalId", - "summary": "List artifact references by global ID", - "description": "Returns a list containing all the artifact references using the artifact global ID.\n\nThis operation may fail for one of the following reasons:\n\n* A server error occurred (HTTP error `500`)" + "in": "query" + }, + { + "name": "artifactType", + "description": "Indicates the type of artifact represented by the content being used for the search. This is only needed when using the `canonical` query parameter, so that the server knows how to canonicalize the content prior to searching for matching artifacts.", + "schema": { + "$ref": "#/components/schemas/ArtifactType" }, - "parameters": [ - { - "name": "globalId", - "description": "Global identifier for an artifact version.", - "schema": { - "format": "int64", - "type": "integer" - }, - "in": "path", - "required": true - }, - { - "name": "refType", - "description": "Determines the type of reference to return, either INBOUND or OUTBOUND. Defaults to OUTBOUND.", - "schema": { - "$ref": "#/components/schemas/ReferenceType" - }, - "in": "query" + "in": "query" + }, + { + "name": "groupId", + "description": "Filter by artifact group.", + "schema": { + "type": "string" + }, + "in": "query" + }, + { + "name": "offset", + "description": "The number of artifacts to skip before starting to collect the result set. Defaults to 0.", + "schema": { + "default": 0, + "type": "integer" + }, + "in": "query", + "required": false + }, + { + "name": "limit", + "description": "The number of artifacts to return. Defaults to 20.", + "schema": { + "default": 20, + "type": "integer" + }, + "in": "query", + "required": false + }, + { + "name": "order", + "description": "Sort order, ascending (`asc`) or descending (`desc`).", + "schema": { + "$ref": "#/components/schemas/SortOrder" + }, + "in": "query" + }, + { + "name": "orderby", + "description": "The field to sort by. Can be one of:\n\n* `name`\n* `createdOn`\n", + "schema": { + "$ref": "#/components/schemas/ArtifactSortBy" + }, + "in": "query" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ArtifactSearchResults" } - ] - }, - "/groups/{groupId}/artifacts/{artifactId}/versions/{versionExpression}/references": { - "summary": "Manage the references for a single version of an artifact in the registry.", - "get": { - "tags": [ - "Versions" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ArtifactReference" - } - } - } - }, - "description": "List of all the artifact references for this artifact." - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getArtifactVersionReferences", - "summary": "Get artifact version references", - "description": "Retrieves all references for a single version of an artifact. Both the `artifactId` and the\nunique `version` number must be provided. Using the `refType` query parameter, it is possible\nto retrieve an array of either the inbound or outbound references.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No version with this `version` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + } }, - "parameters": [ - { - "name": "groupId", - "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/GroupId" - }, - "in": "path", - "required": true - }, - { - "name": "artifactId", - "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/ArtifactId" - }, - "in": "path", - "required": true - }, - { - "name": "versionExpression", - "description": "An expression resolvable to a specific version ID within the given group and artifact. The following rules apply:\n\n - If the expression is in the form \"branch={branchId}\", and artifact branch {branchId} exists: The expression is resolved to a version that the branch points to.\n - Otherwise: The expression is resolved to a version with the same ID, which must follow the \"[a-zA-Z0-9._\\\\-+]{1,256}\" pattern.", - "schema": { - "type": "string" - }, - "in": "path", - "required": true - }, - { - "name": "refType", - "description": "Determines the type of reference to return, either INBOUND or OUTBOUND. Defaults to OUTBOUND.", - "schema": { - "$ref": "#/components/schemas/ReferenceType" - }, - "in": "query", - "required": false + "description": "On a successful response, returns a result set of artifacts - one for each artifact\nin the registry that matches the criteria." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "searchArtifactsByContent", + "summary": "Search for artifacts by content", + "description": "Returns a paginated list of all artifacts with at least one version that matches the\nposted content.\n\nThis operation can fail for the following reasons:\n\n* Provided content (request body) was empty (HTTP error `400`)\n* A server error occurred (HTTP error `500`)\n" + } + }, + "/admin/export": { + "summary": "Provides a way to export registry data.", + "get": { + "tags": [ + "Admin" + ], + "parameters": [ + { + "name": "forBrowser", + "description": "Indicates if the operation is done for a browser. If true, the response will be a JSON payload with a property called `href`. This `href` will be a single-use, naked download link suitable for use by a web browser to download the content.", + "schema": { + "type": "boolean" + }, + "in": "query" + } + ], + "responses": { + "200": { + "content": { + "application/zip": { + "schema": { + "$ref": "#/components/schemas/FileContent" } - ] - }, - "/admin/config/properties": { - "summary": "Manage configuration properties.", - "get": { - "tags": [ - "Admin" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ConfigurationProperty" - } - } - } - }, - "description": "On a successful response, returns a list of configuration properties." - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "listConfigProperties", - "summary": "List all configuration properties", - "description": "Returns a list of all configuration properties that have been set. The list is not paged.\n\nThis operation may fail for one of the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" + }, + "application/json": { + "schema": { + "$ref": "#/components/schemas/DownloadRef" + } + } + }, + "description": "Response when the export is successful." + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "exportData", + "summary": "Export registry data", + "description": "Exports registry data as a ZIP archive." + } + }, + "/admin/import": { + "summary": "Provides a way to import data into the registry.", + "post": { + "requestBody": { + "description": "The ZIP file representing the previously exported registry data.", + "content": { + "application/zip": { + "schema": { + "$ref": "#/components/schemas/FileContent" + } } + }, + "required": true }, - "/admin/config/properties/{propertyName}": { - "summary": "Manage a single configuration property (by name).", - "get": { - "tags": [ - "Admin" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ConfigurationProperty" - } - } - }, - "description": "The configuration property value." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getConfigProperty", - "summary": "Get configuration property value", - "description": "Returns the value of a single configuration property.\n\nThis operation may fail for one of the following reasons:\n\n* Property not found or not configured (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + "tags": [ + "Admin" + ], + "parameters": [ + { + "name": "X-Registry-Preserve-GlobalId", + "description": "If this header is set to false, global ids of imported data will be ignored and replaced by next id in global id sequence. This allows to import any data even thought the global ids would cause a conflict.", + "schema": { + "type": "boolean" }, - "put": { - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UpdateConfigurationProperty" - } - } - }, - "required": true - }, - "tags": [ - "Admin" - ], - "responses": { - "204": { - "description": "The configuration property was updated." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "updateConfigProperty", - "summary": "Update a configuration property", - "description": "Updates the value of a single configuration property.\n\nThis operation may fail for one of the following reasons:\n\n* Property not found or not configured (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" - }, - "delete": { - "tags": [ - "Admin" - ], - "responses": { - "204": { - "description": "The configuration property was deleted." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "resetConfigProperty", - "summary": "Reset a configuration property", - "description": "Resets the value of a single configuration property. This will return the property to\nits default value (see external documentation for supported properties and their default\nvalues).\n\nThis operation may fail for one of the following reasons:\n\n* Property not found or not configured (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" - }, - "parameters": [ - { - "name": "propertyName", - "description": "The name of a configuration property.", - "schema": { - "type": "string" - }, - "in": "path", - "required": true - } - ] - }, - "/system/limits": { - "summary": "Retrieve resource limits information", - "get": { - "tags": [ - "System" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Limits" - } - } - }, - "description": "On success, returns resource limits" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getResourceLimits", - "summary": "Get resource limits information", - "description": "This operation retrieves the list of limitations on used resources, that are applied on the current instance of Registry." - } - }, - "/groups/{groupId}/artifacts": { - "summary": "Manage the collection of artifacts within a single group in the registry.", - "get": { - "tags": [ - "Artifacts" - ], - "parameters": [ - { - "name": "limit", - "description": "The number of artifacts to return. Defaults to 20.", - "schema": { - "type": "integer" - }, - "in": "query" - }, - { - "name": "offset", - "description": "The number of artifacts to skip before starting the result set. Defaults to 0.", - "schema": { - "type": "integer" - }, - "in": "query" - }, - { - "name": "order", - "description": "Sort order, ascending (`asc`) or descending (`desc`).", - "schema": { - "$ref": "#/components/schemas/SortOrder" - }, - "in": "query" - }, - { - "name": "orderby", - "description": "The field to sort by. Can be one of:\n\n* `name`\n* `createdOn`\n", - "schema": { - "$ref": "#/components/schemas/ArtifactSortBy" - }, - "in": "query" - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ArtifactSearchResults" - } - } - }, - "description": "On a successful response, returns a bounded set of artifacts." - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "listArtifactsInGroup", - "summary": "List artifacts in group", - "description": "Returns a list of all artifacts in the group. This list is paged." - }, - "post": { - "requestBody": { - "description": "The artifact being created.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateArtifact" - } - } - }, - "required": true - }, - "tags": [ - "Artifacts" - ], - "parameters": [ - { - "name": "ifExists", - "description": "Set this option to instruct the server on what to do if the artifact already exists.", - "schema": { - "$ref": "#/components/schemas/IfArtifactExists" - }, - "in": "query" - }, - { - "name": "canonical", - "description": "Used only when the `ifExists` query parameter is set to `RETURN_OR_UPDATE`, this parameter can be set to `true` to indicate that the server should \"canonicalize\" the content when searching for a matching version. The canonicalization algorithm is unique to each artifact type, but typically involves removing extra whitespace and formatting the content in a consistent manner.", - "schema": { - "type": "boolean" - }, - "in": "query" - }, - { - "name": "dryRun", - "description": "When set to `true`, the operation will not result in any changes. Instead, it\nwill return a result based on whether the operation **would have succeeded**.", - "schema": { - "type": "boolean" - }, - "in": "query" - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateArtifactResponse" - } - } - }, - "description": "Artifact was successfully created." - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "409": { - "$ref": "#/components/responses/RuleViolationConflict" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "createArtifact", - "summary": "Create artifact", - "description": "Creates a new artifact. The body of the request should be a `CreateArtifact` \nobject, which includes the metadata of the new artifact and, optionally, the \nmetadata and content of the first version.\n\nIf the artifact type is not provided, the registry attempts to figure out what \nkind of artifact is being added from the\nfollowing supported list:\n\n* Avro (`AVRO`)\n* Protobuf (`PROTOBUF`)\n* JSON Schema (`JSON`)\n* Kafka Connect (`KCONNECT`)\n* OpenAPI (`OPENAPI`)\n* AsyncAPI (`ASYNCAPI`)\n* GraphQL (`GRAPHQL`)\n* Web Services Description Language (`WSDL`)\n* XML Schema (`XSD`)\n\nAn artifact will be created using the unique artifact ID that can optionally be \nprovided in the request body. If not provided in the request, the server will\ngenerate a unique ID for the artifact. It is typically recommended that callers\nprovide the ID, because it is typically a meaningful identifier, and as such\nfor most use cases should be supplied by the caller.\n\nIf an artifact with the provided artifact ID already exists, the default behavior\nis for the server to reject the content with a 409 error. However, the caller can\nsupply the `ifExists` query parameter to alter this default behavior. The `ifExists`\nquery parameter can have one of the following values:\n\n* `FAIL` (*default*) - server rejects the content with a 409 error\n* `UPDATE` - server updates the existing artifact and returns the new metadata\n* `RETURN` - server does not create or add content to the server, but instead \nreturns the metadata for the existing artifact\n* `RETURN_OR_UPDATE` - server returns an existing **version** that matches the \nprovided content if such a version exists, otherwise a new version is created\n\nThis operation may fail for one of the following reasons:\n\n* An invalid `ArtifactType` was indicated (HTTP error `400`)\n* No `ArtifactType` was indicated and the server could not determine one from the content (HTTP error `400`)\n* Provided content (request body) was empty (HTTP error `400`)\n* An artifact with the provided ID already exists (HTTP error `409`)\n* The content violates one of the configured global rules (HTTP error `409`)\n* A server error occurred (HTTP error `500`)\n\nNote that if the `dryRun` query parameter is set to `true`, then this operation\nwill not actually make any changes. Instead it will succeed or fail based on \nwhether it **would have worked**. Use this option to, for example, check if an\nartifact is valid or if a new version passes configured compatibility checks." - }, - "delete": { - "tags": [ - "Artifacts" - ], - "responses": { - "204": { - "description": "When the delete operation is successful, a simple 204 is returned." - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "deleteArtifactsInGroup", - "summary": "Delete artifacts in group", - "description": "Deletes all of the artifacts that exist in a given group." - }, - "parameters": [ - { - "name": "groupId", - "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/GroupId" - }, - "in": "path", - "required": true - } - ] - }, - "/groups": { - "summary": "Collection of the groups in the registry.", - "get": { - "tags": [ - "Groups" - ], - "parameters": [ - { - "name": "limit", - "description": "The number of groups to return. Defaults to 20.", - "schema": { - "type": "integer" - }, - "in": "query" - }, - { - "name": "offset", - "description": "The number of groups to skip before starting the result set. Defaults to 0.", - "schema": { - "type": "integer" - }, - "in": "query" - }, - { - "name": "order", - "description": "Sort order, ascending (`asc`) or descending (`desc`).", - "schema": { - "$ref": "#/components/schemas/SortOrder" - }, - "in": "query" - }, - { - "name": "orderby", - "description": "The field to sort by. Can be one of:\n\n* `name`\n* `createdOn`\n", - "schema": { - "$ref": "#/components/schemas/GroupSortBy" - }, - "in": "query" - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GroupSearchResults" - } - } - }, - "description": "On a successful response, returns a bounded set of groups." - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "listGroups", - "summary": "List groups", - "description": "Returns a list of all groups. This list is paged." - }, - "post": { - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateGroup" - } - } - }, - "required": true - }, - "tags": [ - "Groups" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GroupMetaData" - } - } - }, - "description": "The group has been successfully created." - }, - "409": { - "$ref": "#/components/responses/Conflict" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "createGroup", - "summary": "Create a new group", - "description": "Creates a new group.\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n* The group already exist (HTTP error `409`)\n" - } - }, - "/groups/{groupId}/artifacts/{artifactId}/versions/{versionExpression}/comments": { - "summary": "Manage a collection of comments for an artifact version", - "get": { - "tags": [ - "Versions" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Comment" - } - } - } - }, - "description": "List of all the comments for this artifact." - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getArtifactVersionComments", - "summary": "Get artifact version comments", - "description": "Retrieves all comments for a version of an artifact. Both the `artifactId` and the\nunique `version` number must be provided.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No version with this `version` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" - }, - "post": { - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/NewComment" - } - } - }, - "required": true - }, - "tags": [ - "Versions" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Comment" - } - } - }, - "description": "The comment was successfully created." - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "addArtifactVersionComment", - "summary": "Add new comment", - "description": "Adds a new comment to the artifact version. Both the `artifactId` and the\nunique `version` number must be provided.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No version with this `version` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" - }, - "parameters": [ - { - "name": "groupId", - "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/GroupId" - }, - "in": "path", - "required": true - }, - { - "name": "artifactId", - "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/ArtifactId" - }, - "in": "path", - "required": true - }, - { - "name": "versionExpression", - "description": "An expression resolvable to a specific version ID within the given group and artifact. The following rules apply:\n\n - If the expression is in the form \"branch={branchId}\", and artifact branch {branchId} exists: The expression is resolved to a version that the branch points to.\n - Otherwise: The expression is resolved to a version with the same ID, which must follow the \"[a-zA-Z0-9._\\\\-+]{1,256}\" pattern.", - "schema": { - "type": "string" - }, - "in": "path", - "required": true - } - ] - }, - "/groups/{groupId}/artifacts/{artifactId}/versions/{versionExpression}/comments/{commentId}": { - "summary": "Manage a single comment", - "put": { - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/NewComment" - } - } - }, - "required": true - }, - "tags": [ - "Versions" - ], - "responses": { - "204": { - "description": "The value of the comment was successfully changed." - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "updateArtifactVersionComment", - "summary": "Update a comment", - "description": "Updates the value of a single comment in an artifact version. Only the owner of the\ncomment can modify it. The `artifactId`, unique `version` number, and `commentId` \nmust be provided.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No version with this `version` exists (HTTP error `404`)\n* No comment with this `commentId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" - }, - "delete": { - "tags": [ - "Versions" - ], - "responses": { - "204": { - "description": "The comment was successfully deleted." - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "deleteArtifactVersionComment", - "summary": "Delete a single comment", - "description": "Deletes a single comment in an artifact version. Only the owner of the\ncomment can delete it. The `artifactId`, unique `version` number, and `commentId` \nmust be provided.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No version with this `version` exists (HTTP error `404`)\n* No comment with this `commentId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" - }, - "parameters": [ - { - "name": "groupId", - "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/GroupId" - }, - "in": "path", - "required": true - }, - { - "name": "artifactId", - "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/ArtifactId" - }, - "in": "path", - "required": true - }, - { - "name": "versionExpression", - "description": "An expression resolvable to a specific version ID within the given group and artifact. The following rules apply:\n\n - If the expression is in the form \"branch={branchId}\", and artifact branch {branchId} exists: The expression is resolved to a version that the branch points to.\n - Otherwise: The expression is resolved to a version with the same ID, which must follow the \"[a-zA-Z0-9._\\\\-+]{1,256}\" pattern.", - "schema": { - "type": "string" - }, - "in": "path", - "required": true - }, - { - "name": "commentId", - "description": "The unique identifier of a single comment.", - "schema": { - "type": "string" - }, - "in": "path", - "required": true - } - ] - }, - "/groups/{groupId}/artifacts/{artifactId}/branches": { - "summary": "Manage branches of an artifact.", - "get": { - "tags": [ - "Branches" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ArtifactBranch" - } - } - } - }, - "description": "List of all artifact versions." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "listArtifactBranches", - "summary": "List artifact branches", - "description": "Returns a list of all branches in the artifact. Each branch is a list of version identifiers,\nordered from the latest (tip of the branch) to the oldest.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" - }, - "parameters": [ - { - "name": "groupId", - "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/GroupId" - }, - "in": "path", - "required": true - }, - { - "name": "artifactId", - "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/ArtifactId" - }, - "in": "path", - "required": true - } - ] - }, - "/groups/{groupId}/artifacts/{artifactId}/versions": { - "summary": "Manage all the versions of an artifact in the registry.", - "get": { - "tags": [ - "Versions" - ], - "parameters": [ - { - "name": "offset", - "description": "The number of versions to skip before starting to collect the result set. Defaults to 0.", - "schema": { - "type": "integer" - }, - "in": "query", - "required": false - }, - { - "name": "limit", - "description": "The number of versions to return. Defaults to 20.", - "schema": { - "type": "integer" - }, - "in": "query", - "required": false - }, - { - "name": "order", - "description": "Sort order, ascending (`asc`) or descending (`desc`).", - "schema": { - "$ref": "#/components/schemas/SortOrder" - }, - "in": "query" - }, - { - "name": "orderby", - "description": "The field to sort by. Can be one of:\n\n* `name`\n* `version`\n* `createdOn`\n", - "schema": { - "$ref": "#/components/schemas/VersionSortBy" - }, - "in": "query" - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VersionSearchResults" - }, - "examples": { - "All Versions": { - "value": [ - 5, - 6, - 10, - 103 - ] - } - } - } - }, - "description": "List of all artifact versions." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "listArtifactVersions", - "summary": "List artifact versions", - "description": "Returns a list of all versions of the artifact. The result set is paged.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" - }, - "post": { - "requestBody": { - "description": "The version to be created.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CreateVersion" - } - } - }, - "required": true - }, - "tags": [ - "Versions" - ], - "parameters": [ - { - "name": "dryRun", - "description": "When set to `true`, the operation will not result in any changes. Instead, it\nwill return a result based on whether the operation **would have succeeded**.", - "schema": { - "type": "boolean" - }, - "in": "query" - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VersionMetaData" - } - } - }, - "description": "The artifact version was successfully created." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "409": { - "$ref": "#/components/responses/RuleViolationConflict" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "createArtifactVersion", - "summary": "Create artifact version", - "description": "Creates a new version of the artifact by uploading new content. The configured rules for\nthe artifact are applied, and if they all pass, the new content is added as the most recent \nversion of the artifact. If any of the rules fail, an error is returned.\n\nThe body of the request can be the raw content of the new artifact version, or the raw content \nand a set of references pointing to other artifacts, and the type\nof that content should match the artifact's type (for example if the artifact type is `AVRO`\nthen the content of the request should be an Apache Avro document).\n\nThis operation can fail for the following reasons:\n\n* Provided content (request body) was empty (HTTP error `400`)\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* The new content violates one of the rules configured for the artifact (HTTP error `409`)\n* A server error occurred (HTTP error `500`)\n" - }, - "parameters": [ - { - "name": "groupId", - "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/GroupId" - }, - "in": "path", - "required": true - }, - { - "name": "artifactId", - "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/ArtifactId" - }, - "in": "path", - "required": true - } - ] - }, - "/groups/{groupId}/artifacts/{artifactId}/branches/{branchId}": { - "summary": "Manage a single artifact branch.", - "get": { - "tags": [ - "Branches" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ArtifactBranch" - } - } - }, - "description": "List of versions in an artifact branch." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getArtifactBranch", - "summary": "List versions in an artifact branch", - "description": "Returns a list of version identifiers in the artifact branch, ordered from the latest (tip of the branch) to the oldest.\n\nThis operation can fail for the following reasons:\n\n* No group with this `groupId` exists (HTTP error `404`)\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No branch with this `branchId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" - }, - "put": { - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ArtifactBranch" - } - } - }, - "required": true - }, - "tags": [ - "Branches" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ArtifactBranch" - } - } - }, - "description": "List of versions in an artifact branch." - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "409": { - "$ref": "#/components/responses/Conflict" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "createOrReplaceArtifactBranch", - "summary": "Replace the sequence of versions contained in an artifact branch. Branch is created if it does not exist.", - "description": "Replace the sequence of versions contained in an artifact branch. Branch is created if it does not exist. This operation is equivalent to deleting the artifact branch and adding each version in order to a new branch with the same name. This operation can be used to remove one or more versions from the branch. Returns a list of version identifiers in the artifact branch, ordered from the latest (tip of the branch) to the oldest.\nThis operation can fail for the following reasons:\n* No group with this `groupId` exists (HTTP error `404`)\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* Version does not exist (HTTP error `409`)\n* Request contains duplicate versions. Artifact branches are append-only, cycles and history rewrites, except by this operation, are not supported. (HTTP error `409`)\n* A server error occurred (HTTP error `500`)\n" - }, - "post": { - "requestBody": { - "content": { - "text/plain": { - "schema": { - "$ref": "#/components/schemas/Version" - } - } - }, - "required": true - }, - "tags": [ - "Branches" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ArtifactBranch" - } - } - }, - "description": "List of versions in an artifact branch." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "409": { - "$ref": "#/components/responses/Conflict" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "createOrUpdateArtifactBranch", - "summary": "Add a new version to an artifact branch. Branch is created if it does not exist.", - "description": "Add a new version to an artifact branch. Branch is created if it does not exist. Returns a list of version identifiers in the artifact branch, ordered from the latest (tip of the branch) to the oldest.\nThis operation can fail for the following reasons:\n* No group with this `groupId` exists (HTTP error `404`)\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No branch with this `branchId` exists (HTTP error `404`)\n* Version does not exist (HTTP error `409`)\n* Branch already contains given version. Artifact branches are append-only, cycles and history rewrites, except by replacing the entire branch using createOrReplaceArtifactBranch operation, are not supported. (HTTP error `409`)\n* A server error occurred \n" - }, - "delete": { - "tags": [ - "Branches" - ], - "responses": { - "204": { - "description": "Artifact branch was successfully deleted." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "409": { - "$ref": "#/components/responses/Conflict" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "deleteArtifactBranch", - "summary": "Delete artifact branch.", - "description": "Deletes a single branch in the artifact. Any artifact versions that are not referenced by a branch are deleted as well, however, this does not happen until deletion of the \"latest\" branch is supported.\nThis operation can fail for the following reasons:\n* No group with this `groupId` exists (HTTP error `404`)\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No branch with this `branchId` exists (HTTP error `404`)\n* Deletion of the \"latest\" branch is not supported (HTTP error `409`)\n* A server error occurred (HTTP error `500`)\n" - }, - "parameters": [ - { - "name": "groupId", - "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/GroupId" - }, - "in": "path", - "required": true - }, - { - "name": "artifactId", - "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/ArtifactId" - }, - "in": "path", - "required": true - }, - { - "name": "branchId", - "description": "Artifact branch ID. Must follow the \"[a-zA-Z0-9._\\\\-+]{1,256}\" pattern.", - "schema": { - "$ref": "#/components/schemas/BranchId" - }, - "in": "path", - "required": true - } - ] - }, - "/system/uiConfig": { - "summary": "Get UI configuration", - "description": "This endpoint is used by the user interface to retrieve UI specific configuration\nin a JSON payload. This allows the UI and the backend to be configured in the \nsame place (the backend process/pod). When the UI loads, it will make an API call\nto this endpoint to determine what UI features and options are configured.", - "get": { - "tags": [ - "System" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/UserInterfaceConfig" - } - } - }, - "description": "The UI config." - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getUIConfig", - "summary": "Get UI config", - "description": "Returns the UI configuration properties for this server. The registry UI can be\nconnected to a backend using just a URL. The rest of the UI configuration can then\nbe fetched from the backend using this operation. This allows UI and backend to\nboth be configured in the same place.\n\nThis operation may fail for one of the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" - } - }, - "/ids/contentHashes/{contentHash}/references": { - "get": { - "tags": [ - "Artifacts" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ArtifactReference" - } - } - } - }, - "description": "A list containing all the references for the artifact with the given content hash." - } - }, - "operationId": "referencesByContentHash", - "summary": "List artifact references by hash", - "description": "Returns a list containing all the artifact references using the artifact content hash.\n\nThis operation may fail for one of the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" - }, - "parameters": [ - { - "name": "contentHash", - "description": "SHA-256 content hash for a single artifact content.", - "schema": { - "type": "string" - }, - "in": "path", - "required": true - } - ] - }, - "/ids/contentHashes/{contentHash}": { - "summary": "Access artifact content utilizing the SHA-256 hash of the content.", - "get": { - "tags": [ - "Artifacts" - ], - "responses": { - "200": { - "$ref": "#/components/responses/ArtifactContent" - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getContentByHash", - "summary": "Get artifact content by SHA-256 hash", - "description": "Gets the content for an artifact version in the registry using the \nSHA-256 hash of the content. This content hash may be shared by multiple artifact\nversions in the case where the artifact versions have identical content.\n\nThis operation may fail for one of the following reasons:\n\n* No content with this `contentHash` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" - }, - "parameters": [ - { - "name": "contentHash", - "description": "SHA-256 content hash for a single artifact content.", - "schema": { - "type": "string" - }, - "in": "path", - "required": true - } - ] - }, - "/ids/contentIds/{contentId}": { - "summary": "Access artifact content utilizing the unique content identifier for that content.", - "get": { - "tags": [ - "Artifacts" - ], - "responses": { - "200": { - "$ref": "#/components/responses/ArtifactContent" - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getContentById", - "summary": "Get artifact content by ID", - "description": "Gets the content for an artifact version in the registry using the unique content\nidentifier for that content. This content ID may be shared by multiple artifact\nversions in the case where the artifact versions are identical.\n\nThis operation may fail for one of the following reasons:\n\n* No content with this `contentId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" - }, - "parameters": [ - { - "name": "contentId", - "description": "Global identifier for a single artifact content.", - "schema": { - "format": "int64", - "type": "integer" - }, - "in": "path", - "required": true - } - ] - }, - "/groups/{groupId}": { - "summary": "Collection to manage a single group in the registry.", - "get": { - "tags": [ - "Groups" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GroupMetaData" - } - } - }, - "description": "The group's metadata." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getGroupById", - "summary": "Get a group by the specified ID.", - "description": "Returns a group using the specified id.\n\nThis operation can fail for the following reasons:\n\n* No group exists with the specified ID (HTTP error `404`)\n* A server error occurred (HTTP error `500`)" - }, - "put": { - "requestBody": { - "description": "The new group metadata.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/EditableGroupMetaData" - } - } - }, - "required": true - }, - "tags": [ - "Groups" - ], - "responses": { - "204": { - "description": "Empty response when the metadata is successfully updated." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "updateGroupById", - "summary": "Update group metadata", - "description": "Updates the metadata of a group using the specified id.\n\nThis operation can fail for the following reasons:\n\n* No group exists with the specified ID (HTTP error `404`)\n* A server error occurred (HTTP error `500`)" - }, - "delete": { - "tags": [ - "Groups" - ], - "responses": { - "204": { - "description": "Empty content indicates a successful deletion." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "deleteGroupById", - "summary": "Delete a group by the specified ID.", - "description": "Deletes a group by identifier. This operation also deletes all artifacts within\nthe group, so should be used very carefully.\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n* The group does not exist (HTTP error `404`)\n" - }, - "parameters": [ - { - "name": "groupId", - "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/GroupId" - }, - "in": "path", - "required": true - } - ] - }, - "/admin/roleMappings": { - "summary": "Collection to manage role mappings for authenticated principals", - "get": { - "tags": [ - "Admin" - ], - "parameters": [ - { - "name": "limit", - "description": "The number of role mappings to return. Defaults to 20.", - "schema": { - "type": "integer" - }, - "in": "query" - }, - { - "name": "offset", - "description": "The number of role mappings to skip before starting the result set. Defaults to 0.", - "schema": { - "type": "integer" - }, - "in": "query" - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RoleMappingSearchResults" - } - } - }, - "description": "A successful response will return the list of role mappings." - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "listRoleMappings", - "summary": "List all role mappings", - "description": "Gets a list of all role mappings configured in the registry (if any).\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" - }, - "post": { - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RoleMapping" - } - } - }, - "required": true - }, - "tags": [ - "Admin" - ], - "responses": { - "204": { - "description": "Returned when the role mapping was successfully created." - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "createRoleMapping", - "summary": "Create a new role mapping", - "description": "Creates a new mapping between a user/principal and a role.\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n\n" - } - }, - "/admin/config/artifactTypes": { - "summary": "The list of artifact types supported by this instance of Registry.", - "get": { - "tags": [ - "Artifact Type", - "Admin" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/ArtifactTypeInfo" - } - } - } - }, - "description": "The list of available artifact types." - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "listArtifactTypes", - "summary": "List artifact types", - "description": "Gets a list of all the configured artifact types.\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" - } - }, - "/admin/snapshots": { - "summary": "Triggers a snapshot of the Registry storage. Only supported in KafkaSQL storage", - "post": { - "tags": [ - "KafkaSQL", - "Admin", - "Snapshot" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/SnapshotMetaData" - } - } - }, - "description": "The snapshot has been successfully triggered." - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "triggerSnapshot", - "summary": "Trigger storage snapshot", - "description": "Triggers the creation of a snapshot of the internal database for compatible storages.\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" - } - }, - "/groups/{groupId}/artifacts/{artifactId}": { - "summary": "Manage a single artifact.", - "get": { - "tags": [ - "Metadata" - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ArtifactMetaData" - } - } - }, - "description": "The artifact's metadata." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getArtifactMetaData", - "summary": "Get artifact metadata", - "description": "Gets the metadata for an artifact in the registry, based on the latest version. If the latest version of the artifact is marked as `DISABLED`, the next available non-disabled version will be used. The returned metadata includes\nboth generated (read-only) and editable metadata (such as name and description).\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists or all versions are `DISABLED` (HTTP error `404`)\n* A server error occurred (HTTP error `500`)" - }, - "put": { - "requestBody": { - "description": "Updated artifact metadata.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/EditableArtifactMetaData" - } - } - }, - "required": true - }, - "tags": [ - "Metadata" - ], - "responses": { - "204": { - "description": "The artifact's metadata was updated." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "updateArtifactMetaData", - "summary": "Update artifact metadata", - "description": "Updates the editable parts of the artifact's metadata. Not all metadata fields can\nbe updated. Note that only the properties included will be updated. You can update\nonly the name by including only the `name` property in the payload of the request.\nProperties that are allowed but not present will result in the artifact's metadata\nnot being changed.\n\nThis operation can fail for the following reasons:\n\n* No artifact with the `artifactId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)" - }, - "post": { - "requestBody": { - "description": "The content of an artifact version.", - "content": { - "*/*": { - "schema": { - "$ref": "#/components/schemas/FileContent" - }, - "examples": { - "OpenAPI": { - "value": { - "openapi": "3.0.2", - "info": { - "title": "Empty API", - "version": "1.0.7", - "description": "An example API design using OpenAPI." - }, - "paths": { - "/widgets": { - "get": { - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "description": "All widgets" - } - }, - "summary": "Get widgets" - } - } - }, - "components": { - "schemas": { - "Widget": { - "title": "Root Type for Widget", - "description": "A sample data type.", - "type": "object", - "properties": { - "property-1": { - "type": "string" - }, - "property-2": { - "type": "boolean" - } - }, - "example": { - "property-1": "value1", - "property-2": true - } - } - } - } - } - } - } - }, - "application/get.extended+json": { - "schema": { - "$ref": "#/components/schemas/VersionContent" - } - }, - "application/vnd.get.extended+json": { - "schema": { - "$ref": "#/components/schemas/VersionContent" - } - } - }, - "required": true - }, - "tags": [ - "Metadata" - ], - "parameters": [ - { - "name": "canonical", - "description": "Parameter that can be set to `true` to indicate that the server should \"canonicalize\" the content when searching for a matching version. Canonicalization is unique to each artifact type, but typically involves removing any extra whitespace and formatting the content in a consistent manner.", - "schema": { - "type": "boolean" - }, - "in": "query" - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/VersionMetaData" - } - } - }, - "description": "The metadata of the artifact version matching the provided content." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getArtifactVersionMetaDataByContent", - "summary": "Get artifact version metadata by content", - "description": "Gets the metadata for an artifact that matches the raw content. Searches the registry\nfor a version of the given artifact matching the content provided in the body of the\nPOST.\n\nThis operation can fail for the following reasons:\n\n* Provided content (request body) was empty (HTTP error `400`)\n* No artifact with the `artifactId` exists (HTTP error `404`)\n* No artifact version matching the provided content exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" - }, - "delete": { - "tags": [ - "Artifacts" - ], - "responses": { - "204": { - "description": "Returned when the artifact was successfully deleted." - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "deleteArtifact", - "summary": "Delete artifact", - "description": "Deletes an artifact completely, resulting in all versions of the artifact also being\ndeleted. This may fail for one of the following reasons:\n\n* No artifact with the `artifactId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)" - }, - "parameters": [ - { - "name": "groupId", - "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/GroupId" - }, - "in": "path", - "required": true - }, - { - "name": "artifactId", - "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/ArtifactId" - }, - "in": "path", - "required": true - } - ] - }, - "/groups/{groupId}/artifacts/{artifactId}/versions/{versionExpression}/content": { - "summary": "Manage a single version of a single artifact in the registry.", - "get": { - "tags": [ - "Versions" - ], - "parameters": [ - { - "name": "references", - "description": "Allows the user to specify how references in the content should be treated.", - "schema": { - "$ref": "#/components/schemas/HandleReferencesType" - }, - "in": "query" - } - ], - "responses": { - "200": { - "$ref": "#/components/responses/ArtifactContent" - }, - "400": { - "$ref": "#/components/responses/BadRequest" - }, - "404": { - "$ref": "#/components/responses/NotFound" - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "getArtifactVersionContent", - "summary": "Get artifact version", - "description": "Retrieves a single version of the artifact content. Both the `artifactId` and the\nunique `version` number must be provided. The `Content-Type` of the response depends \non the artifact type. In most cases, this is `application/json`, but for some types \nit may be different (for example, `PROTOBUF`).\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No version with this `version` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" - }, - "parameters": [ - { - "name": "groupId", - "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/GroupId" - }, - "in": "path", - "required": true - }, - { - "name": "artifactId", - "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", - "schema": { - "$ref": "#/components/schemas/ArtifactId" - }, - "in": "path", - "required": true - }, - { - "name": "versionExpression", - "description": "An expression resolvable to a specific version ID within the given group and artifact. The following rules apply:\n\n - If the expression is in the form \"branch={branchId}\", and artifact branch {branchId} exists: The expression is resolved to a version that the branch points to.\n - Otherwise: The expression is resolved to a version with the same ID, which must follow the \"[a-zA-Z0-9._\\\\-+]{1,256}\" pattern.", - "schema": { - "type": "string" - }, - "in": "path", - "required": true - } - ] - }, - "/search/groups": { - "summary": "Search for groups in the registry.", - "get": { - "tags": [ - "Search", - "Groups" - ], - "parameters": [ - { - "name": "offset", - "description": "The number of artifacts to skip before starting to collect the result set. Defaults to 0.", - "schema": { - "default": 0, - "type": "integer" - }, - "in": "query", - "required": false - }, - { - "name": "limit", - "description": "The number of artifacts to return. Defaults to 20.", - "schema": { - "default": 20, - "type": "integer" - }, - "in": "query", - "required": false - }, - { - "name": "order", - "description": "Sort order, ascending (`asc`) or descending (`desc`).", - "schema": { - "$ref": "#/components/schemas/SortOrder" - }, - "in": "query" - }, - { - "name": "orderby", - "description": "The field to sort by. Can be one of:\n\n* `name`\n* `createdOn`\n", - "schema": { - "$ref": "#/components/schemas/GroupSortBy" - }, - "in": "query" - }, - { - "name": "labels", - "description": "Filter by one or more name/value label. Separate each name/value pair using a colon. For\nexample `labels=foo:bar` will return only artifacts with a label named `foo`\nand value `bar`.", - "schema": { - "type": "array", - "items": { - "type": "string" - } - }, - "in": "query" - }, - { - "name": "description", - "description": "Filter by description.", - "schema": { - "type": "string" - }, - "in": "query" - }, - { - "name": "groupId", - "description": "Filter by group name.", - "schema": { - "type": "string" - }, - "in": "query" - } - ], - "responses": { - "200": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/GroupSearchResults" - } - } - }, - "description": "On a successful response, returns a result set of groups - one for each group\nin the registry that matches the criteria." - }, - "500": { - "$ref": "#/components/responses/ServerError" - } - }, - "operationId": "searchGroups", - "summary": "Search for artifacts", - "description": "Returns a paginated list of all artifacts that match the provided filter criteria.\n" - } + "in": "header" + }, + { + "name": "X-Registry-Preserve-ContentId", + "description": "If this header is set to false, content ids of imported data will be ignored and replaced by next id in content id sequence. The mapping between content and artifacts will be preserved. This allows to import any data even thought the content ids would cause a conflict.", + "schema": { + "type": "boolean" + }, + "in": "header", + "required": false + } + ], + "responses": { + "201": { + "description": "Indicates that the import was successful." + }, + "500": { + "$ref": "#/components/responses/ServerError" + } }, - "x-codegen-contextRoot": "/apis/registry/v3" + "operationId": "importData", + "summary": "Import registry data", + "description": "Imports registry data that was previously exported using the `/admin/export` operation." + } }, - "components": { - "schemas": { - "Rule": { - "title": "Root Type for Rule", - "description": "", - "required": [ - "config" - ], - "type": "object", - "properties": { - "config": { - "type": "string" - }, - "type": { - "$ref": "#/components/schemas/RuleType" - } - }, - "example": { - "type": "VALIDITY", - "config": "FULL" + "/groups/{groupId}/artifacts/{artifactId}/versions/{versionExpression}": { + "summary": "Manage a single version of a single artifact in the registry.", + "get": { + "tags": [ + "Metadata" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VersionMetaData" } + } }, - "Error": { - "title": "Root Type for Error", - "description": "All error responses, whether `4xx` or `5xx` will include one of these as the response\nbody.", - "type": "object", - "properties": { - "message": { - "description": "The short error message.", - "type": "string" - }, - "error_code": { - "format": "int32", - "description": "The server-side error code.", - "type": "integer" - }, - "detail": { - "description": "Full details about the error. This might contain a server stack trace, for example.", - "type": "string" - }, - "name": { - "description": "The error name - typically the classname of the exception thrown by the server.", - "type": "string" - } - }, - "example": { - "error_code": 500, - "message": "An error occurred somewhere." + "description": "The artifact version's metadata." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "getArtifactVersionMetaData", + "summary": "Get artifact version metadata", + "description": "Retrieves the metadata for a single version of the artifact. The version metadata is \na subset of the artifact metadata and only includes the metadata that is specific to\nthe version (for example, this doesn't include `modifiedOn`).\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No version with this `version` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "put": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EditableVersionMetaData" + } + } + }, + "required": true + }, + "tags": [ + "Metadata" + ], + "responses": { + "204": { + "description": "The artifact version's metadata was successfully updated." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "updateArtifactVersionMetaData", + "summary": "Update artifact version metadata", + "description": "Updates the user-editable portion of the artifact version's metadata. Only some of \nthe metadata fields are editable by the user. For example, `description` is editable, \nbut `createdOn` is not.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No version with this `version` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "delete": { + "tags": [ + "Versions" + ], + "responses": { + "204": { + "description": "The artifact version was successfully deleted." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "405": { + "$ref": "#/components/responses/MethodNotAllowed" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "deleteArtifactVersion", + "summary": "Delete artifact version", + "description": "Deletes a single version of the artifact. Parameters `groupId`, `artifactId` and the unique `version`\nare needed. If this is the only version of the artifact, this operation is the same as \ndeleting the entire artifact.\n\nThis feature is disabled by default and it's discouraged for normal usage. To enable it, set the `registry.rest.artifact.deletion.enabled` property to true. This operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No version with this `version` exists (HTTP error `404`)\n * Feature is disabled (HTTP error `405`)\n * A server error occurred (HTTP error `500`)\n" + }, + "parameters": [ + { + "name": "groupId", + "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/GroupId" + }, + "in": "path", + "required": true + }, + { + "name": "artifactId", + "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/ArtifactId" + }, + "in": "path", + "required": true + }, + { + "name": "versionExpression", + "description": "An expression resolvable to a specific version ID within the given group and artifact. The following rules apply:\n\n - If the expression is in the form \"branch={branchId}\", and artifact branch {branchId} exists: The expression is resolved to a version that the branch points to.\n - Otherwise: The expression is resolved to a version with the same ID, which must follow the \"[a-zA-Z0-9._\\\\-+]{1,256}\" pattern.", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/groups/{groupId}/artifacts/{artifactId}/rules": { + "summary": "Manage the rules for a single artifact.", + "get": { + "tags": [ + "Artifact rules" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RuleType" + } } + } }, - "RuleType": { - "description": "", - "enum": [ - "VALIDITY", - "COMPATIBILITY", - "INTEGRITY" - ], - "type": "string", - "example": "VALIDITY", - "x-codegen-package": "io.apicurio.registry.types" + "description": "Returns the names of the rules configured for the artifact." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "listArtifactRules", + "summary": "List artifact rules", + "description": "Returns a list of all rules configured for the artifact. The set of rules determines\nhow the content of an artifact can evolve over time. If no rules are configured for\nan artifact, the set of globally configured rules are used. If no global rules \nare defined, there are no restrictions on content evolution.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)" + }, + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Rule" + } + } + }, + "required": true + }, + "tags": [ + "Artifact rules" + ], + "responses": { + "204": { + "description": "The rule was added." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "createArtifactRule", + "summary": "Create artifact rule", + "description": "Adds a rule to the list of rules that get applied to the artifact when adding new\nversions. All configured rules must pass to successfully add a new artifact version.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* Rule (named in the request body) is unknown (HTTP error `400`)\n* A server error occurred (HTTP error `500`)" + }, + "delete": { + "tags": [ + "Artifact rules" + ], + "responses": { + "204": { + "description": "The rules were successfully deleted." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "deleteArtifactRules", + "summary": "Delete artifact rules", + "description": "Deletes all of the rules configured for the artifact. After this is done, the global\nrules apply to the artifact again.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)" + }, + "parameters": [ + { + "name": "groupId", + "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/GroupId" + }, + "in": "path", + "required": true + }, + { + "name": "artifactId", + "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/ArtifactId" + }, + "in": "path", + "required": true + } + ] + }, + "/groups/{groupId}/artifacts/{artifactId}/rules/{rule}": { + "summary": "Manage the configuration of a single artifact rule.", + "get": { + "tags": [ + "Artifact rules" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Rule" + } + } }, - "ArtifactType": { - "description": "", - "type": "string", - "example": "AVRO", - "x-codegen-package": "io.apicurio.registry.types" + "description": "Information about a rule." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "getArtifactRuleConfig", + "summary": "Get artifact rule configuration", + "description": "Returns information about a single rule configured for an artifact. This is useful\nwhen you want to know what the current configuration settings are for a specific rule.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No rule with this name/type is configured for this artifact (HTTP error `404`)\n* Invalid rule type (HTTP error `400`)\n* A server error occurred (HTTP error `500`)" + }, + "put": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Rule" + } + } + }, + "required": true + }, + "tags": [ + "Artifact rules" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Rule" + } + } }, - "ArtifactTypeInfo": { - "description": "", - "type": "object", - "properties": { - "name": { - "type": "string" - } - }, - "example": { - "name": "AVRO" + "description": "Rule configuration was updated." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "updateArtifactRuleConfig", + "summary": "Update artifact rule configuration", + "description": "Updates the configuration of a single rule for the artifact. The configuration data\nis specific to each rule type, so the configuration of the `COMPATIBILITY` rule \nis in a different format from the configuration of the `VALIDITY` rule.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No rule with this name/type is configured for this artifact (HTTP error `404`)\n* Invalid rule type (HTTP error `400`)\n* A server error occurred (HTTP error `500`)\n" + }, + "delete": { + "tags": [ + "Artifact rules" + ], + "responses": { + "204": { + "description": "The rule was successfully deleted." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "deleteArtifactRule", + "summary": "Delete artifact rule", + "description": "Deletes a rule from the artifact. This results in the rule no longer applying for\nthis artifact. If this is the only rule configured for the artifact, this is the \nsame as deleting **all** rules, and the globally configured rules now apply to\nthis artifact.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No rule with this name/type is configured for this artifact (HTTP error `404`)\n* Invalid rule type (HTTP error `400`)\n* A server error occurred (HTTP error `500`)" + }, + "parameters": [ + { + "name": "groupId", + "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/GroupId" + }, + "in": "path", + "required": true + }, + { + "name": "artifactId", + "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/ArtifactId" + }, + "in": "path", + "required": true + }, + { + "name": "rule", + "description": "The unique name/type of a rule.", + "schema": { + "enum": [ + "VALIDITY", + "COMPATIBILITY", + "INTEGRITY" + ], + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/admin/roleMappings/{principalId}": { + "summary": "Manage the configuration of a single role mapping.", + "get": { + "tags": [ + "Admin" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleMapping" } + } }, - "ArtifactSearchResults": { - "description": "Describes the response received when searching for artifacts.", - "required": [ - "count", - "artifacts" - ], - "type": "object", - "properties": { - "artifacts": { - "description": "The artifacts returned in the result set.", - "type": "array", - "items": { - "$ref": "#/components/schemas/SearchedArtifact" - } - }, - "count": { - "description": "The total number of artifacts that matched the query that produced the result set (may be \nmore than the number of artifacts in the result set).", - "type": "integer" - } + "description": "When successful, returns the details of a role mapping." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "getRoleMapping", + "summary": "Return a single role mapping", + "description": "Gets the details of a single role mapping (by `principalId`).\n\nThis operation can fail for the following reasons:\n\n* No role mapping for the `principalId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "put": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateRole" + } + } + }, + "required": true + }, + "tags": [ + "Admin" + ], + "responses": { + "204": { + "description": "Response when the update is successful." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "updateRoleMapping", + "summary": "Update a role mapping", + "description": "Updates a single role mapping for one user/principal.\n\nThis operation can fail for the following reasons:\n\n* No role mapping for the principalId exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "delete": { + "tags": [ + "Admin" + ], + "responses": { + "204": { + "description": "Response returned when the delete was successful." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "deleteRoleMapping", + "summary": "Delete a role mapping", + "description": "Deletes a single role mapping, effectively denying access to a user/principal.\n\nThis operation can fail for the following reasons:\n\n* No role mapping for the principalId exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "parameters": [ + { + "name": "principalId", + "description": "Unique id of a principal (typically either a user or service account).", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/users/me": { + "summary": "Retrieves information about the current user", + "get": { + "tags": [ + "Users" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserInfo" } + } }, - "SortOrder": { - "description": "", - "enum": [ - "asc", - "desc" - ], - "type": "string" + "description": "Response when the endpoint is successfully invoked." + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "getCurrentUserInfo", + "summary": "Get current user", + "description": "Returns information about the currently authenticated user." + } + }, + "/ids/contentIds/{contentId}/references": { + "get": { + "tags": [ + "Artifacts" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ArtifactReference" + } + } + } }, - "VersionSearchResults": { - "description": "Describes the response received when searching for artifacts.", - "required": [ - "count", - "versions" - ], - "type": "object", - "properties": { - "count": { - "description": "The total number of versions that matched the query (may be more than the number of versions\nreturned in the result set).", - "type": "integer" - }, - "versions": { - "description": "The collection of artifact versions returned in the result set.", - "type": "array", - "items": { - "$ref": "#/components/schemas/SearchedVersion" - } - } + "description": "A list containing all the references for the artifact with the given content id." + } + }, + "operationId": "referencesByContentId", + "summary": "List artifact references by content ID", + "description": "Returns a list containing all the artifact references using the artifact content ID.\n\nThis operation may fail for one of the following reasons:\n\n* A server error occurred (HTTP error `500`)" + }, + "parameters": [ + { + "name": "contentId", + "description": "Global identifier for a single artifact content.", + "schema": { + "format": "int64", + "type": "integer" + }, + "in": "path", + "required": true + } + ] + }, + "/ids/globalIds/{globalId}/references": { + "get": { + "tags": [ + "Artifacts" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ArtifactReference" + } } + } }, - "RuleViolationCause": { - "title": "Root Type for RuleViolationCause", - "description": "", - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "context": { - "type": "string" - } - }, - "example": { - "description": "External documentation URL is not valid (it must be formatted as a URL).", - "context": "/info/externalDocs[url]" + "description": "A list containing all the references for the artifact with the given global id." + } + }, + "operationId": "referencesByGlobalId", + "summary": "List artifact references by global ID", + "description": "Returns a list containing all the artifact references using the artifact global ID.\n\nThis operation may fail for one of the following reasons:\n\n* A server error occurred (HTTP error `500`)" + }, + "parameters": [ + { + "name": "globalId", + "description": "Global identifier for an artifact version.", + "schema": { + "format": "int64", + "type": "integer" + }, + "in": "path", + "required": true + }, + { + "name": "refType", + "description": "Determines the type of reference to return, either INBOUND or OUTBOUND. Defaults to OUTBOUND.", + "schema": { + "$ref": "#/components/schemas/ReferenceType" + }, + "in": "query" + } + ] + }, + "/groups/{groupId}/artifacts/{artifactId}/versions/{versionExpression}/references": { + "summary": "Manage the references for a single version of an artifact in the registry.", + "get": { + "tags": [ + "Versions" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ArtifactReference" + } } + } }, - "IfArtifactExists": { - "description": "", - "enum": [ - "FAIL", - "CREATE_VERSION", - "FIND_OR_CREATE_VERSION" - ], - "type": "string" + "description": "List of all the artifact references for this artifact." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "getArtifactVersionReferences", + "summary": "Get artifact version references", + "description": "Retrieves all references for a single version of an artifact. Both the `artifactId` and the\nunique `version` number must be provided. Using the `refType` query parameter, it is possible\nto retrieve an array of either the inbound or outbound references.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No version with this `version` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "parameters": [ + { + "name": "groupId", + "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/GroupId" + }, + "in": "path", + "required": true + }, + { + "name": "artifactId", + "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/ArtifactId" + }, + "in": "path", + "required": true + }, + { + "name": "versionExpression", + "description": "An expression resolvable to a specific version ID within the given group and artifact. The following rules apply:\n\n - If the expression is in the form \"branch={branchId}\", and artifact branch {branchId} exists: The expression is resolved to a version that the branch points to.\n - Otherwise: The expression is resolved to a version with the same ID, which must follow the \"[a-zA-Z0-9._\\\\-+]{1,256}\" pattern.", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + }, + { + "name": "refType", + "description": "Determines the type of reference to return, either INBOUND or OUTBOUND. Defaults to OUTBOUND.", + "schema": { + "$ref": "#/components/schemas/ReferenceType" + }, + "in": "query", + "required": false + } + ] + }, + "/admin/config/properties": { + "summary": "Manage configuration properties.", + "get": { + "tags": [ + "Admin" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ConfigurationProperty" + } + } + } }, - "ArtifactSortBy": { - "description": "", - "enum": [ - "artifactId", - "createdOn", - "modifiedOn", - "artifactType", - "name" - ], - "type": "string" + "description": "On a successful response, returns a list of configuration properties." + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "listConfigProperties", + "summary": "List all configuration properties", + "description": "Returns a list of all configuration properties that have been set. The list is not paged.\n\nThis operation may fail for one of the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" + } + }, + "/admin/config/properties/{propertyName}": { + "summary": "Manage a single configuration property (by name).", + "get": { + "tags": [ + "Admin" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConfigurationProperty" + } + } }, - "SystemInfo": { - "title": "Root Type for SystemInfo", - "description": "", - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "version": { - "type": "string" - }, - "builtOn": { - "format": "date-time", - "type": "string" - } - }, - "example": { - "name": "Apicurio Registry (SQL)", - "description": "The Apicurio Registry application.", - "version": "2.0.0.Final", - "builtOn": "2021-03-19T12:55:00Z" + "description": "The configuration property value." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "getConfigProperty", + "summary": "Get configuration property value", + "description": "Returns the value of a single configuration property.\n\nThis operation may fail for one of the following reasons:\n\n* Property not found or not configured (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "put": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateConfigurationProperty" + } + } + }, + "required": true + }, + "tags": [ + "Admin" + ], + "responses": { + "204": { + "description": "The configuration property was updated." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "updateConfigProperty", + "summary": "Update a configuration property", + "description": "Updates the value of a single configuration property.\n\nThis operation may fail for one of the following reasons:\n\n* Property not found or not configured (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "delete": { + "tags": [ + "Admin" + ], + "responses": { + "204": { + "description": "The configuration property was deleted." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "resetConfigProperty", + "summary": "Reset a configuration property", + "description": "Resets the value of a single configuration property. This will return the property to\nits default value (see external documentation for supported properties and their default\nvalues).\n\nThis operation may fail for one of the following reasons:\n\n* Property not found or not configured (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "parameters": [ + { + "name": "propertyName", + "description": "The name of a configuration property.", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/system/limits": { + "summary": "Retrieve resource limits information", + "get": { + "tags": [ + "System" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Limits" } + } }, - "FileContent": { - "format": "binary", - "type": "string", - "x-codegen-inline": true + "description": "On success, returns resource limits" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "getResourceLimits", + "summary": "Get resource limits information", + "description": "This operation retrieves the list of limitations on used resources, that are applied on the current instance of Registry." + } + }, + "/groups/{groupId}/artifacts": { + "summary": "Manage the collection of artifacts within a single group in the registry.", + "get": { + "tags": [ + "Artifacts" + ], + "parameters": [ + { + "name": "limit", + "description": "The number of artifacts to return. Defaults to 20.", + "schema": { + "type": "integer" }, - "RoleMapping": { - "description": "The mapping between a user/principal and their role.", - "required": [ - "principalId", - "role" - ], - "type": "object", - "properties": { - "principalId": { - "description": "", - "type": "string" - }, - "role": { - "$ref": "#/components/schemas/RoleType", - "description": "" - }, - "principalName": { - "description": "A friendly name for the principal.", - "type": "string" - } - }, - "example": { - "principalId": "svc_account_84874587_123484", - "principalName": "famartin-svc-account", - "role": "READ_ONLY" - } + "in": "query" + }, + { + "name": "offset", + "description": "The number of artifacts to skip before starting the result set. Defaults to 0.", + "schema": { + "type": "integer" }, - "RoleType": { - "description": "", - "enum": [ - "READ_ONLY", - "DEVELOPER", - "ADMIN" - ], - "type": "string", - "x-codegen-package": "io.apicurio.registry.types" + "in": "query" + }, + { + "name": "order", + "description": "Sort order, ascending (`asc`) or descending (`desc`).", + "schema": { + "$ref": "#/components/schemas/SortOrder" }, - "UpdateRole": { - "title": "Root Type for UpdateRole", - "description": "", - "required": [ - "role" - ], - "type": "object", - "properties": { - "role": { - "$ref": "#/components/schemas/RoleType" - } - }, - "example": { - "role": "READ_ONLY" - } + "in": "query" + }, + { + "name": "orderby", + "description": "The field to sort by. Can be one of:\n\n* `name`\n* `createdOn`\n", + "schema": { + "$ref": "#/components/schemas/ArtifactSortBy" }, - "UserInfo": { - "title": "Root Type for UserInfo", - "description": "Information about a single user.", - "type": "object", - "properties": { - "username": { - "type": "string" - }, - "displayName": { - "type": "string" - }, - "admin": { - "type": "boolean" - }, - "developer": { - "type": "boolean" - }, - "viewer": { - "type": "boolean" - } - }, - "example": { - "username": "dprince", - "displayName": "Diana Prince", - "admin": true, - "developer": false, - "viewer": false + "in": "query" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ArtifactSearchResults" } + } }, - "DownloadRef": { - "title": "Root Type for Download", - "description": "Models a download \"link\". Useful for browser use-cases.", - "required": [ - "downloadId" - ], - "type": "object", - "properties": { - "downloadId": { - "type": "string" - }, - "href": { - "type": "string" - } - }, - "example": { - "downloadId": "247-4987490-297845", - "href": "https://54321.registry.examples.org/apis/registry/v3/downloads/247-4987490-297845" - } + "description": "On a successful response, returns a bounded set of artifacts." + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "listArtifactsInGroup", + "summary": "List artifacts in group", + "description": "Returns a list of all artifacts in the group. This list is paged." + }, + "post": { + "requestBody": { + "description": "The artifact being created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateArtifact" + } + } + }, + "required": true + }, + "tags": [ + "Artifacts" + ], + "parameters": [ + { + "name": "ifExists", + "description": "Set this option to instruct the server on what to do if the artifact already exists.", + "schema": { + "$ref": "#/components/schemas/IfArtifactExists" }, - "ArtifactMetaData": { - "title": "Root Type for ArtifactMetaData", - "description": "", - "required": [ - "artifactId", - "owner", - "createdOn", - "modifiedBy", - "modifiedOn", - "type", - "group" - ], - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "owner": { - "type": "string" - }, - "createdOn": { - "format": "date-time", - "type": "string" - }, - "modifiedBy": { - "type": "string" - }, - "modifiedOn": { - "format": "date-time", - "type": "string" - }, - "type": { - "$ref": "#/components/schemas/ArtifactType", - "description": "" - }, - "labels": { - "$ref": "#/components/schemas/Labels", - "description": "" - }, - "groupId": { - "$ref": "#/components/schemas/GroupId", - "description": "" - }, - "artifactId": { - "$ref": "#/components/schemas/ArtifactId", - "description": "" - } - }, - "example": { - "groupId": "My-Group", - "artifactId": "Procurement-Invoice", - "name": "Artifact Name", - "description": "Description of the artifact", - "type": "AVRO", - "owner": "user1", - "createdOn": "2019-03-22T12:51:19Z", - "modifiedBy": "user2", - "modifiedOn": "2019-07-19T15:09:00Z", - "labels": { - "custom-1": "foo", - "custom-2": "bar" - } - } + "in": "query" + }, + { + "name": "canonical", + "description": "Used only when the `ifExists` query parameter is set to `RETURN_OR_UPDATE`, this parameter can be set to `true` to indicate that the server should \"canonicalize\" the content when searching for a matching version. The canonicalization algorithm is unique to each artifact type, but typically involves removing extra whitespace and formatting the content in a consistent manner.", + "schema": { + "type": "boolean" }, - "SearchedArtifact": { - "description": "Models a single artifact from the result set returned when searching for artifacts.", - "required": [ - "owner", - "createdOn", - "artifactId", - "type", - "group" - ], - "type": "object", - "properties": { - "name": { - "description": "", - "type": "string" - }, - "description": { - "description": "", - "type": "string" - }, - "createdOn": { - "format": "date-time", - "description": "", - "type": "string" - }, - "owner": { - "description": "", - "type": "string" - }, - "type": { - "$ref": "#/components/schemas/ArtifactType", - "description": "" - }, - "modifiedOn": { - "format": "date-time", - "description": "", - "type": "string" - }, - "modifiedBy": { - "description": "", - "type": "string" - }, - "groupId": { - "$ref": "#/components/schemas/GroupId", - "description": "" - }, - "artifactId": { - "$ref": "#/components/schemas/ArtifactId", - "description": "" - } - }, - "example": { - "groupId": "My-Group", - "artifactId": "Procurement-Invoice", - "name": "Artifact Name", - "description": "Description of the artifact", - "type": "AVRO", - "state": "ENABLED", - "owner": "user1", - "createdOn": "2019-03-22T12:51:19Z", - "modifiedBy": "user2", - "modifiedOn": "2019-04-01T12:51:19Z" - } + "in": "query" + }, + { + "name": "dryRun", + "description": "When set to `true`, the operation will not result in any changes. Instead, it\nwill return a result based on whether the operation **would have succeeded**.", + "schema": { + "type": "boolean" }, - "VersionMetaData": { - "title": "Root Type for ArtifactVersionMetaData", - "description": "", - "required": [ - "createdOn", - "owner", - "version", - "type", - "globalId", - "artifactId", - "contentId" - ], - "type": "object", - "properties": { - "version": { - "type": "string" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "owner": { - "type": "string" - }, - "createdOn": { - "format": "date-time", - "type": "string" - }, - "type": { - "$ref": "#/components/schemas/ArtifactType", - "description": "" - }, - "globalId": { - "format": "int64", - "description": "", - "type": "integer" - }, - "state": { - "$ref": "#/components/schemas/VersionState", - "description": "" - }, - "labels": { - "$ref": "#/components/schemas/Labels", - "description": "" - }, - "groupId": { - "$ref": "#/components/schemas/GroupId", - "description": "" - }, - "contentId": { - "format": "int64", - "description": "", - "type": "integer" - }, - "artifactId": { - "$ref": "#/components/schemas/ArtifactId", - "description": "" - } - }, - "example": { - "groupId": "My-Group", - "artifactId": "my-artifact-id", - "version": 1221432, - "type": "PROTOBUF", - "name": "Artifact Name", - "description": "The description of the artifact", - "owner": "user1", - "createdOn": "2019-05-17T12:00:00Z", - "globalId": 183282932983, - "contentId": 12347, - "labels": { - "custom-1": "foo", - "custom-2": "bar" - }, - "references": [ - { - "groupId": "mygroup", - "artifactId": "13842090-2ce3-11ec-8d3d-0242ac130003", - "version": 2, - "name": "foo.bar.Open" - } - ] + "in": "query" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateArtifactResponse" } + } }, - "SearchedVersion": { - "description": "Models a single artifact from the result set returned when searching for artifacts.", - "required": [ - "owner", - "createdOn", - "type", - "state", - "globalId", - "version", - "contentId", - "references" - ], - "type": "object", - "properties": { - "name": { - "description": "", - "type": "string" - }, - "description": { - "description": "", - "type": "string" - }, - "createdOn": { - "format": "date-time", - "description": "", - "type": "string" - }, - "owner": { - "description": "", - "type": "string" - }, - "type": { - "$ref": "#/components/schemas/ArtifactType", - "description": "" - }, - "state": { - "$ref": "#/components/schemas/VersionState", - "description": "" - }, - "globalId": { - "format": "int64", - "description": "", - "type": "integer" - }, - "version": { - "description": "", - "type": "string" - }, - "contentId": { - "format": "int64", - "description": "", - "type": "integer" - }, - "references": { - "description": "", - "type": "array", - "items": { - "$ref": "#/components/schemas/ArtifactReference" - } - } - }, - "example": { - "name": "Artifact Version Name", - "description": "Description of the artifact version", - "type": "AVRO", - "state": "ENABLED", - "createdOn": "2018-02-10T09:30Z", - "owner": "some text", - "globalId": 37, - "version": "1.0.7", - "labels": {}, - "contentId": 62, - "references": {} - } + "description": "Artifact was successfully created." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "409": { + "$ref": "#/components/responses/RuleViolationConflict" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "createArtifact", + "summary": "Create artifact", + "description": "Creates a new artifact. The body of the request should be a `CreateArtifact` \nobject, which includes the metadata of the new artifact and, optionally, the \nmetadata and content of the first version.\n\nIf the artifact type is not provided, the registry attempts to figure out what \nkind of artifact is being added from the\nfollowing supported list:\n\n* Avro (`AVRO`)\n* Protobuf (`PROTOBUF`)\n* JSON Schema (`JSON`)\n* Kafka Connect (`KCONNECT`)\n* OpenAPI (`OPENAPI`)\n* AsyncAPI (`ASYNCAPI`)\n* GraphQL (`GRAPHQL`)\n* Web Services Description Language (`WSDL`)\n* XML Schema (`XSD`)\n\nAn artifact will be created using the unique artifact ID that can optionally be \nprovided in the request body. If not provided in the request, the server will\ngenerate a unique ID for the artifact. It is typically recommended that callers\nprovide the ID, because it is typically a meaningful identifier, and as such\nfor most use cases should be supplied by the caller.\n\nIf an artifact with the provided artifact ID already exists, the default behavior\nis for the server to reject the content with a 409 error. However, the caller can\nsupply the `ifExists` query parameter to alter this default behavior. The `ifExists`\nquery parameter can have one of the following values:\n\n* `FAIL` (*default*) - server rejects the content with a 409 error\n* `UPDATE` - server updates the existing artifact and returns the new metadata\n* `RETURN` - server does not create or add content to the server, but instead \nreturns the metadata for the existing artifact\n* `RETURN_OR_UPDATE` - server returns an existing **version** that matches the \nprovided content if such a version exists, otherwise a new version is created\n\nThis operation may fail for one of the following reasons:\n\n* An invalid `ArtifactType` was indicated (HTTP error `400`)\n* No `ArtifactType` was indicated and the server could not determine one from the content (HTTP error `400`)\n* Provided content (request body) was empty (HTTP error `400`)\n* An artifact with the provided ID already exists (HTTP error `409`)\n* The content violates one of the configured global rules (HTTP error `409`)\n* A server error occurred (HTTP error `500`)\n\nNote that if the `dryRun` query parameter is set to `true`, then this operation\nwill not actually make any changes. Instead it will succeed or fail based on \nwhether it **would have worked**. Use this option to, for example, check if an\nartifact is valid or if a new version passes configured compatibility checks." + }, + "delete": { + "tags": [ + "Artifacts" + ], + "responses": { + "204": { + "description": "When the delete operation is successful, a simple 204 is returned." + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "deleteArtifactsInGroup", + "summary": "Delete artifacts in group", + "description": "Deletes all of the artifacts that exist in a given group." + }, + "parameters": [ + { + "name": "groupId", + "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/GroupId" + }, + "in": "path", + "required": true + } + ] + }, + "/groups": { + "summary": "Collection of the groups in the registry.", + "get": { + "tags": [ + "Groups" + ], + "parameters": [ + { + "name": "limit", + "description": "The number of groups to return. Defaults to 20.", + "schema": { + "type": "integer" }, - "RuleViolationError": { - "title": "Root Type for Error", - "description": "All error responses, whether `4xx` or `5xx` will include one of these as the response\nbody.", - "type": "object", - "allOf": [ - { - "required": [ - "causes" - ], - "type": "object", - "properties": { - "causes": { - "description": "List of rule violation causes.", - "type": "array", - "items": { - "$ref": "#/components/schemas/RuleViolationCause" - } - } - } - }, - { - "$ref": "#/components/schemas/Error" - } - ], - "example": { - "error_code": 409, - "message": "Artifact failed validation", - "causes": [ - { - "description": "API is missing a title", - "context": "/info[title]" - }, - { - "description": "Operation IDs must be unique", - "context": "/paths[/invoices]/put[operationId]" - } - ] - }, - "x-codegen-extendsClass": "io.apicurio.registry.rest.v3.beans.Error" + "in": "query" + }, + { + "name": "offset", + "description": "The number of groups to skip before starting the result set. Defaults to 0.", + "schema": { + "type": "integer" }, - "ArtifactReference": { - "title": "Root Type for ArtifactReference", - "description": "A reference to a different artifact. Typically used with artifact types that can have dependencies like Protobuf.", - "required": [ - "artifactId", - "groupId", - "name" - ], - "type": "object", - "properties": { - "groupId": { - "type": "string" - }, - "artifactId": { - "type": "string" - }, - "version": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "example": { - "groupId": "mygroup", - "artifactId": "13842090-2ce3-11ec-8d3d-0242ac130003", - "version": "2", - "name": "foo.bar.Open" - } + "in": "query" + }, + { + "name": "order", + "description": "Sort order, ascending (`asc`) or descending (`desc`).", + "schema": { + "$ref": "#/components/schemas/SortOrder" + }, + "in": "query" + }, + { + "name": "orderby", + "description": "The field to sort by. Can be one of:\n\n* `name`\n* `createdOn`\n", + "schema": { + "$ref": "#/components/schemas/GroupSortBy" }, - "ConfigurationProperty": { - "title": "Root Type for ConfigurationProperty", - "description": "", - "required": [ - "name", - "value", - "type", - "label", - "description" - ], - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "value": { - "type": "string" - }, - "type": { - "description": "", - "type": "string" - }, - "label": { - "description": "", - "type": "string" - }, - "description": { - "description": "", - "type": "string" - } - }, - "example": { - "name": "registry.auth.owner-only-authorization", - "value": "true", - "type": "boolean", - "label": "Owner Only Authorization", - "description": "When enabled, the registry will allow only the artifact owner (creator) to modify an artifact." + "in": "query" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GroupSearchResults" } + } }, - "UpdateConfigurationProperty": { - "title": "Root Type for UpdateConfigurationProperty", - "description": "", - "required": [ - "value" - ], - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "example": { - "value": "true" + "description": "On a successful response, returns a bounded set of groups." + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "listGroups", + "summary": "List groups", + "description": "Returns a list of all groups. This list is paged." + }, + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateGroup" + } + } + }, + "required": true + }, + "tags": [ + "Groups" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GroupMetaData" } + } }, - "Limits": { - "title": "Root Type for Limits", - "description": "List of limitations on used resources, that are applied on the current instance of Registry.\nKeys represent the resource type and are suffixed by the corresponding unit.\nValues are integers. Only non-negative values are allowed, with the exception of -1, which means that the limit is not applied.", - "type": "object", - "properties": { - "maxTotalSchemasCount": { - "format": "int64", - "type": "integer" - }, - "maxSchemaSizeBytes": { - "format": "int64", - "type": "integer" - }, - "maxArtifactsCount": { - "format": "int64", - "type": "integer" - }, - "maxVersionsPerArtifactCount": { - "format": "int64", - "type": "integer" - }, - "maxArtifactPropertiesCount": { - "format": "int64", - "type": "integer" - }, - "maxPropertyKeySizeBytes": { - "format": "int64", - "type": "integer" - }, - "maxPropertyValueSizeBytes": { - "format": "int64", - "type": "integer" - }, - "maxArtifactLabelsCount": { - "format": "int64", - "type": "integer" - }, - "maxLabelSizeBytes": { - "format": "int64", - "type": "integer" - }, - "maxArtifactNameLengthChars": { - "format": "int64", - "type": "integer" - }, - "maxArtifactDescriptionLengthChars": { - "format": "int64", - "type": "integer" - }, - "maxRequestsPerSecondCount": { - "format": "int64", - "type": "integer" - } - }, - "example": { - "maxTotalSchemasCount": -1, - "maxSchemaSizeBytes": -1, - "maxArtifactsCount": -1, - "maxVersionsPerArtifactCount": -1, - "maxArtifactPropertiesCount": -1, - "maxPropertyKeySizeBytes": -1, - "maxPropertyValueSizeBytes": -1, - "maxArtifactLabelsCount": -1, - "maxLabelSizeBytes": -1, - "maxArtifactNameLengthChars": -1, - "maxArtifactDescriptionLengthChars": -1, - "maxRequestsPerSecondCount": -1 + "description": "The group has been successfully created." + }, + "409": { + "$ref": "#/components/responses/Conflict" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "createGroup", + "summary": "Create a new group", + "description": "Creates a new group.\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n* The group already exist (HTTP error `409`)\n" + } + }, + "/groups/{groupId}/artifacts/{artifactId}/versions/{versionExpression}/comments": { + "summary": "Manage a collection of comments for an artifact version", + "get": { + "tags": [ + "Versions" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Comment" + } } + } }, - "SearchedGroup": { - "description": "Models a single group from the result set returned when searching for groups.", - "required": [ - "description", - "owner", - "createdOn", - "groupId", - "modifiedBy", - "modifiedOn" - ], - "type": "object", - "properties": { - "description": { - "description": "", - "type": "string" - }, - "createdOn": { - "format": "date-time", - "description": "", - "type": "string" - }, - "owner": { - "description": "", - "type": "string" - }, - "modifiedOn": { - "format": "date-time", - "description": "", - "type": "string" - }, - "modifiedBy": { - "description": "", - "type": "string" - }, - "groupId": { - "$ref": "#/components/schemas/GroupId", - "description": "" - } - }, - "example": { - "groupId": "My-Group", - "name": "Group Name", - "description": "Description of the group", - "owner": "user1", - "createdOn": "2019-03-22T12:51:19Z", - "modifiedBy": "user1", - "modifiedOn": "2019-03-22T12:51:19Z" + "description": "List of all the comments for this artifact." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "getArtifactVersionComments", + "summary": "Get artifact version comments", + "description": "Retrieves all comments for a version of an artifact. Both the `artifactId` and the\nunique `version` number must be provided.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No version with this `version` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NewComment" + } + } + }, + "required": true + }, + "tags": [ + "Versions" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Comment" } + } }, - "GroupMetaData": { - "title": "Root Type for GroupMetaData", - "description": "", - "required": [ - "groupId", - "description", - "owner", - "createdOn", - "modifiedBy", - "modifiedOn", - "labels" - ], - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "owner": { - "type": "string" - }, - "createdOn": { - "format": "date-time", - "type": "string" - }, - "modifiedBy": { - "type": "string" - }, - "modifiedOn": { - "format": "date-time", - "type": "string" - }, - "labels": { - "$ref": "#/components/schemas/Labels", - "description": "" - }, - "groupId": { - "$ref": "#/components/schemas/GroupId", - "description": "" - } - }, - "example": { - "groupId": "group-identifier", - "description": "Description of the group", - "artifactsType": "AVRO", - "owner": "user1", - "createdOn": "2019-03-22T12:51:19Z", - "modifiedBy": "user2", - "modifiedOn": "2019-07-19T15:09:00Z", - "properties": { - "custom-1": "foo", - "custom-2": "bar" - } + "description": "The comment was successfully created." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "addArtifactVersionComment", + "summary": "Add new comment", + "description": "Adds a new comment to the artifact version. Both the `artifactId` and the\nunique `version` number must be provided.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No version with this `version` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "parameters": [ + { + "name": "groupId", + "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/GroupId" + }, + "in": "path", + "required": true + }, + { + "name": "artifactId", + "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/ArtifactId" + }, + "in": "path", + "required": true + }, + { + "name": "versionExpression", + "description": "An expression resolvable to a specific version ID within the given group and artifact. The following rules apply:\n\n - If the expression is in the form \"branch={branchId}\", and artifact branch {branchId} exists: The expression is resolved to a version that the branch points to.\n - Otherwise: The expression is resolved to a version with the same ID, which must follow the \"[a-zA-Z0-9._\\\\-+]{1,256}\" pattern.", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/groups/{groupId}/artifacts/{artifactId}/versions/{versionExpression}/comments/{commentId}": { + "summary": "Manage a single comment", + "put": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NewComment" + } + } + }, + "required": true + }, + "tags": [ + "Versions" + ], + "responses": { + "204": { + "description": "The value of the comment was successfully changed." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "updateArtifactVersionComment", + "summary": "Update a comment", + "description": "Updates the value of a single comment in an artifact version. Only the owner of the\ncomment can modify it. The `artifactId`, unique `version` number, and `commentId` \nmust be provided.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No version with this `version` exists (HTTP error `404`)\n* No comment with this `commentId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "delete": { + "tags": [ + "Versions" + ], + "responses": { + "204": { + "description": "The comment was successfully deleted." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "deleteArtifactVersionComment", + "summary": "Delete a single comment", + "description": "Deletes a single comment in an artifact version. Only the owner of the\ncomment can delete it. The `artifactId`, unique `version` number, and `commentId` \nmust be provided.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No version with this `version` exists (HTTP error `404`)\n* No comment with this `commentId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "parameters": [ + { + "name": "groupId", + "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/GroupId" + }, + "in": "path", + "required": true + }, + { + "name": "artifactId", + "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/ArtifactId" + }, + "in": "path", + "required": true + }, + { + "name": "versionExpression", + "description": "An expression resolvable to a specific version ID within the given group and artifact. The following rules apply:\n\n - If the expression is in the form \"branch={branchId}\", and artifact branch {branchId} exists: The expression is resolved to a version that the branch points to.\n - Otherwise: The expression is resolved to a version with the same ID, which must follow the \"[a-zA-Z0-9._\\\\-+]{1,256}\" pattern.", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + }, + { + "name": "commentId", + "description": "The unique identifier of a single comment.", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/groups/{groupId}/artifacts/{artifactId}/branches": { + "summary": "Manage branches of an artifact.", + "get": { + "tags": [ + "Branches" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ArtifactBranch" + } } + } }, - "GroupSearchResults": { - "description": "Describes the response received when searching for groups.", - "required": [ - "count", - "groups" - ], - "type": "object", - "properties": { - "groups": { - "description": "The groups returned in the result set.", - "type": "array", - "items": { - "$ref": "#/components/schemas/SearchedGroup" - } - }, - "count": { - "description": "The total number of groups that matched the query that produced the result set (may be \nmore than the number of groups in the result set).", - "type": "integer" - } - } + "description": "List of all artifact versions." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "listArtifactBranches", + "summary": "List artifact branches", + "description": "Returns a list of all branches in the artifact. Each branch is a list of version identifiers,\nordered from the latest (tip of the branch) to the oldest.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "parameters": [ + { + "name": "groupId", + "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/GroupId" + }, + "in": "path", + "required": true + }, + { + "name": "artifactId", + "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/ArtifactId" + }, + "in": "path", + "required": true + } + ] + }, + "/groups/{groupId}/artifacts/{artifactId}/versions": { + "summary": "Manage all the versions of an artifact in the registry.", + "get": { + "tags": [ + "Versions" + ], + "parameters": [ + { + "name": "offset", + "description": "The number of versions to skip before starting to collect the result set. Defaults to 0.", + "schema": { + "type": "integer" }, - "CreateGroup": { - "title": "Root Type for CreateGroupMetaData", - "description": "", - "required": [ - "groupId" - ], - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "labels": { - "$ref": "#/components/schemas/Labels", - "description": "" - }, - "groupId": { - "$ref": "#/components/schemas/GroupId", - "description": "" - } - }, - "example": { - "groupId": "group-identifier", - "description": "The description of the artifact.", - "labels": { - "custom-1": "foo", - "custom-2": "bar" - } + "in": "query", + "required": false + }, + { + "name": "limit", + "description": "The number of versions to return. Defaults to 20.", + "schema": { + "type": "integer" + }, + "in": "query", + "required": false + }, + { + "name": "order", + "description": "Sort order, ascending (`asc`) or descending (`desc`).", + "schema": { + "$ref": "#/components/schemas/SortOrder" + }, + "in": "query" + }, + { + "name": "orderby", + "description": "The field to sort by. Can be one of:\n\n* `name`\n* `version`\n* `createdOn`\n", + "schema": { + "$ref": "#/components/schemas/VersionSortBy" + }, + "in": "query" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VersionSearchResults" + }, + "examples": { + "All Versions": { + "value": [ + 5, + 6, + 10, + 103 + ] + } } + } }, - "VersionContent": { - "description": "", - "required": [ - "content", - "contentType" - ], - "type": "object", - "properties": { - "content": { - "description": "Raw content of the artifact version or a valid (and accessible) URL where the content can be found.", - "type": "string", - "example": "" - }, - "references": { - "description": "Collection of references to other artifacts.", - "type": "array", - "items": { - "$ref": "#/components/schemas/ArtifactReference" - } - }, - "contentType": { - "description": "The content-type, such as `application/json` or `text/xml`.", - "type": "string" - } + "description": "List of all artifact versions." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "listArtifactVersions", + "summary": "List artifact versions", + "description": "Returns a list of all versions of the artifact. The result set is paged.\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "post": { + "requestBody": { + "description": "The version to be created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateVersion" + } + } + }, + "required": true + }, + "tags": [ + "Versions" + ], + "parameters": [ + { + "name": "dryRun", + "description": "When set to `true`, the operation will not result in any changes. Instead, it\nwill return a result based on whether the operation **would have succeeded**.", + "schema": { + "type": "boolean" + }, + "in": "query" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VersionMetaData" } + } }, - "ReferenceType": { - "description": "", - "enum": [ - "OUTBOUND", - "INBOUND" - ], - "type": "string", - "example": "\"INBOUND\"", - "x-codegen-package": "io.apicurio.registry.types" + "description": "The artifact version was successfully created." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "409": { + "$ref": "#/components/responses/RuleViolationConflict" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "createArtifactVersion", + "summary": "Create artifact version", + "description": "Creates a new version of the artifact by uploading new content. The configured rules for\nthe artifact are applied, and if they all pass, the new content is added as the most recent \nversion of the artifact. If any of the rules fail, an error is returned.\n\nThe body of the request can be the raw content of the new artifact version, or the raw content \nand a set of references pointing to other artifacts, and the type\nof that content should match the artifact's type (for example if the artifact type is `AVRO`\nthen the content of the request should be an Apache Avro document).\n\nThis operation can fail for the following reasons:\n\n* Provided content (request body) was empty (HTTP error `400`)\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* The new content violates one of the rules configured for the artifact (HTTP error `409`)\n* A server error occurred (HTTP error `500`)\n" + }, + "parameters": [ + { + "name": "groupId", + "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/GroupId" + }, + "in": "path", + "required": true + }, + { + "name": "artifactId", + "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/ArtifactId" + }, + "in": "path", + "required": true + } + ] + }, + "/groups/{groupId}/artifacts/{artifactId}/branches/{branchId}": { + "summary": "Manage a single artifact branch.", + "get": { + "tags": [ + "Branches" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ArtifactBranch" + } + } }, - "NewComment": { - "title": "Root Type for NewComment", - "description": "", - "required": [ - "value" - ], - "type": "object", - "properties": { - "value": { - "type": "string" - } - }, - "example": { - "value": "This is a new comment on an existing artifact version." + "description": "List of versions in an artifact branch." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "getArtifactBranch", + "summary": "List versions in an artifact branch", + "description": "Returns a list of version identifiers in the artifact branch, ordered from the latest (tip of the branch) to the oldest.\n\nThis operation can fail for the following reasons:\n\n* No group with this `groupId` exists (HTTP error `404`)\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No branch with this `branchId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "put": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ArtifactBranch" + } + } + }, + "required": true + }, + "tags": [ + "Branches" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ArtifactBranch" } + } }, - "Comment": { - "title": "Root Type for NewComment", - "description": "", - "required": [ - "owner", - "createdOn", - "value", - "commentId" - ], - "type": "object", - "properties": { - "value": { - "maxLength": 1024, - "type": "string" - }, - "createdOn": { - "format": "date-time", - "type": "string" - }, - "owner": { - "description": "", - "type": "string" - }, - "commentId": { - "description": "", - "type": "string" - } - }, - "example": { - "commentId": "12345", - "value": "This is a comment on an artifact version.", - "owner": "bwayne", - "createdOn": "2023-07-01T15:22:01Z" + "description": "List of versions in an artifact branch." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "409": { + "$ref": "#/components/responses/Conflict" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "createOrReplaceArtifactBranch", + "summary": "Replace the sequence of versions contained in an artifact branch. Branch is created if it does not exist.", + "description": "Replace the sequence of versions contained in an artifact branch. Branch is created if it does not exist. This operation is equivalent to deleting the artifact branch and adding each version in order to a new branch with the same name. This operation can be used to remove one or more versions from the branch. Returns a list of version identifiers in the artifact branch, ordered from the latest (tip of the branch) to the oldest.\nThis operation can fail for the following reasons:\n* No group with this `groupId` exists (HTTP error `404`)\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* Version does not exist (HTTP error `409`)\n* Request contains duplicate versions. Artifact branches are append-only, cycles and history rewrites, except by this operation, are not supported. (HTTP error `409`)\n* A server error occurred (HTTP error `500`)\n" + }, + "post": { + "requestBody": { + "content": { + "text/plain": { + "schema": { + "$ref": "#/components/schemas/Version" + } + } + }, + "required": true + }, + "tags": [ + "Branches" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ArtifactBranch" } + } }, - "HandleReferencesType": { - "description": "How to handle references when retrieving content. References can either be\nleft unchanged (`PRESERVE`), re-written so they are valid in the context of the\nregistry (`REWRITE`), or fully dereferenced such that all externally referenced\ncontent is internalized (`DEREFERENCE`).", - "enum": [ - "PRESERVE", - "DEREFERENCE", - "REWRITE" - ], - "type": "string" + "description": "List of versions in an artifact branch." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "409": { + "$ref": "#/components/responses/Conflict" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "createOrUpdateArtifactBranch", + "summary": "Add a new version to an artifact branch. Branch is created if it does not exist.", + "description": "Add a new version to an artifact branch. Branch is created if it does not exist. Returns a list of version identifiers in the artifact branch, ordered from the latest (tip of the branch) to the oldest.\nThis operation can fail for the following reasons:\n* No group with this `groupId` exists (HTTP error `404`)\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No branch with this `branchId` exists (HTTP error `404`)\n* Version does not exist (HTTP error `409`)\n* Branch already contains given version. Artifact branches are append-only, cycles and history rewrites, except by replacing the entire branch using createOrReplaceArtifactBranch operation, are not supported. (HTTP error `409`)\n* A server error occurred \n" + }, + "delete": { + "tags": [ + "Branches" + ], + "responses": { + "204": { + "description": "Artifact branch was successfully deleted." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "409": { + "$ref": "#/components/responses/Conflict" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "deleteArtifactBranch", + "summary": "Delete artifact branch.", + "description": "Deletes a single branch in the artifact. Any artifact versions that are not referenced by a branch are deleted as well, however, this does not happen until deletion of the \"latest\" branch is supported.\nThis operation can fail for the following reasons:\n* No group with this `groupId` exists (HTTP error `404`)\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No branch with this `branchId` exists (HTTP error `404`)\n* Deletion of the \"latest\" branch is not supported (HTTP error `409`)\n* A server error occurred (HTTP error `500`)\n" + }, + "parameters": [ + { + "name": "groupId", + "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/GroupId" + }, + "in": "path", + "required": true + }, + { + "name": "artifactId", + "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/ArtifactId" + }, + "in": "path", + "required": true + }, + { + "name": "branchId", + "description": "Artifact branch ID. Must follow the \"[a-zA-Z0-9._\\\\-+]{1,256}\" pattern.", + "schema": { + "$ref": "#/components/schemas/BranchId" + }, + "in": "path", + "required": true + } + ] + }, + "/system/uiConfig": { + "summary": "Get UI configuration", + "description": "This endpoint is used by the user interface to retrieve UI specific configuration\nin a JSON payload. This allows the UI and the backend to be configured in the \nsame place (the backend process/pod). When the UI loads, it will make an API call\nto this endpoint to determine what UI features and options are configured.", + "get": { + "tags": [ + "System" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserInterfaceConfig" + } + } }, - "ArtifactId": { - "description": "The ID of a single artifact.", - "pattern": "^.{1,512}$", - "type": "string", - "example": "\"example-artifact\"" + "description": "The UI config." + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "getUIConfig", + "summary": "Get UI config", + "description": "Returns the UI configuration properties for this server. The registry UI can be\nconnected to a backend using just a URL. The rest of the UI configuration can then\nbe fetched from the backend using this operation. This allows UI and backend to\nboth be configured in the same place.\n\nThis operation may fail for one of the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" + } + }, + "/ids/contentHashes/{contentHash}/references": { + "get": { + "tags": [ + "Artifacts" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ArtifactReference" + } + } + } }, - "GroupId": { - "description": "An ID of a single artifact group.", - "pattern": "^.{1,512}$", - "type": "string", - "example": "\"my-group\"" + "description": "A list containing all the references for the artifact with the given content hash." + } + }, + "operationId": "referencesByContentHash", + "summary": "List artifact references by hash", + "description": "Returns a list containing all the artifact references using the artifact content hash.\n\nThis operation may fail for one of the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" + }, + "parameters": [ + { + "name": "contentHash", + "description": "SHA-256 content hash for a single artifact content.", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/ids/contentHashes/{contentHash}": { + "summary": "Access artifact content utilizing the SHA-256 hash of the content.", + "get": { + "tags": [ + "Artifacts" + ], + "responses": { + "200": { + "$ref": "#/components/responses/ArtifactContent" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "getContentByHash", + "summary": "Get artifact content by SHA-256 hash", + "description": "Gets the content for an artifact version in the registry using the \nSHA-256 hash of the content. This content hash may be shared by multiple artifact\nversions in the case where the artifact versions have identical content.\n\nThis operation may fail for one of the following reasons:\n\n* No content with this `contentHash` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "parameters": [ + { + "name": "contentHash", + "description": "SHA-256 content hash for a single artifact content.", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/ids/contentIds/{contentId}": { + "summary": "Access artifact content utilizing the unique content identifier for that content.", + "get": { + "tags": [ + "Artifacts" + ], + "responses": { + "200": { + "$ref": "#/components/responses/ArtifactContent" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "getContentById", + "summary": "Get artifact content by ID", + "description": "Gets the content for an artifact version in the registry using the unique content\nidentifier for that content. This content ID may be shared by multiple artifact\nversions in the case where the artifact versions are identical.\n\nThis operation may fail for one of the following reasons:\n\n* No content with this `contentId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "parameters": [ + { + "name": "contentId", + "description": "Global identifier for a single artifact content.", + "schema": { + "format": "int64", + "type": "integer" + }, + "in": "path", + "required": true + } + ] + }, + "/groups/{groupId}": { + "summary": "Collection to manage a single group in the registry.", + "get": { + "tags": [ + "Groups" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GroupMetaData" + } + } }, - "Version": { - "description": "A single version of an artifact. Can be provided by the client when creating a new version,\nor it can be server-generated. The value can be any string unique to the artifact, but it is\nrecommended to use a simple integer or a semver value.", - "pattern": "^[a-zA-Z0-9._\\-+]{1,256}$", - "type": "string", - "example": "\"3.1.6\"" + "description": "The group's metadata." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "getGroupById", + "summary": "Get a group by the specified ID.", + "description": "Returns a group using the specified id.\n\nThis operation can fail for the following reasons:\n\n* No group exists with the specified ID (HTTP error `404`)\n* A server error occurred (HTTP error `500`)" + }, + "put": { + "requestBody": { + "description": "The new group metadata.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EditableGroupMetaData" + } + } + }, + "required": true + }, + "tags": [ + "Groups" + ], + "responses": { + "204": { + "description": "Empty response when the metadata is successfully updated." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "updateGroupById", + "summary": "Update group metadata", + "description": "Updates the metadata of a group using the specified id.\n\nThis operation can fail for the following reasons:\n\n* No group exists with the specified ID (HTTP error `404`)\n* A server error occurred (HTTP error `500`)" + }, + "delete": { + "tags": [ + "Groups" + ], + "responses": { + "204": { + "description": "Empty content indicates a successful deletion." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "deleteGroupById", + "summary": "Delete a group by the specified ID.", + "description": "Deletes a group by identifier. This operation also deletes all artifacts within\nthe group, so should be used very carefully.\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n* The group does not exist (HTTP error `404`)\n" + }, + "parameters": [ + { + "name": "groupId", + "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/GroupId" + }, + "in": "path", + "required": true + } + ] + }, + "/admin/roleMappings": { + "summary": "Collection to manage role mappings for authenticated principals", + "get": { + "tags": [ + "Admin" + ], + "parameters": [ + { + "name": "limit", + "description": "The number of role mappings to return. Defaults to 20.", + "schema": { + "type": "integer" }, - "BranchId": { - "description": "The ID of a single artifact branch.", - "pattern": "^[a-zA-Z0-9._\\-+]{1,256}$", - "type": "string", - "example": "\"latest\"" + "in": "query" + }, + { + "name": "offset", + "description": "The number of role mappings to skip before starting the result set. Defaults to 0.", + "schema": { + "type": "integer" }, - "ArtifactBranch": { - "title": "Root Type for ArtifactBranches", - "description": "", - "required": [ - "groupId", - "artifactId", - "branchId", - "versions" - ], - "type": "object", - "properties": { - "groupId": { - "$ref": "#/components/schemas/GroupId", - "description": "" - }, - "artifactId": { - "$ref": "#/components/schemas/ArtifactId", - "description": "" - }, - "branchId": { - "$ref": "#/components/schemas/BranchId", - "description": "" - }, - "versions": { - "description": "", - "type": "array", - "items": { - "$ref": "#/components/schemas/Version" - } - } - }, - "example": { - "latest": [ - { - "groupId": "default", - "artifactId": "user", - "version": "4" - }, - { - "groupId": "default", - "artifactId": "user", - "version": "3" - }, - { - "groupId": "default", - "artifactId": "user", - "version": "2" - }, - { - "groupId": "default", - "artifactId": "user", - "version": "1" - } - ], - "1.1.x": [ - { - "groupId": "default", - "artifactId": "user", - "version": "3" - }, - { - "groupId": "default", - "artifactId": "user", - "version": "1" - } - ], - "1.2.x": [ - { - "groupId": "default", - "artifactId": "user", - "version": "4" - }, - { - "groupId": "default", - "artifactId": "user", - "version": "2" - } - ] + "in": "query" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleMappingSearchResults" } + } }, - "UserInterfaceConfig": { - "title": "Root Type for UserInterfaceConfig", - "description": "Defines the user interface configuration data type.", - "required": [ - "auth" - ], - "type": "object", - "properties": { - "ui": { - "$ref": "#/components/schemas/UserInterfaceConfigUi", - "properties": { - "contextPath": { - "type": "string" - }, - "navPrefixPath": { - "type": "string" - }, - "oaiDocsUrl": { - "type": "string" - } - } - }, - "auth": { - "$ref": "#/components/schemas/UserInterfaceConfigAuth", - "properties": { - "type": { - "type": "string" - }, - "rbacEnabled": { - "type": "boolean" - }, - "obacEnabled": { - "type": "boolean" - }, - "options": { - "type": "object", - "properties": { - "url": { - "type": "string" - }, - "redirectUri": { - "type": "string" - }, - "clientId": { - "type": "string" - } - } - } - } - }, - "features": { - "$ref": "#/components/schemas/UserInterfaceConfigFeatures", - "properties": { - "readOnly": { - "type": "boolean" - }, - "breadcrumbs": { - "type": "boolean" - }, - "roleManagement": { - "type": "boolean" - }, - "settings": { - "type": "boolean" - } - } - } - }, - "example": { - "ui": { - "contextPath": "/", - "navPrefixPath": "/", - "oaiDocsUrl": "https://registry.apicur.io/docs" - }, - "auth": { - "type": "oidc", - "rbacEnabled": true, - "obacEnabled": false, - "options": { - "url": "https://auth.apicur.io/realms/apicurio", - "redirectUri": "http://registry.apicur.io", - "clientId": "apicurio-registry-ui" - } - }, - "features": { - "readOnly": false, - "breadcrumbs": true, - "roleManagement": false, - "settings": true - } + "description": "A successful response will return the list of role mappings." + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "listRoleMappings", + "summary": "List all role mappings", + "description": "Gets a list of all role mappings configured in the registry (if any).\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" + }, + "post": { + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleMapping" + } + } + }, + "required": true + }, + "tags": [ + "Admin" + ], + "responses": { + "204": { + "description": "Returned when the role mapping was successfully created." + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "createRoleMapping", + "summary": "Create a new role mapping", + "description": "Creates a new mapping between a user/principal and a role.\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n\n" + } + }, + "/admin/config/artifactTypes": { + "summary": "The list of artifact types supported by this instance of Registry.", + "get": { + "tags": [ + "Artifact Type", + "Admin" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ArtifactTypeInfo" + } } + } }, - "UserInterfaceConfigAuth": { - "title": "Root Type for UserInterfaceConfigAuth", - "description": "", - "required": [ - "obacEnabled", - "rbacEnabled" - ], - "type": "object", - "properties": { - "type": { - "enum": [ - "none", - "basic", - "oidc" - ], - "type": "string" - }, - "rbacEnabled": { - "type": "boolean" - }, - "obacEnabled": { - "type": "boolean" - }, - "options": { - "$ref": "#/components/schemas/Labels" - } - }, - "example": { - "type": "oidc", - "rbacEnabled": true, - "obacEnabled": false, - "options": { - "url": "https://auth.apicur.io/realms/apicurio", - "redirectUri": "https://registry.apicur.io", - "clientId": "registry-ui" - } + "description": "The list of available artifact types." + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "listArtifactTypes", + "summary": "List artifact types", + "description": "Gets a list of all the configured artifact types.\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" + } + }, + "/admin/snapshots": { + "summary": "Triggers a snapshot of the Registry storage. Only supported in KafkaSQL storage", + "post": { + "tags": [ + "KafkaSQL", + "Admin", + "Snapshot" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SnapshotMetaData" } + } }, - "UserInterfaceConfigFeatures": { - "title": "Root Type for UserInterfaceConfigFeatures", - "description": "", - "type": "object", - "properties": { - "readOnly": { - "type": "boolean" - }, - "breadcrumbs": { - "type": "boolean" - }, - "roleManagement": { - "type": "boolean" - }, - "settings": { - "type": "boolean" - } - }, - "example": { - "readOnly": false, - "breadcrumbs": true, - "roleManagement": false, - "settings": true + "description": "The snapshot has been successfully triggered." + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "triggerSnapshot", + "summary": "Trigger storage snapshot", + "description": "Triggers the creation of a snapshot of the internal database for compatible storages.\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" + } + }, + "/groups/{groupId}/artifacts/{artifactId}": { + "summary": "Manage a single artifact.", + "get": { + "tags": [ + "Metadata" + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ArtifactMetaData" } + } + }, + "description": "The artifact's metadata." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "getArtifactMetaData", + "summary": "Get artifact metadata", + "description": "Gets the metadata for an artifact in the registry, based on the latest version. If the latest version of the artifact is marked as `DISABLED`, the next available non-disabled version will be used. The returned metadata includes\nboth generated (read-only) and editable metadata (such as name and description).\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists or all versions are `DISABLED` (HTTP error `404`)\n* A server error occurred (HTTP error `500`)" + }, + "put": { + "requestBody": { + "description": "Updated artifact metadata.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EditableArtifactMetaData" + } + } + }, + "required": true + }, + "tags": [ + "Metadata" + ], + "responses": { + "204": { + "description": "The artifact's metadata was updated." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "updateArtifactMetaData", + "summary": "Update artifact metadata", + "description": "Updates the editable parts of the artifact's metadata. Not all metadata fields can\nbe updated. Note that only the properties included will be updated. You can update\nonly the name by including only the `name` property in the payload of the request.\nProperties that are allowed but not present will result in the artifact's metadata\nnot being changed.\n\nThis operation can fail for the following reasons:\n\n* No artifact with the `artifactId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)" + }, + "delete": { + "tags": [ + "Artifacts" + ], + "responses": { + "204": { + "description": "Returned when the artifact was successfully deleted." + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "deleteArtifact", + "summary": "Delete artifact", + "description": "Deletes an artifact completely, resulting in all versions of the artifact also being\ndeleted. This may fail for one of the following reasons:\n\n* No artifact with the `artifactId` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)" + }, + "parameters": [ + { + "name": "groupId", + "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/GroupId" + }, + "in": "path", + "required": true + }, + { + "name": "artifactId", + "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/ArtifactId" + }, + "in": "path", + "required": true + } + ] + }, + "/groups/{groupId}/artifacts/{artifactId}/versions/{versionExpression}/content": { + "summary": "Manage a single version of a single artifact in the registry.", + "get": { + "tags": [ + "Versions" + ], + "parameters": [ + { + "name": "references", + "description": "Allows the user to specify how references in the content should be treated.", + "schema": { + "$ref": "#/components/schemas/HandleReferencesType" + }, + "in": "query" + } + ], + "responses": { + "200": { + "$ref": "#/components/responses/ArtifactContent" + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "getArtifactVersionContent", + "summary": "Get artifact version", + "description": "Retrieves a single version of the artifact content. Both the `artifactId` and the\nunique `version` number must be provided. The `Content-Type` of the response depends \non the artifact type. In most cases, this is `application/json`, but for some types \nit may be different (for example, `PROTOBUF`).\n\nThis operation can fail for the following reasons:\n\n* No artifact with this `artifactId` exists (HTTP error `404`)\n* No version with this `version` exists (HTTP error `404`)\n* A server error occurred (HTTP error `500`)\n" + }, + "parameters": [ + { + "name": "groupId", + "description": "The artifact group ID. Must be a string provided by the client, representing the name of the grouping of artifacts. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/GroupId" + }, + "in": "path", + "required": true + }, + { + "name": "artifactId", + "description": "The artifact ID. Can be a string (client-provided) or UUID (server-generated), representing the unique artifact identifier. Must follow the \".{1,512}\" pattern.", + "schema": { + "$ref": "#/components/schemas/ArtifactId" + }, + "in": "path", + "required": true + }, + { + "name": "versionExpression", + "description": "An expression resolvable to a specific version ID within the given group and artifact. The following rules apply:\n\n - If the expression is in the form \"branch={branchId}\", and artifact branch {branchId} exists: The expression is resolved to a version that the branch points to.\n - Otherwise: The expression is resolved to a version with the same ID, which must follow the \"[a-zA-Z0-9._\\\\-+]{1,256}\" pattern.", + "schema": { + "type": "string" + }, + "in": "path", + "required": true + } + ] + }, + "/search/groups": { + "summary": "Search for groups in the registry.", + "get": { + "tags": [ + "Search", + "Groups" + ], + "parameters": [ + { + "name": "offset", + "description": "The number of artifacts to skip before starting to collect the result set. Defaults to 0.", + "schema": { + "default": 0, + "type": "integer" + }, + "in": "query", + "required": false + }, + { + "name": "limit", + "description": "The number of artifacts to return. Defaults to 20.", + "schema": { + "default": 20, + "type": "integer" }, - "UserInterfaceConfigUi": { - "title": "Root Type for UserInterfaceConfigUi", - "description": "", - "type": "object", - "properties": { - "contextPath": { - "type": "string" - }, - "navPrefixPath": { - "type": "string" - }, - "oaiDocsUrl": { - "type": "string" - } - }, - "example": { - "contextPath": "/", - "navPrefixPath": "/", - "oaiDocsUrl": "https://registry.apicur.io/docs" - } + "in": "query", + "required": false + }, + { + "name": "order", + "description": "Sort order, ascending (`asc`) or descending (`desc`).", + "schema": { + "$ref": "#/components/schemas/SortOrder" }, - "Labels": { - "description": "User-defined name-value pairs. Name and value must be strings.", - "type": "object", - "additionalProperties": { - "type": "string" - }, - "x-codegen-inline": true, - "x-codegen-type": "StringMap" + "in": "query" + }, + { + "name": "orderby", + "description": "The field to sort by. Can be one of:\n\n* `name`\n* `createdOn`\n", + "schema": { + "$ref": "#/components/schemas/GroupSortBy" }, - "EditableArtifactMetaData": { - "title": "Root Type for EditableArtifactMetaData", - "description": "", - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "labels": { - "$ref": "#/components/schemas/Labels", - "description": "" - }, - "owner": { - "description": "", - "type": "string" - } - }, - "example": { - "name": "Artifact Name", - "description": "The description of the artifact.", - "owner": "user-1", - "labels": { - "custom-1": "foo", - "custom-2": "bar" - } - } + "in": "query" + }, + { + "name": "labels", + "description": "Filter by one or more name/value label. Separate each name/value pair using a colon. For\nexample `labels=foo:bar` will return only artifacts with a label named `foo`\nand value `bar`.", + "schema": { + "type": "array", + "items": { + "type": "string" + } }, - "EditableGroupMetaData": { - "title": "Root Type for EditableArtifactMetaData", - "description": "", - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "labels": { - "$ref": "#/components/schemas/Labels", - "description": "" - } - }, - "example": { - "description": "The description of the group.", - "labels": { - "custom-1": "foo", - "custom-2": "bar" - } - } + "in": "query" + }, + { + "name": "description", + "description": "Filter by description.", + "schema": { + "type": "string" }, - "RoleMappingSearchResults": { - "description": "Describes the response received when searching for artifacts.", - "required": [ - "count", - "roleMappings" - ], - "type": "object", - "properties": { - "roleMappings": { - "description": "The role mappings returned in the result set.", - "type": "array", - "items": { - "$ref": "#/components/schemas/RoleMapping" - } - }, - "count": { - "description": "The total number of role mappings that matched the query that produced the result set (may be \nmore than the number of role mappings in the result set).", - "type": "integer" - } - }, - "example": [ - { - "principalId": "user-1", - "principalName": "user-1", - "role": "ADMIN" - }, - { - "principalId": "svc_account_84874587_123484", - "principalName": "user-svc-account", - "role": "READ_ONLY" - } - ] + "in": "query" + }, + { + "name": "groupId", + "description": "Filter by group name.", + "schema": { + "type": "string" }, - "EditableVersionMetaData": { - "title": "Root Type for EditableArtifactMetaData", - "description": "", - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "labels": { - "$ref": "#/components/schemas/Labels", - "description": "" - }, - "state": { - "$ref": "#/components/schemas/VersionState", - "description": "" - } - }, - "example": { - "name": "Artifact Name", - "description": "The description of the artifact.", - "state": "DEPRECATED", - "labels": { - "custom-1": "foo", - "custom-2": "bar" - } + "in": "query" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GroupSearchResults" } + } }, - "VersionState": { - "description": "Describes the state of an artifact or artifact version. The following states\nare possible:\n\n* ENABLED\n* DISABLED\n* DEPRECATED\n", - "enum": [ - "ENABLED", - "DISABLED", - "DEPRECATED" - ], - "type": "string", - "x-codegen-package": "io.apicurio.registry.types" + "description": "On a successful response, returns a result set of groups - one for each group\nin the registry that matches the criteria." + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "searchGroups", + "summary": "Search for groups", + "description": "Returns a paginated list of all groups that match the provided filter criteria.\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" + } + }, + "/search/versions": { + "summary": "Search for versions in the registry.", + "get": { + "tags": [ + "Search", + "Versions" + ], + "parameters": [ + { + "name": "version", + "description": "Filter by version number.", + "schema": { + "$ref": "#/components/schemas/Version" }, - "CreateArtifact": { - "description": "Data sent when creating a new artifact.", - "required": [ - "artifactId" - ], - "type": "object", - "properties": { - "artifactId": { - "$ref": "#/components/schemas/ArtifactId", - "description": "" - }, - "type": { - "$ref": "#/components/schemas/ArtifactType", - "description": "" - }, - "name": { - "description": "", - "type": "string" - }, - "description": { - "description": "", - "type": "string" - }, - "labels": { - "$ref": "#/components/schemas/Labels", - "description": "" - }, - "firstVersion": { - "$ref": "#/components/schemas/CreateVersion", - "description": "" - } - }, - "example": { - "artifactId": "mytopic-value", - "type": "AVRO", - "name": "Invoice", - "description": "A standard Acme invoice payload.", - "labels": { - "label-1": "value-1", - "label-2": "value-2" - }, - "firstVersion": { - "version": "1.0.0", - "content": { - "content": "{\"type\":\"record\",\"name\":\"ExampleType\",\"fields\":[{\"name\":\"sdfgfsdgsdg\",\"type\":\"string\"}]}", - "references": [] - }, - "name": "ExampleType", - "description": "A simple example of an Avro type.", - "labels": {} - } - } + "in": "query" + }, + { + "name": "offset", + "description": "The number of versions to skip before starting to collect the result set. Defaults to 0.", + "schema": { + "default": 0, + "type": "integer" }, - "CreateVersion": { - "description": "", - "required": [ - "content" - ], - "type": "object", - "properties": { - "version": { - "$ref": "#/components/schemas/Version", - "description": "" - }, - "content": { - "$ref": "#/components/schemas/VersionContent", - "description": "" - }, - "name": { - "description": "", - "type": "string" - }, - "description": { - "description": "", - "type": "string" - }, - "labels": { - "$ref": "#/components/schemas/Labels", - "description": "" - }, - "branches": { - "description": "", - "type": "array", - "items": { - "type": "string" - } - } - } + "in": "query", + "required": false + }, + { + "name": "limit", + "description": "The number of versions to return. Defaults to 20.", + "schema": { + "default": 20, + "type": "integer" }, - "CreateArtifactResponse": { - "description": "", - "required": [ - "artifact" - ], - "type": "object", - "properties": { - "artifact": { - "$ref": "#/components/schemas/ArtifactMetaData", - "description": "" - }, - "version": { - "$ref": "#/components/schemas/VersionMetaData", - "description": "" - } - } + "in": "query", + "required": false + }, + { + "name": "order", + "description": "Sort order, ascending (`asc`) or descending (`desc`).", + "schema": { + "$ref": "#/components/schemas/SortOrder" }, - "VersionSortBy": { - "description": "", - "enum": [ - "version", - "name", - "createdOn", - "modifiedOn", - "globalId" - ], - "type": "string" + "in": "query" + }, + { + "name": "orderby", + "description": "The field to sort by. Can be one of:\n\n* `name`\n* `createdOn`\n", + "schema": { + "$ref": "#/components/schemas/VersionSortBy" }, - "GroupSortBy": { - "description": "", - "enum": [ - "groupId", - "createdOn" - ], + "in": "query" + }, + { + "name": "labels", + "description": "Filter by one or more name/value label. Separate each name/value pair using a colon. For\nexample `labels=foo:bar` will return only artifacts with a label named `foo`\nand value `bar`.", + "schema": { + "type": "array", + "items": { "type": "string" + } }, - "SnapshotMetaData": { - "title": "Root Type for SnapshotMetaData", - "description": "", - "required": [ - "snapshotId" - ], - "type": "object", - "properties": { - "snapshotId": { - "description": "", - "type": "string" - } - }, - "example": { - "snapshotId": "snp-1137292771" + "in": "query" + }, + { + "name": "description", + "description": "Filter by description.", + "schema": { + "type": "string" + }, + "in": "query" + }, + { + "name": "groupId", + "description": "Filter by artifact group.", + "schema": { + "$ref": "#/components/schemas/GroupId" + }, + "in": "query" + }, + { + "name": "globalId", + "description": "Filter by globalId.", + "schema": { + "format": "int64", + "type": "integer" + }, + "in": "query" + }, + { + "name": "contentId", + "description": "Filter by contentId.", + "schema": { + "format": "int64", + "type": "integer" + }, + "in": "query", + "required": false + }, + { + "name": "artifactId", + "description": "Filter by artifactId.", + "schema": { + "$ref": "#/components/schemas/ArtifactId" + }, + "in": "query" + }, + { + "name": "name", + "description": "Filter by name.", + "schema": { + "type": "string" + }, + "in": "query" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VersionSearchResults" } + } + }, + "description": "On a successful response, returns a result set of versions - one for each version\nin the registry that matches the criteria." + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "searchVersions", + "summary": "Search for versions", + "description": "Returns a paginated list of all versions that match the provided filter criteria.\n\nThis operation can fail for the following reasons:\n\n* A server error occurred (HTTP error `500`)\n" + }, + "post": { + "requestBody": { + "description": "The content to search for.", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/FileContent" + } } + }, + "required": true }, - "responses": { - "NotFound": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - }, - "examples": { - "NotFoundExample": { - "value": { - "error_code": 404, - "message": "No artifact with id 'Topic-1/Inbound' could be found." - } - } - } - } - }, - "description": "Common response for all operations that can return a `404` error." + "tags": [ + "Search", + "Versions" + ], + "parameters": [ + { + "name": "canonical", + "description": "Parameter that can be set to `true` to indicate that the server should \"canonicalize\" the content when searching for matching artifacts. Canonicalization is unique to each artifact type, but typically involves removing any extra whitespace and formatting the content in a consistent manner. Must be used along with the `artifactType` query parameter.", + "schema": { + "type": "boolean" }, - "MethodNotAllowed": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - }, - "examples": { - "MethodNotAllowedExample": { - "value": { - "error_code": 405, - "message": "Method is currently not supported or disabled." - } - } - } - } - }, - "description": "Common response for all operations that can fail due to method not allowed or disabled." + "in": "query" + }, + { + "name": "artifactType", + "description": "Indicates the type of artifact represented by the content being used for the search. This is only needed when using the `canonical` query parameter, so that the server knows how to canonicalize the content prior to searching for matching versions.", + "schema": { + "$ref": "#/components/schemas/ArtifactType" }, - "ServerError": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - }, - "examples": { - "ErrorExample": { - "value": { - "error_code": 500, - "message": "Lost connection to the database." - } - } - } - } - }, - "description": "Common response for all operations that can fail with an unexpected server error." + "in": "query" + }, + { + "name": "offset", + "description": "The number of versions to skip before starting to collect the result set. Defaults to 0.", + "schema": { + "default": 0, + "type": "integer" }, - "BadRequest": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - } - } - }, - "description": "Common response for all operations that can return a `400` error." + "in": "query", + "required": false + }, + { + "name": "limit", + "description": "The number of versions to return. Defaults to 20.", + "schema": { + "default": 20, + "type": "integer" }, - "Conflict": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - }, - "examples": { - "ConflictExample": { - "value": { - "error_code": 409, - "message": "The artifact content was invalid." - } - } - } - } - }, - "description": "Common response used when an input conflicts with existing data." + "in": "query", + "required": false + }, + { + "name": "order", + "description": "Sort order, ascending (`asc`) or descending (`desc`).", + "schema": { + "$ref": "#/components/schemas/SortOrder" }, - "RuleViolationConflict": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RuleViolationError" - }, - "examples": { - "RuleViolationConflictExample": { - "value": { - "error_code": 409, - "message": "The artifact content was invalid", - "causes": [ - { - "description": "API is missing a title", - "context": "/info[title]" - }, - { - "description": "Operation IDs must be unique", - "context": "/paths[/invoices]/put[operationId]" - } - ] - } - } - } - } - }, - "description": "Common response used when an input conflicts with existing data." + "in": "query" + }, + { + "name": "orderby", + "description": "The field to sort by. Can be one of:\n\n* `name`\n* `createdOn`\n", + "schema": { + "$ref": "#/components/schemas/VersionSortBy" }, - "ArtifactContent": { - "content": { - "*/*": { - "schema": { - "$ref": "#/components/schemas/FileContent" - }, - "examples": { - "OpenAPI": { - "value": { - "openapi": "3.0.2", - "info": { - "title": "Empty API", - "version": "1.0.0", - "description": "An example API design using OpenAPI." - } - } - } - } - } - }, - "description": "The content of one version of one artifact." + "in": "query" + }, + { + "name": "groupId", + "description": "Filter by group Id.", + "schema": { + "$ref": "#/components/schemas/GroupId" + }, + "in": "query" + }, + { + "name": "artifactId", + "description": "Filter by artifact Id.", + "schema": { + "$ref": "#/components/schemas/ArtifactId" + }, + "in": "query" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/VersionSearchResults" + } + } + }, + "description": "On a successful response, returns a result set of versions - one for each version\nin the registry that matches the criteria." + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "500": { + "$ref": "#/components/responses/ServerError" + } + }, + "operationId": "searchVersionsByContent", + "summary": "Search for versions by content", + "description": "Returns a paginated list of all versions that match the posted content.\n\nThis operation can fail for the following reasons:\n\n* Provided content (request body) was empty (HTTP error `400`)\n* A server error occurred (HTTP error `500`)\n" + } + }, + "x-codegen-contextRoot": "/apis/registry/v3" + }, + "components": { + "schemas": { + "Rule": { + "title": "Root Type for Rule", + "description": "", + "required": [ + "config" + ], + "type": "object", + "properties": { + "config": { + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/RuleType" + } + }, + "example": { + "type": "VALIDITY", + "config": "FULL" + } + }, + "Error": { + "title": "Root Type for Error", + "description": "All error responses, whether `4xx` or `5xx` will include one of these as the response\nbody.", + "type": "object", + "properties": { + "message": { + "description": "The short error message.", + "type": "string" + }, + "error_code": { + "format": "int32", + "description": "The server-side error code.", + "type": "integer" + }, + "detail": { + "description": "Full details about the error. This might contain a server stack trace, for example.", + "type": "string" + }, + "name": { + "description": "The error name - typically the classname of the exception thrown by the server.", + "type": "string" + } + }, + "example": { + "error_code": 500, + "message": "An error occurred somewhere." + } + }, + "RuleType": { + "description": "", + "enum": [ + "VALIDITY", + "COMPATIBILITY", + "INTEGRITY" + ], + "type": "string", + "example": "VALIDITY", + "x-codegen-package": "io.apicurio.registry.types" + }, + "ArtifactType": { + "description": "", + "type": "string", + "example": "AVRO", + "x-codegen-package": "io.apicurio.registry.types" + }, + "ArtifactTypeInfo": { + "description": "", + "type": "object", + "properties": { + "name": { + "type": "string" + } + }, + "example": { + "name": "AVRO" + } + }, + "ArtifactSearchResults": { + "description": "Describes the response received when searching for artifacts.", + "required": [ + "count", + "artifacts" + ], + "type": "object", + "properties": { + "artifacts": { + "description": "The artifacts returned in the result set.", + "type": "array", + "items": { + "$ref": "#/components/schemas/SearchedArtifact" } + }, + "count": { + "description": "The total number of artifacts that matched the query that produced the result set (may be \nmore than the number of artifacts in the result set).", + "type": "integer" + } } - }, - "tags": [ - { - "name": "Artifacts", - "description": "The primary way to interact with the Apicurio Registry API is to add, update, \nor delete artifacts. This section includes all of these primary operations." + }, + "SortOrder": { + "description": "", + "enum": [ + "asc", + "desc" + ], + "type": "string" + }, + "VersionSearchResults": { + "description": "Describes the response received when searching for artifacts.", + "required": [ + "count", + "versions" + ], + "type": "object", + "properties": { + "count": { + "description": "The total number of versions that matched the query (may be more than the number of versions\nreturned in the result set).", + "type": "integer" + }, + "versions": { + "description": "The collection of artifact versions returned in the result set.", + "type": "array", + "items": { + "$ref": "#/components/schemas/SearchedVersion" + } + } + } + }, + "RuleViolationCause": { + "title": "Root Type for RuleViolationCause", + "description": "", + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "context": { + "type": "string" + } }, - { - "name": "Metadata", - "description": "Sometimes the metadata for an artifact is important. For example, metadata includes \nwhen the artifact was created, last updated, and so on. This section contains \noperations to access (and in some cases change) an artifact's metadata." + "example": { + "description": "External documentation URL is not valid (it must be formatted as a URL).", + "context": "/info/externalDocs[url]" + } + }, + "IfArtifactExists": { + "description": "", + "enum": [ + "FAIL", + "CREATE_VERSION", + "FIND_OR_CREATE_VERSION" + ], + "type": "string" + }, + "ArtifactSortBy": { + "description": "", + "enum": [ + "artifactId", + "createdOn", + "modifiedOn", + "artifactType", + "name" + ], + "type": "string" + }, + "SystemInfo": { + "title": "Root Type for SystemInfo", + "description": "", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "version": { + "type": "string" + }, + "builtOn": { + "format": "date-time", + "type": "string" + } }, - { - "name": "Versions", - "description": "When artifact content is updated, old versions of the artifact content are not lost. All versions can be listed and accessed if necessary. This section describes the operations used to list and access all versions of an artifact's content and metadata." + "example": { + "name": "Apicurio Registry (SQL)", + "description": "The Apicurio Registry application.", + "version": "2.0.0.Final", + "builtOn": "2021-03-19T12:55:00Z" + } + }, + "FileContent": { + "format": "binary", + "type": "string", + "x-codegen-inline": true + }, + "RoleMapping": { + "description": "The mapping between a user/principal and their role.", + "required": [ + "principalId", + "role" + ], + "type": "object", + "properties": { + "principalId": { + "description": "", + "type": "string" + }, + "role": { + "$ref": "#/components/schemas/RoleType", + "description": "" + }, + "principalName": { + "description": "A friendly name for the principal.", + "type": "string" + } }, - { - "name": "Artifact rules", - "description": "Rules can be configured on a per-artifact basis, allowing for different approaches\nto content evolution for each artifact. These rules override any global rules\nthat have been configured. This section contains the operations used to manage a\nsingle artifact's rules." + "example": { + "principalId": "svc_account_84874587_123484", + "principalName": "famartin-svc-account", + "role": "READ_ONLY" + } + }, + "RoleType": { + "description": "", + "enum": [ + "READ_ONLY", + "DEVELOPER", + "ADMIN" + ], + "type": "string", + "x-codegen-package": "io.apicurio.registry.types" + }, + "UpdateRole": { + "title": "Root Type for UpdateRole", + "description": "", + "required": [ + "role" + ], + "type": "object", + "properties": { + "role": { + "$ref": "#/components/schemas/RoleType" + } }, - { - "name": "Global rules", - "description": "Global rules can be configured in the registry to govern how artifact content can \nevolve over time (as artifact content is **updated**). Global rules are applied \nwhenever an artifact is added to the registry, and also whenever an artifact's \ncontent is updated (only if that artifact does not have its own specific rules \nconfigured). This section describes the operations used to manage the global rules." + "example": { + "role": "READ_ONLY" + } + }, + "UserInfo": { + "title": "Root Type for UserInfo", + "description": "Information about a single user.", + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "admin": { + "type": "boolean" + }, + "developer": { + "type": "boolean" + }, + "viewer": { + "type": "boolean" + } }, - { - "name": "Search", - "description": "The search API is used to browse or find artifacts in the registry. This section describes the operations for searching for artifacts and versions. " + "example": { + "username": "dprince", + "displayName": "Diana Prince", + "admin": true, + "developer": false, + "viewer": false + } + }, + "DownloadRef": { + "title": "Root Type for Download", + "description": "Models a download \"link\". Useful for browser use-cases.", + "required": [ + "downloadId" + ], + "type": "object", + "properties": { + "downloadId": { + "type": "string" + }, + "href": { + "type": "string" + } }, - { - "name": "Admin", - "description": "Application functionality that is only accessible to admin users. Includes logging, global rules, and export/import of registry data." + "example": { + "downloadId": "247-4987490-297845", + "href": "https://54321.registry.examples.org/apis/registry/v3/downloads/247-4987490-297845" + } + }, + "ArtifactMetaData": { + "title": "Root Type for ArtifactMetaData", + "description": "", + "required": [ + "artifactId", + "owner", + "createdOn", + "modifiedBy", + "modifiedOn", + "artifactType", + "groupId" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "owner": { + "type": "string" + }, + "createdOn": { + "format": "date-time", + "type": "string" + }, + "modifiedBy": { + "type": "string" + }, + "modifiedOn": { + "format": "date-time", + "type": "string" + }, + "artifactType": { + "$ref": "#/components/schemas/ArtifactType", + "description": "" + }, + "labels": { + "$ref": "#/components/schemas/Labels", + "description": "" + }, + "groupId": { + "$ref": "#/components/schemas/GroupId", + "description": "" + }, + "artifactId": { + "$ref": "#/components/schemas/ArtifactId", + "description": "" + } }, - { - "name": "System", - "description": "System level functionality, including versioning and status information." + "example": { + "groupId": "My-Group", + "artifactId": "Procurement-Invoice", + "name": "Artifact Name", + "description": "Description of the artifact", + "artifactType": "AVRO", + "owner": "user1", + "createdOn": "2019-03-22T12:51:19Z", + "modifiedBy": "user2", + "modifiedOn": "2019-07-19T15:09:00Z", + "labels": { + "custom-1": "foo", + "custom-2": "bar" + } + } + }, + "SearchedArtifact": { + "description": "Models a single artifact from the result set returned when searching for artifacts.", + "required": [ + "owner", + "createdOn", + "artifactId", + "artifactType", + "groupId", + "modifiedBy", + "modifiedOn" + ], + "type": "object", + "properties": { + "name": { + "description": "", + "type": "string" + }, + "description": { + "description": "", + "type": "string" + }, + "createdOn": { + "format": "date-time", + "description": "", + "type": "string" + }, + "owner": { + "description": "", + "type": "string" + }, + "artifactType": { + "$ref": "#/components/schemas/ArtifactType", + "description": "" + }, + "modifiedOn": { + "format": "date-time", + "description": "", + "type": "string" + }, + "modifiedBy": { + "description": "", + "type": "string" + }, + "groupId": { + "$ref": "#/components/schemas/GroupId", + "description": "" + }, + "artifactId": { + "$ref": "#/components/schemas/ArtifactId", + "description": "" + } }, - { - "name": "Users", - "description": "Operations related to users." + "example": { + "groupId": "My-Group", + "artifactId": "Procurement-Invoice", + "name": "Artifact Name", + "description": "Description of the artifact", + "artifactType": "AVRO", + "owner": "user1", + "createdOn": "2019-03-22T12:51:19Z", + "modifiedBy": "user2", + "modifiedOn": "2019-04-01T12:51:19Z" + } + }, + "VersionMetaData": { + "title": "Root Type for ArtifactVersionMetaData", + "description": "", + "required": [ + "createdOn", + "owner", + "version", + "artifactType", + "globalId", + "artifactId", + "contentId" + ], + "type": "object", + "properties": { + "version": { + "$ref": "#/components/schemas/Version" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "owner": { + "type": "string" + }, + "createdOn": { + "format": "date-time", + "type": "string" + }, + "artifactType": { + "$ref": "#/components/schemas/ArtifactType", + "description": "" + }, + "globalId": { + "format": "int64", + "description": "", + "type": "integer" + }, + "state": { + "$ref": "#/components/schemas/VersionState", + "description": "" + }, + "labels": { + "$ref": "#/components/schemas/Labels", + "description": "" + }, + "groupId": { + "$ref": "#/components/schemas/GroupId", + "description": "" + }, + "contentId": { + "format": "int64", + "description": "", + "type": "integer" + }, + "artifactId": { + "$ref": "#/components/schemas/ArtifactId", + "description": "" + } }, - { - "name": "Groups", - "description": "Registry artifacts can be collected together using groups. This section includes all of the primary operations related to groups." + "example": { + "groupId": "My-Group", + "artifactId": "my-artifact-id", + "version": 1221432, + "artifactType": "PROTOBUF", + "name": "Artifact Name", + "description": "The description of the artifact", + "owner": "user1", + "createdOn": "2019-05-17T12:00:00Z", + "globalId": 183282932983, + "contentId": 12347, + "labels": { + "custom-1": "foo", + "custom-2": "bar" + } + } + }, + "SearchedVersion": { + "description": "Models a single artifact from the result set returned when searching for artifacts.", + "required": [ + "owner", + "createdOn", + "artifactType", + "state", + "globalId", + "version", + "contentId", + "artifactId" + ], + "type": "object", + "properties": { + "name": { + "description": "", + "type": "string" + }, + "description": { + "description": "", + "type": "string" + }, + "createdOn": { + "format": "date-time", + "description": "", + "type": "string" + }, + "owner": { + "description": "", + "type": "string" + }, + "artifactType": { + "$ref": "#/components/schemas/ArtifactType", + "description": "" + }, + "state": { + "$ref": "#/components/schemas/VersionState", + "description": "" + }, + "globalId": { + "format": "int64", + "description": "", + "type": "integer" + }, + "version": { + "$ref": "#/components/schemas/Version", + "description": "" + }, + "contentId": { + "format": "int64", + "description": "", + "type": "integer" + }, + "artifactId": { + "$ref": "#/components/schemas/ArtifactId", + "description": "" + }, + "groupId": { + "$ref": "#/components/schemas/GroupId", + "description": "" + } + }, + "example": { + "groupId": "DemoGroup", + "artifactId": "demo-artifact-id", + "name": "Artifact Version Name", + "description": "Description of the artifact version", + "artifactType": "AVRO", + "state": "ENABLED", + "createdOn": "2018-02-10T09:30Z", + "owner": "some text", + "globalId": 37, + "version": "1.0.7", + "contentId": 62 + } + }, + "RuleViolationError": { + "title": "Root Type for Error", + "description": "All error responses, whether `4xx` or `5xx` will include one of these as the response\nbody.", + "type": "object", + "allOf": [ + { + "required": [ + "causes" + ], + "type": "object", + "properties": { + "causes": { + "description": "List of rule violation causes.", + "type": "array", + "items": { + "$ref": "#/components/schemas/RuleViolationCause" + } + } + } + }, + { + "$ref": "#/components/schemas/Error" + } + ], + "example": { + "error_code": 409, + "message": "Artifact failed validation", + "causes": [ + { + "description": "API is missing a title", + "context": "/info[title]" + }, + { + "description": "Operation IDs must be unique", + "context": "/paths[/invoices]/put[operationId]" + } + ] + }, + "x-codegen-extendsClass": "io.apicurio.registry.rest.v3.beans.Error" + }, + "ArtifactReference": { + "title": "Root Type for ArtifactReference", + "description": "A reference to a different artifact. Typically used with artifact types that can have dependencies like Protobuf.", + "required": [ + "artifactId", + "groupId", + "name" + ], + "type": "object", + "properties": { + "groupId": { + "type": "string" + }, + "artifactId": { + "type": "string" + }, + "version": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "example": { + "groupId": "mygroup", + "artifactId": "13842090-2ce3-11ec-8d3d-0242ac130003", + "version": "2", + "name": "foo.bar.Open" + } + }, + "ConfigurationProperty": { + "title": "Root Type for ConfigurationProperty", + "description": "", + "required": [ + "name", + "value", + "type", + "label", + "description" + ], + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "type": { + "description": "", + "type": "string" + }, + "label": { + "description": "", + "type": "string" + }, + "description": { + "description": "", + "type": "string" + } + }, + "example": { + "name": "registry.auth.owner-only-authorization", + "value": "true", + "type": "boolean", + "label": "Owner Only Authorization", + "description": "When enabled, the registry will allow only the artifact owner (creator) to modify an artifact." + } + }, + "UpdateConfigurationProperty": { + "title": "Root Type for UpdateConfigurationProperty", + "description": "", + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "type": "string" + } + }, + "example": { + "value": "true" + } + }, + "Limits": { + "title": "Root Type for Limits", + "description": "List of limitations on used resources, that are applied on the current instance of Registry.\nKeys represent the resource type and are suffixed by the corresponding unit.\nValues are integers. Only non-negative values are allowed, with the exception of -1, which means that the limit is not applied.", + "type": "object", + "properties": { + "maxTotalSchemasCount": { + "format": "int64", + "type": "integer" + }, + "maxSchemaSizeBytes": { + "format": "int64", + "type": "integer" + }, + "maxArtifactsCount": { + "format": "int64", + "type": "integer" + }, + "maxVersionsPerArtifactCount": { + "format": "int64", + "type": "integer" + }, + "maxArtifactPropertiesCount": { + "format": "int64", + "type": "integer" + }, + "maxPropertyKeySizeBytes": { + "format": "int64", + "type": "integer" + }, + "maxPropertyValueSizeBytes": { + "format": "int64", + "type": "integer" + }, + "maxArtifactLabelsCount": { + "format": "int64", + "type": "integer" + }, + "maxLabelSizeBytes": { + "format": "int64", + "type": "integer" + }, + "maxArtifactNameLengthChars": { + "format": "int64", + "type": "integer" + }, + "maxArtifactDescriptionLengthChars": { + "format": "int64", + "type": "integer" + }, + "maxRequestsPerSecondCount": { + "format": "int64", + "type": "integer" + } + }, + "example": { + "maxTotalSchemasCount": -1, + "maxSchemaSizeBytes": -1, + "maxArtifactsCount": -1, + "maxVersionsPerArtifactCount": -1, + "maxArtifactPropertiesCount": -1, + "maxPropertyKeySizeBytes": -1, + "maxPropertyValueSizeBytes": -1, + "maxArtifactLabelsCount": -1, + "maxLabelSizeBytes": -1, + "maxArtifactNameLengthChars": -1, + "maxArtifactDescriptionLengthChars": -1, + "maxRequestsPerSecondCount": -1 + } + }, + "SearchedGroup": { + "description": "Models a single group from the result set returned when searching for groups.", + "required": [ + "description", + "owner", + "createdOn", + "groupId", + "modifiedBy", + "modifiedOn" + ], + "type": "object", + "properties": { + "description": { + "description": "", + "type": "string" + }, + "createdOn": { + "format": "date-time", + "description": "", + "type": "string" + }, + "owner": { + "description": "", + "type": "string" + }, + "modifiedOn": { + "format": "date-time", + "description": "", + "type": "string" + }, + "modifiedBy": { + "description": "", + "type": "string" + }, + "groupId": { + "$ref": "#/components/schemas/GroupId", + "description": "" + } + }, + "example": { + "groupId": "My-Group", + "name": "Group Name", + "description": "Description of the group", + "owner": "user1", + "createdOn": "2019-03-22T12:51:19Z", + "modifiedBy": "user1", + "modifiedOn": "2019-03-22T12:51:19Z" + } + }, + "GroupMetaData": { + "title": "Root Type for GroupMetaData", + "description": "", + "required": [ + "groupId", + "description", + "owner", + "createdOn", + "modifiedBy", + "modifiedOn", + "labels" + ], + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "owner": { + "type": "string" + }, + "createdOn": { + "format": "date-time", + "type": "string" + }, + "modifiedBy": { + "type": "string" + }, + "modifiedOn": { + "format": "date-time", + "type": "string" + }, + "labels": { + "$ref": "#/components/schemas/Labels", + "description": "" + }, + "groupId": { + "$ref": "#/components/schemas/GroupId", + "description": "" + } + }, + "example": { + "groupId": "group-identifier", + "description": "Description of the group", + "artifactsType": "AVRO", + "owner": "user1", + "createdOn": "2019-03-22T12:51:19Z", + "modifiedBy": "user2", + "modifiedOn": "2019-07-19T15:09:00Z", + "properties": { + "custom-1": "foo", + "custom-2": "bar" + } + } + }, + "GroupSearchResults": { + "description": "Describes the response received when searching for groups.", + "required": [ + "count", + "groups" + ], + "type": "object", + "properties": { + "groups": { + "description": "The groups returned in the result set.", + "type": "array", + "items": { + "$ref": "#/components/schemas/SearchedGroup" + } + }, + "count": { + "description": "The total number of groups that matched the query that produced the result set (may be \nmore than the number of groups in the result set).", + "type": "integer" + } + } + }, + "CreateGroup": { + "title": "Root Type for CreateGroupMetaData", + "description": "", + "required": [ + "groupId" + ], + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "labels": { + "$ref": "#/components/schemas/Labels", + "description": "" + }, + "groupId": { + "$ref": "#/components/schemas/GroupId", + "description": "" + } + }, + "example": { + "groupId": "group-identifier", + "description": "The description of the artifact.", + "labels": { + "custom-1": "foo", + "custom-2": "bar" + } + } + }, + "VersionContent": { + "description": "", + "required": [ + "content", + "contentType" + ], + "type": "object", + "properties": { + "content": { + "description": "Raw content of the artifact version or a valid (and accessible) URL where the content can be found.", + "type": "string", + "example": "" + }, + "references": { + "description": "Collection of references to other artifacts.", + "type": "array", + "items": { + "$ref": "#/components/schemas/ArtifactReference" + } + }, + "contentType": { + "description": "The content-type, such as `application/json` or `text/xml`.", + "type": "string" + } + } + }, + "ReferenceType": { + "description": "", + "enum": [ + "OUTBOUND", + "INBOUND" + ], + "type": "string", + "example": "\"INBOUND\"", + "x-codegen-package": "io.apicurio.registry.types" + }, + "NewComment": { + "title": "Root Type for NewComment", + "description": "", + "required": [ + "value" + ], + "type": "object", + "properties": { + "value": { + "type": "string" + } + }, + "example": { + "value": "This is a new comment on an existing artifact version." + } + }, + "Comment": { + "title": "Root Type for NewComment", + "description": "", + "required": [ + "owner", + "createdOn", + "value", + "commentId" + ], + "type": "object", + "properties": { + "value": { + "maxLength": 1024, + "type": "string" + }, + "createdOn": { + "format": "date-time", + "type": "string" + }, + "owner": { + "description": "", + "type": "string" + }, + "commentId": { + "description": "", + "type": "string" + } + }, + "example": { + "commentId": "12345", + "value": "This is a comment on an artifact version.", + "owner": "bwayne", + "createdOn": "2023-07-01T15:22:01Z" } - ], - "x-codegen": { - "suppress-date-time-formatting": true, - "bean-annotations": [ - "io.quarkus.runtime.annotations.RegisterForReflection", + }, + "HandleReferencesType": { + "description": "How to handle references when retrieving content. References can either be\nleft unchanged (`PRESERVE`), re-written so they are valid in the context of the\nregistry (`REWRITE`), or fully dereferenced such that all externally referenced\ncontent is internalized (`DEREFERENCE`).", + "enum": [ + "PRESERVE", + "DEREFERENCE", + "REWRITE" + ], + "type": "string" + }, + "ArtifactId": { + "description": "The ID of a single artifact.", + "pattern": "^.{1,512}$", + "type": "string", + "example": "\"example-artifact\"" + }, + "GroupId": { + "description": "An ID of a single artifact group.", + "pattern": "^.{1,512}$", + "type": "string", + "example": "\"my-group\"" + }, + "Version": { + "description": "A single version of an artifact. Can be provided by the client when creating a new version,\nor it can be server-generated. The value can be any string unique to the artifact, but it is\nrecommended to use a simple integer or a semver value.", + "pattern": "^[a-zA-Z0-9._\\-+]{1,256}$", + "type": "string", + "example": "\"3.1.6\"" + }, + "BranchId": { + "description": "The ID of a single artifact branch.", + "pattern": "^[a-zA-Z0-9._\\-+]{1,256}$", + "type": "string", + "example": "\"latest\"" + }, + "ArtifactBranch": { + "title": "Root Type for ArtifactBranches", + "description": "", + "required": [ + "groupId", + "artifactId", + "branchId", + "versions" + ], + "type": "object", + "properties": { + "groupId": { + "$ref": "#/components/schemas/GroupId", + "description": "" + }, + "artifactId": { + "$ref": "#/components/schemas/ArtifactId", + "description": "" + }, + "branchId": { + "$ref": "#/components/schemas/BranchId", + "description": "" + }, + "versions": { + "description": "", + "type": "array", + "items": { + "$ref": "#/components/schemas/Version" + } + } + }, + "example": { + "latest": [ + { + "groupId": "default", + "artifactId": "user", + "version": "4" + }, { - "annotation": "lombok.experimental.SuperBuilder", - "excludeEnums": true + "groupId": "default", + "artifactId": "user", + "version": "3" }, { - "annotation": "lombok.AllArgsConstructor", - "excludeEnums": true + "groupId": "default", + "artifactId": "user", + "version": "2" }, { - "annotation": "lombok.NoArgsConstructor", - "excludeEnums": true + "groupId": "default", + "artifactId": "user", + "version": "1" + } + ], + "1.1.x": [ + { + "groupId": "default", + "artifactId": "user", + "version": "3" }, { - "annotation": "lombok.EqualsAndHashCode", - "excludeEnums": true + "groupId": "default", + "artifactId": "user", + "version": "1" + } + ], + "1.2.x": [ + { + "groupId": "default", + "artifactId": "user", + "version": "4" }, { - "annotation": "lombok.ToString(callSuper = true)", - "excludeEnums": true + "groupId": "default", + "artifactId": "user", + "version": "2" + } + ] + } + }, + "UserInterfaceConfig": { + "title": "Root Type for UserInterfaceConfig", + "description": "Defines the user interface configuration data type.", + "required": [ + "auth" + ], + "type": "object", + "properties": { + "ui": { + "$ref": "#/components/schemas/UserInterfaceConfigUi", + "properties": { + "contextPath": { + "type": "string" + }, + "navPrefixPath": { + "type": "string" + }, + "oaiDocsUrl": { + "type": "string" + } + } + }, + "auth": { + "$ref": "#/components/schemas/UserInterfaceConfigAuth", + "properties": { + "type": { + "type": "string" + }, + "rbacEnabled": { + "type": "boolean" + }, + "obacEnabled": { + "type": "boolean" + }, + "options": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "redirectUri": { + "type": "string" + }, + "clientId": { + "type": "string" + } + } + } + } + }, + "features": { + "$ref": "#/components/schemas/UserInterfaceConfigFeatures", + "properties": { + "readOnly": { + "type": "boolean" + }, + "breadcrumbs": { + "type": "boolean" + }, + "roleManagement": { + "type": "boolean" + }, + "settings": { + "type": "boolean" + } + } + } + }, + "example": { + "ui": { + "contextPath": "/", + "navPrefixPath": "/", + "oaiDocsUrl": "https://registry.apicur.io/docs" + }, + "auth": { + "type": "oidc", + "rbacEnabled": true, + "obacEnabled": false, + "options": { + "url": "https://auth.apicur.io/realms/apicurio", + "redirectUri": "http://registry.apicur.io", + "clientId": "apicurio-registry-ui" + } + }, + "features": { + "readOnly": false, + "breadcrumbs": true, + "roleManagement": false, + "settings": true + } + } + }, + "UserInterfaceConfigAuth": { + "title": "Root Type for UserInterfaceConfigAuth", + "description": "", + "required": [ + "obacEnabled", + "rbacEnabled" + ], + "type": "object", + "properties": { + "type": { + "enum": [ + "none", + "basic", + "oidc" + ], + "type": "string" + }, + "rbacEnabled": { + "type": "boolean" + }, + "obacEnabled": { + "type": "boolean" + }, + "options": { + "$ref": "#/components/schemas/Labels" + } + }, + "example": { + "type": "oidc", + "rbacEnabled": true, + "obacEnabled": false, + "options": { + "url": "https://auth.apicur.io/realms/apicurio", + "redirectUri": "https://registry.apicur.io", + "clientId": "registry-ui" + } + } + }, + "UserInterfaceConfigFeatures": { + "title": "Root Type for UserInterfaceConfigFeatures", + "description": "", + "type": "object", + "properties": { + "readOnly": { + "type": "boolean" + }, + "breadcrumbs": { + "type": "boolean" + }, + "roleManagement": { + "type": "boolean" + }, + "settings": { + "type": "boolean" + } + }, + "example": { + "readOnly": false, + "breadcrumbs": true, + "roleManagement": false, + "settings": true + } + }, + "UserInterfaceConfigUi": { + "title": "Root Type for UserInterfaceConfigUi", + "description": "", + "type": "object", + "properties": { + "contextPath": { + "type": "string" + }, + "navPrefixPath": { + "type": "string" + }, + "oaiDocsUrl": { + "type": "string" + } + }, + "example": { + "contextPath": "/", + "navPrefixPath": "/", + "oaiDocsUrl": "https://registry.apicur.io/docs" + } + }, + "Labels": { + "description": "User-defined name-value pairs. Name and value must be strings.", + "type": "object", + "additionalProperties": { + "type": "string" + }, + "x-codegen-inline": true, + "x-codegen-type": "StringMap" + }, + "EditableArtifactMetaData": { + "title": "Root Type for EditableArtifactMetaData", + "description": "", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "labels": { + "$ref": "#/components/schemas/Labels", + "description": "" + }, + "owner": { + "description": "", + "type": "string" + } + }, + "example": { + "name": "Artifact Name", + "description": "The description of the artifact.", + "owner": "user-1", + "labels": { + "custom-1": "foo", + "custom-2": "bar" + } + } + }, + "EditableGroupMetaData": { + "title": "Root Type for EditableArtifactMetaData", + "description": "", + "type": "object", + "properties": { + "description": { + "type": "string" + }, + "labels": { + "$ref": "#/components/schemas/Labels", + "description": "" + } + }, + "example": { + "description": "The description of the group.", + "labels": { + "custom-1": "foo", + "custom-2": "bar" + } + } + }, + "RoleMappingSearchResults": { + "description": "Describes the response received when searching for artifacts.", + "required": [ + "count", + "roleMappings" + ], + "type": "object", + "properties": { + "roleMappings": { + "description": "The role mappings returned in the result set.", + "type": "array", + "items": { + "$ref": "#/components/schemas/RoleMapping" } + }, + "count": { + "description": "The total number of role mappings that matched the query that produced the result set (may be \nmore than the number of role mappings in the result set).", + "type": "integer" + } + }, + "example": [ + { + "principalId": "user-1", + "principalName": "user-1", + "role": "ADMIN" + }, + { + "principalId": "svc_account_84874587_123484", + "principalName": "user-svc-account", + "role": "READ_ONLY" + } ] + }, + "EditableVersionMetaData": { + "title": "Root Type for EditableArtifactMetaData", + "description": "", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "labels": { + "$ref": "#/components/schemas/Labels", + "description": "" + }, + "state": { + "$ref": "#/components/schemas/VersionState", + "description": "" + } + }, + "example": { + "name": "Artifact Name", + "description": "The description of the artifact.", + "state": "DEPRECATED", + "labels": { + "custom-1": "foo", + "custom-2": "bar" + } + } + }, + "VersionState": { + "description": "Describes the state of an artifact or artifact version. The following states\nare possible:\n\n* ENABLED\n* DISABLED\n* DEPRECATED\n", + "enum": [ + "ENABLED", + "DISABLED", + "DEPRECATED" + ], + "type": "string", + "x-codegen-package": "io.apicurio.registry.types" + }, + "CreateArtifact": { + "description": "Data sent when creating a new artifact.", + "required": [ + "artifactId" + ], + "type": "object", + "properties": { + "artifactId": { + "$ref": "#/components/schemas/ArtifactId", + "description": "" + }, + "artifactType": { + "$ref": "#/components/schemas/ArtifactType", + "description": "" + }, + "name": { + "description": "", + "type": "string" + }, + "description": { + "description": "", + "type": "string" + }, + "labels": { + "$ref": "#/components/schemas/Labels", + "description": "" + }, + "firstVersion": { + "$ref": "#/components/schemas/CreateVersion", + "description": "" + } + }, + "example": { + "artifactId": "mytopic-value", + "type": "AVRO", + "name": "Invoice", + "description": "A standard Acme invoice payload.", + "labels": { + "label-1": "value-1", + "label-2": "value-2" + }, + "firstVersion": { + "version": "1.0.0", + "content": { + "content": "{\"type\":\"record\",\"name\":\"ExampleType\",\"fields\":[{\"name\":\"sdfgfsdgsdg\",\"type\":\"string\"}]}", + "references": [] + }, + "name": "ExampleType", + "description": "A simple example of an Avro type.", + "labels": {} + } + } + }, + "CreateVersion": { + "description": "", + "required": [ + "content" + ], + "type": "object", + "properties": { + "version": { + "$ref": "#/components/schemas/Version", + "description": "" + }, + "content": { + "$ref": "#/components/schemas/VersionContent", + "description": "" + }, + "name": { + "description": "", + "type": "string" + }, + "description": { + "description": "", + "type": "string" + }, + "labels": { + "$ref": "#/components/schemas/Labels", + "description": "" + }, + "branches": { + "description": "", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "CreateArtifactResponse": { + "description": "", + "required": [ + "artifact" + ], + "type": "object", + "properties": { + "artifact": { + "$ref": "#/components/schemas/ArtifactMetaData", + "description": "" + }, + "version": { + "$ref": "#/components/schemas/VersionMetaData", + "description": "" + } + } + }, + "VersionSortBy": { + "description": "", + "enum": [ + "version", + "name", + "createdOn", + "modifiedOn", + "globalId" + ], + "type": "string" + }, + "GroupSortBy": { + "description": "", + "enum": [ + "groupId", + "createdOn" + ], + "type": "string" + }, + "SnapshotMetaData": { + "title": "Root Type for SnapshotMetaData", + "description": "", + "required": [ + "snapshotId" + ], + "type": "object", + "properties": { + "snapshotId": { + "description": "", + "type": "string" + } + }, + "example": { + "snapshotId": "snp-1137292771" + } + } + }, + "responses": { + "NotFound": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "NotFoundExample": { + "value": { + "error_code": 404, + "message": "No artifact with id 'Topic-1/Inbound' could be found." + } + } + } + } + }, + "description": "Common response for all operations that can return a `404` error." + }, + "MethodNotAllowed": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "MethodNotAllowedExample": { + "value": { + "error_code": 405, + "message": "Method is currently not supported or disabled." + } + } + } + } + }, + "description": "Common response for all operations that can fail due to method not allowed or disabled." + }, + "ServerError": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "ErrorExample": { + "value": { + "error_code": 500, + "message": "Lost connection to the database." + } + } + } + } + }, + "description": "Common response for all operations that can fail with an unexpected server error." + }, + "BadRequest": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + } + } + }, + "description": "Common response for all operations that can return a `400` error." + }, + "Conflict": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Error" + }, + "examples": { + "ConflictExample": { + "value": { + "error_code": 409, + "message": "The artifact content was invalid." + } + } + } + } + }, + "description": "Common response used when an input conflicts with existing data." + }, + "RuleViolationConflict": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RuleViolationError" + }, + "examples": { + "RuleViolationConflictExample": { + "value": { + "error_code": 409, + "message": "The artifact content was invalid", + "causes": [ + { + "description": "API is missing a title", + "context": "/info[title]" + }, + { + "description": "Operation IDs must be unique", + "context": "/paths[/invoices]/put[operationId]" + } + ] + } + } + } + } + }, + "description": "Common response used when an input conflicts with existing data." + }, + "ArtifactContent": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/FileContent" + }, + "examples": { + "OpenAPI": { + "value": { + "openapi": "3.0.2", + "info": { + "title": "Empty API", + "version": "1.0.0", + "description": "An example API design using OpenAPI." + } + } + } + } + } + }, + "description": "The content of one version of one artifact." + } + } + }, + "tags": [ + { + "name": "Artifacts", + "description": "The primary way to interact with the Apicurio Registry API is to add, update, \nor delete artifacts. This section includes all of these primary operations." + }, + { + "name": "Metadata", + "description": "Sometimes the metadata for an artifact is important. For example, metadata includes \nwhen the artifact was created, last updated, and so on. This section contains \noperations to access (and in some cases change) an artifact's metadata." + }, + { + "name": "Versions", + "description": "When artifact content is updated, old versions of the artifact content are not lost. All versions can be listed and accessed if necessary. This section describes the operations used to list and access all versions of an artifact's content and metadata." + }, + { + "name": "Artifact rules", + "description": "Rules can be configured on a per-artifact basis, allowing for different approaches\nto content evolution for each artifact. These rules override any global rules\nthat have been configured. This section contains the operations used to manage a\nsingle artifact's rules." + }, + { + "name": "Global rules", + "description": "Global rules can be configured in the registry to govern how artifact content can \nevolve over time (as artifact content is **updated**). Global rules are applied \nwhenever an artifact is added to the registry, and also whenever an artifact's \ncontent is updated (only if that artifact does not have its own specific rules \nconfigured). This section describes the operations used to manage the global rules." + }, + { + "name": "Search", + "description": "The search API is used to browse or find artifacts in the registry. This section describes the operations for searching for artifacts and versions. " + }, + { + "name": "Admin", + "description": "Application functionality that is only accessible to admin users. Includes logging, global rules, and export/import of registry data." + }, + { + "name": "System", + "description": "System level functionality, including versioning and status information." + }, + { + "name": "Users", + "description": "Operations related to users." + }, + { + "name": "Groups", + "description": "Registry artifacts can be collected together using groups. This section includes all of the primary operations related to groups." } + ], + "x-codegen": { + "suppress-date-time-formatting": true, + "bean-annotations": [ + "io.quarkus.runtime.annotations.RegisterForReflection", + { + "annotation": "lombok.experimental.SuperBuilder", + "excludeEnums": true + }, + { + "annotation": "lombok.AllArgsConstructor", + "excludeEnums": true + }, + { + "annotation": "lombok.NoArgsConstructor", + "excludeEnums": true + }, + { + "annotation": "lombok.EqualsAndHashCode", + "excludeEnums": true + }, + { + "annotation": "lombok.ToString(callSuper = true)", + "excludeEnums": true + } + ] + } } \ No newline at end of file diff --git a/examples/avro-maven-with-references-auto/pom.xml b/examples/avro-maven-with-references-auto/pom.xml index 0574380b3f..69aaa07abe 100644 --- a/examples/avro-maven-with-references-auto/pom.xml +++ b/examples/avro-maven-with-references-auto/pom.xml @@ -32,7 +32,7 @@ avro-maven-with-references-auto TradeRaw 2.0 - AVRO + AVRO ${project.basedir}/src/main/resources/schemas/TradeRaw.avsc diff --git a/examples/avro-maven-with-references/pom.xml b/examples/avro-maven-with-references/pom.xml index 28e5b9ecbd..fcdd297fac 100644 --- a/examples/avro-maven-with-references/pom.xml +++ b/examples/avro-maven-with-references/pom.xml @@ -32,7 +32,7 @@ avro-maven-with-references TradeKey 2.0 - AVRO + AVRO ${project.basedir}/src/main/resources/schemas/TradeKey.avsc @@ -44,7 +44,7 @@ test-group Exchange 2.0 - AVRO + AVRO ${project.basedir}/src/main/resources/schemas/Exchange.avsc diff --git a/examples/custom-resolver/src/main/java/io/apicurio/registry/examples/custom/resolver/CustomSchemaResolver.java b/examples/custom-resolver/src/main/java/io/apicurio/registry/examples/custom/resolver/CustomSchemaResolver.java index 50215fe616..f3c1e49ae4 100644 --- a/examples/custom-resolver/src/main/java/io/apicurio/registry/examples/custom/resolver/CustomSchemaResolver.java +++ b/examples/custom-resolver/src/main/java/io/apicurio/registry/examples/custom/resolver/CustomSchemaResolver.java @@ -74,7 +74,7 @@ public SchemaLookupResult resolveSchema(String topic, Headers headers, D CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactId); - createArtifact.setType(ArtifactType.AVRO); + createArtifact.setArtifactType(ArtifactType.AVRO); createArtifact.setFirstVersion(new CreateVersion()); createArtifact.getFirstVersion().setContent(new VersionContent()); createArtifact.getFirstVersion().getContent().setContent(IoUtil.toString(schemaContent)); diff --git a/examples/custom-strategy/src/main/java/io/apicurio/registry/examples/custom/strategy/CustomStrategyExample.java b/examples/custom-strategy/src/main/java/io/apicurio/registry/examples/custom/strategy/CustomStrategyExample.java index 1382eaab64..97bd1ecd29 100644 --- a/examples/custom-strategy/src/main/java/io/apicurio/registry/examples/custom/strategy/CustomStrategyExample.java +++ b/examples/custom-strategy/src/main/java/io/apicurio/registry/examples/custom/strategy/CustomStrategyExample.java @@ -84,7 +84,7 @@ public static final void main(String[] args) throws Exception { CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactId); - createArtifact.setType(ArtifactType.AVRO); + createArtifact.setArtifactType(ArtifactType.AVRO); createArtifact.setFirstVersion(new CreateVersion()); createArtifact.getFirstVersion().setContent(new VersionContent()); createArtifact.getFirstVersion().getContent().setContent(Config.SCHEMA); diff --git a/examples/jsonschema-validation/src/main/java/io/apicurio/registry/examples/validation/json/JsonSchemaValidationExample.java b/examples/jsonschema-validation/src/main/java/io/apicurio/registry/examples/validation/json/JsonSchemaValidationExample.java index 92599955fa..6b5dfbc177 100644 --- a/examples/jsonschema-validation/src/main/java/io/apicurio/registry/examples/validation/json/JsonSchemaValidationExample.java +++ b/examples/jsonschema-validation/src/main/java/io/apicurio/registry/examples/validation/json/JsonSchemaValidationExample.java @@ -95,7 +95,7 @@ public static final void main(String[] args) throws Exception { CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactId); - createArtifact.setType(ArtifactType.JSON); + createArtifact.setArtifactType(ArtifactType.JSON); createArtifact.setFirstVersion(new CreateVersion()); createArtifact.getFirstVersion().setContent(new VersionContent()); createArtifact.getFirstVersion().getContent().setContent( diff --git a/examples/protobuf-find-latest/src/main/java/io/apicurio/registry/examples/simple/protobuf/ProtobufFindLatestExample.java b/examples/protobuf-find-latest/src/main/java/io/apicurio/registry/examples/simple/protobuf/ProtobufFindLatestExample.java index e75654bed1..c5672dbdf4 100644 --- a/examples/protobuf-find-latest/src/main/java/io/apicurio/registry/examples/simple/protobuf/ProtobufFindLatestExample.java +++ b/examples/protobuf-find-latest/src/main/java/io/apicurio/registry/examples/simple/protobuf/ProtobufFindLatestExample.java @@ -94,7 +94,7 @@ public static final void main(String[] args) throws Exception { CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactId); - createArtifact.setType(ArtifactType.PROTOBUF); + createArtifact.setArtifactType(ArtifactType.PROTOBUF); createArtifact.setFirstVersion(new CreateVersion()); createArtifact.getFirstVersion().setContent(new VersionContent()); createArtifact.getFirstVersion().getContent().setContent(IoUtil.toString(protofile)); diff --git a/examples/protobuf-validation/src/main/java/io/apicurio/registry/examples/validation/protobuf/ProtobufValidationExample.java b/examples/protobuf-validation/src/main/java/io/apicurio/registry/examples/validation/protobuf/ProtobufValidationExample.java index eeb400d047..d67db4d6cd 100644 --- a/examples/protobuf-validation/src/main/java/io/apicurio/registry/examples/validation/protobuf/ProtobufValidationExample.java +++ b/examples/protobuf-validation/src/main/java/io/apicurio/registry/examples/validation/protobuf/ProtobufValidationExample.java @@ -87,7 +87,7 @@ public static final void main(String[] args) throws Exception { CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactId); - createArtifact.setType(ArtifactType.PROTOBUF); + createArtifact.setArtifactType(ArtifactType.PROTOBUF); createArtifact.setFirstVersion(new CreateVersion()); createArtifact.getFirstVersion().setContent(new VersionContent()); createArtifact.getFirstVersion().getContent().setContent(IoUtil.toString(SCHEMA.getBytes(StandardCharsets.UTF_8))); diff --git a/examples/rest-client/src/main/java/io/apicurio/registry/examples/RegistryLoader.java b/examples/rest-client/src/main/java/io/apicurio/registry/examples/RegistryLoader.java index 0f5b1e692b..aed2afe2d9 100644 --- a/examples/rest-client/src/main/java/io/apicurio/registry/examples/RegistryLoader.java +++ b/examples/rest-client/src/main/java/io/apicurio/registry/examples/RegistryLoader.java @@ -74,7 +74,7 @@ public void run() { String artifactId = UUID.randomUUID().toString(); CreateArtifact createArtifact = new CreateArtifact(); - createArtifact.setType("AVRO"); + createArtifact.setArtifactType("AVRO"); createArtifact.setArtifactId(artifactId); CreateVersion createVersion = new CreateVersion(); createArtifact.setFirstVersion(createVersion); diff --git a/examples/rest-client/src/main/java/io/apicurio/registry/examples/util/RegistryDemoUtil.java b/examples/rest-client/src/main/java/io/apicurio/registry/examples/util/RegistryDemoUtil.java index afbb1381ad..6f9b816089 100644 --- a/examples/rest-client/src/main/java/io/apicurio/registry/examples/util/RegistryDemoUtil.java +++ b/examples/rest-client/src/main/java/io/apicurio/registry/examples/util/RegistryDemoUtil.java @@ -32,7 +32,7 @@ public static void createSchemaInServiceRegistry(RegistryClient service, String CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactId); - createArtifact.setType("JSON"); + createArtifact.setArtifactType("JSON"); createArtifact.setFirstVersion(new CreateVersion()); createArtifact.getFirstVersion().setContent(new VersionContent()); createArtifact.getFirstVersion().getContent().setContent(IoUtil.toString(content)); diff --git a/examples/serdes-with-references/src/main/java/io/apicurio/registry/examples/references/JsonSerdeReferencesExample.java b/examples/serdes-with-references/src/main/java/io/apicurio/registry/examples/references/JsonSerdeReferencesExample.java index f0d924e6c9..ba4ab5ce91 100644 --- a/examples/serdes-with-references/src/main/java/io/apicurio/registry/examples/references/JsonSerdeReferencesExample.java +++ b/examples/serdes-with-references/src/main/java/io/apicurio/registry/examples/references/JsonSerdeReferencesExample.java @@ -59,7 +59,7 @@ public static void main(String[] args) throws Exception { CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId("city"); - createArtifact.setType(ArtifactType.JSON); + createArtifact.setArtifactType(ArtifactType.JSON); createArtifact.setFirstVersion(new CreateVersion()); createArtifact.getFirstVersion().setContent(new VersionContent()); createArtifact.getFirstVersion().getContent().setContent(IoUtil.toString(citySchema)); @@ -81,7 +81,7 @@ public static void main(String[] args) throws Exception { CreateArtifact citizenCreateArtifact = new CreateArtifact(); citizenCreateArtifact.setArtifactId(artifactId); - citizenCreateArtifact.setType(ArtifactType.JSON); + citizenCreateArtifact.setArtifactType(ArtifactType.JSON); citizenCreateArtifact.setFirstVersion(new CreateVersion()); citizenCreateArtifact.getFirstVersion().setContent(new VersionContent()); citizenCreateArtifact.getFirstVersion().getContent().setContent(IoUtil.toString(citizenSchema)); diff --git a/examples/simple-avro-maven/pom.xml b/examples/simple-avro-maven/pom.xml index c629444202..db910e0eeb 100644 --- a/examples/simple-avro-maven/pom.xml +++ b/examples/simple-avro-maven/pom.xml @@ -59,7 +59,7 @@ default SimpleAvroMavenExample-value - AVRO + AVRO ${project.basedir}/src/main/resources/schemas/greeting.avsc diff --git a/examples/simple-json/src/main/java/io/apicurio/registry/examples/simple/json/SimpleJsonSchemaExample.java b/examples/simple-json/src/main/java/io/apicurio/registry/examples/simple/json/SimpleJsonSchemaExample.java index 6616113f4b..c8aeff03b4 100644 --- a/examples/simple-json/src/main/java/io/apicurio/registry/examples/simple/json/SimpleJsonSchemaExample.java +++ b/examples/simple-json/src/main/java/io/apicurio/registry/examples/simple/json/SimpleJsonSchemaExample.java @@ -112,7 +112,7 @@ public static void main(String[] args) throws Exception { CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactId); - createArtifact.setType(ArtifactType.JSON); + createArtifact.setArtifactType(ArtifactType.JSON); createArtifact.setFirstVersion(new CreateVersion()); createArtifact.getFirstVersion().setContent(new VersionContent()); createArtifact.getFirstVersion().getContent().setContent( diff --git a/go-sdk/pkg/registryclient-v3/.kiota.log b/go-sdk/pkg/registryclient-v3/.kiota.log index 6f2b814952..dce827bf10 100644 --- a/go-sdk/pkg/registryclient-v3/.kiota.log +++ b/go-sdk/pkg/registryclient-v3/.kiota.log @@ -1,7 +1,6 @@ Warning: KiotaBuilder OpenAPI warning: #/ - A servers entry (v3) or host + basePath + schemes properties (v2) was not present in the OpenAPI description. The root URL will need to be set manually with the request adapter. Warning: KiotaBuilder OpenAPI warning: #/paths/~1groups~1{groupId}~1artifacts~1{artifactId}~1versions/get/responses/200/content/application~1json/examples/All Versions/value - Data and type mismatch found. -Warning: KiotaBuilder OpenAPI warning: #/paths/~1groups~1{groupId}~1artifacts~1{artifactId}/post/requestBody/content/*~1*/examples/OpenAPI/value - Data and type mismatch found. -Warning: KiotaBuilder OpenAPI warning: #/components/schemas/SearchedVersion/example/references - Data and type mismatch found. +Warning: KiotaBuilder OpenAPI warning: #/components/schemas/VersionMetaData/example/version - Data and type mismatch found. Warning: KiotaBuilder OpenAPI warning: #/components/schemas/RoleMappingSearchResults/example - Data and type mismatch found. Warning: KiotaBuilder OpenAPI warning: #/components/responses/ArtifactContent/content/*~1*/examples/OpenAPI/value - Data and type mismatch found. Warning: KiotaBuilder No server url found in the OpenAPI document. The base url will need to be set when using the client. diff --git a/go-sdk/pkg/registryclient-v3/groups/item_artifacts_with_artifact_item_request_builder.go b/go-sdk/pkg/registryclient-v3/groups/item_artifacts_with_artifact_item_request_builder.go index ab52daf093..d8b07adda2 100644 --- a/go-sdk/pkg/registryclient-v3/groups/item_artifacts_with_artifact_item_request_builder.go +++ b/go-sdk/pkg/registryclient-v3/groups/item_artifacts_with_artifact_item_request_builder.go @@ -27,22 +27,6 @@ type ItemArtifactsWithArtifactItemRequestBuilderGetRequestConfiguration struct { Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption } -// ItemArtifactsWithArtifactItemRequestBuilderPostQueryParameters gets the metadata for an artifact that matches the raw content. Searches the registryfor a version of the given artifact matching the content provided in the body of thePOST.This operation can fail for the following reasons:* Provided content (request body) was empty (HTTP error `400`)* No artifact with the `artifactId` exists (HTTP error `404`)* No artifact version matching the provided content exists (HTTP error `404`)* A server error occurred (HTTP error `500`) -type ItemArtifactsWithArtifactItemRequestBuilderPostQueryParameters struct { - // Parameter that can be set to `true` to indicate that the server should "canonicalize" the content when searching for a matching version. Canonicalization is unique to each artifact type, but typically involves removing any extra whitespace and formatting the content in a consistent manner. - Canonical *bool `uriparametername:"canonical"` -} - -// ItemArtifactsWithArtifactItemRequestBuilderPostRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. -type ItemArtifactsWithArtifactItemRequestBuilderPostRequestConfiguration struct { - // Request headers - Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders - // Request options - Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption - // Request query parameters - QueryParameters *ItemArtifactsWithArtifactItemRequestBuilderPostQueryParameters -} - // ItemArtifactsWithArtifactItemRequestBuilderPutRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. type ItemArtifactsWithArtifactItemRequestBuilderPutRequestConfiguration struct { // Request headers @@ -59,7 +43,7 @@ func (m *ItemArtifactsWithArtifactItemRequestBuilder) Branches() *ItemArtifactsI // NewItemArtifactsWithArtifactItemRequestBuilderInternal instantiates a new WithArtifactItemRequestBuilder and sets the default values. func NewItemArtifactsWithArtifactItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemArtifactsWithArtifactItemRequestBuilder { m := &ItemArtifactsWithArtifactItemRequestBuilder{ - BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/groups/{groupId}/artifacts/{artifactId}{?canonical*}", pathParameters), + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/groups/{groupId}/artifacts/{artifactId}", pathParameters), } return m } @@ -108,26 +92,6 @@ func (m *ItemArtifactsWithArtifactItemRequestBuilder) Get(ctx context.Context, r return res.(i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.ArtifactMetaDataable), nil } -// Post gets the metadata for an artifact that matches the raw content. Searches the registryfor a version of the given artifact matching the content provided in the body of thePOST.This operation can fail for the following reasons:* Provided content (request body) was empty (HTTP error `400`)* No artifact with the `artifactId` exists (HTTP error `404`)* No artifact version matching the provided content exists (HTTP error `404`)* A server error occurred (HTTP error `500`) -func (m *ItemArtifactsWithArtifactItemRequestBuilder) Post(ctx context.Context, body i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.VersionContentable, requestConfiguration *ItemArtifactsWithArtifactItemRequestBuilderPostRequestConfiguration) (i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.VersionMetaDataable, error) { - requestInfo, err := m.ToPostRequestInformation(ctx, body, requestConfiguration) - if err != nil { - return nil, err - } - errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ - "404": i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.CreateErrorFromDiscriminatorValue, - "500": i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.CreateErrorFromDiscriminatorValue, - } - res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.CreateVersionMetaDataFromDiscriminatorValue, errorMapping) - if err != nil { - return nil, err - } - if res == nil { - return nil, nil - } - return res.(i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.VersionMetaDataable), nil -} - // Put updates the editable parts of the artifact's metadata. Not all metadata fields canbe updated. Note that only the properties included will be updated. You can updateonly the name by including only the `name` property in the payload of the request.Properties that are allowed but not present will result in the artifact's metadatanot being changed.This operation can fail for the following reasons:* No artifact with the `artifactId` exists (HTTP error `404`)* A server error occurred (HTTP error `500`) func (m *ItemArtifactsWithArtifactItemRequestBuilder) Put(ctx context.Context, body i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.EditableArtifactMetaDataable, requestConfiguration *ItemArtifactsWithArtifactItemRequestBuilderPutRequestConfiguration) error { requestInfo, err := m.ToPutRequestInformation(ctx, body, requestConfiguration) @@ -172,24 +136,6 @@ func (m *ItemArtifactsWithArtifactItemRequestBuilder) ToGetRequestInformation(ct return requestInfo, nil } -// ToPostRequestInformation gets the metadata for an artifact that matches the raw content. Searches the registryfor a version of the given artifact matching the content provided in the body of thePOST.This operation can fail for the following reasons:* Provided content (request body) was empty (HTTP error `400`)* No artifact with the `artifactId` exists (HTTP error `404`)* No artifact version matching the provided content exists (HTTP error `404`)* A server error occurred (HTTP error `500`) -func (m *ItemArtifactsWithArtifactItemRequestBuilder) ToPostRequestInformation(ctx context.Context, body i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.VersionContentable, requestConfiguration *ItemArtifactsWithArtifactItemRequestBuilderPostRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { - requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) - if requestConfiguration != nil { - if requestConfiguration.QueryParameters != nil { - requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) - } - requestInfo.Headers.AddAll(requestConfiguration.Headers) - requestInfo.AddRequestOptions(requestConfiguration.Options) - } - requestInfo.Headers.TryAdd("Accept", "application/json") - err := requestInfo.SetContentFromParsable(ctx, m.BaseRequestBuilder.RequestAdapter, "application/vnd.get.extended+json", body) - if err != nil { - return nil, err - } - return requestInfo, nil -} - // ToPutRequestInformation updates the editable parts of the artifact's metadata. Not all metadata fields canbe updated. Note that only the properties included will be updated. You can updateonly the name by including only the `name` property in the payload of the request.Properties that are allowed but not present will result in the artifact's metadatanot being changed.This operation can fail for the following reasons:* No artifact with the `artifactId` exists (HTTP error `404`)* A server error occurred (HTTP error `500`) func (m *ItemArtifactsWithArtifactItemRequestBuilder) ToPutRequestInformation(ctx context.Context, body i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.EditableArtifactMetaDataable, requestConfiguration *ItemArtifactsWithArtifactItemRequestBuilderPutRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.PUT, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) diff --git a/go-sdk/pkg/registryclient-v3/kiota-lock.json b/go-sdk/pkg/registryclient-v3/kiota-lock.json index 98ed9dc540..9bdf350363 100644 --- a/go-sdk/pkg/registryclient-v3/kiota-lock.json +++ b/go-sdk/pkg/registryclient-v3/kiota-lock.json @@ -1,5 +1,5 @@ { - "descriptionHash": "B7E881A306E98DE22A75E4E199AD4B6B1FB7A9A58841B8C999F35048BA1EA7C243F811990CD7392A25303CCDD7D3DDAE29EEB2E6BDDE060602588104177D8E34", + "descriptionHash": "36A3205CD328D2A338FE791975178428F2AA85C53C76161B81A23E6B9743CCEFC94E719E09AB30602EE883F2DD59E2DEFC8325611C8A437297B2465624D25101", "descriptionLocation": "../../v3.json", "lockFileVersion": "1.0.0", "kiotaVersion": "1.10.1", diff --git a/go-sdk/pkg/registryclient-v3/models/artifact_meta_data.go b/go-sdk/pkg/registryclient-v3/models/artifact_meta_data.go index 8a197b9461..f1d1cd4604 100644 --- a/go-sdk/pkg/registryclient-v3/models/artifact_meta_data.go +++ b/go-sdk/pkg/registryclient-v3/models/artifact_meta_data.go @@ -11,6 +11,8 @@ type ArtifactMetaData struct { additionalData map[string]any // The ID of a single artifact. artifactId *string + // The artifactType property + artifactType *string // The createdOn property createdOn *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time // The description property @@ -27,8 +29,6 @@ type ArtifactMetaData struct { name *string // The owner property owner *string - // The type property - typeEscaped *string } // NewArtifactMetaData instantiates a new ArtifactMetaData and sets the default values. @@ -53,6 +53,11 @@ func (m *ArtifactMetaData) GetArtifactId() *string { return m.artifactId } +// GetArtifactType gets the artifactType property value. The artifactType property +func (m *ArtifactMetaData) GetArtifactType() *string { + return m.artifactType +} + // GetCreatedOn gets the createdOn property value. The createdOn property func (m *ArtifactMetaData) GetCreatedOn() *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time { return m.createdOn @@ -76,6 +81,16 @@ func (m *ArtifactMetaData) GetFieldDeserializers() map[string]func(i878a80d2330e } return nil } + res["artifactType"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetArtifactType(val) + } + return nil + } res["createdOn"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetTimeValue() if err != nil { @@ -156,16 +171,6 @@ func (m *ArtifactMetaData) GetFieldDeserializers() map[string]func(i878a80d2330e } return nil } - res["type"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { - val, err := n.GetStringValue() - if err != nil { - return err - } - if val != nil { - m.SetTypeEscaped(val) - } - return nil - } return res } @@ -199,11 +204,6 @@ func (m *ArtifactMetaData) GetOwner() *string { return m.owner } -// GetTypeEscaped gets the type property value. The type property -func (m *ArtifactMetaData) GetTypeEscaped() *string { - return m.typeEscaped -} - // Serialize serializes information the current object func (m *ArtifactMetaData) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { { @@ -212,6 +212,12 @@ func (m *ArtifactMetaData) Serialize(writer i878a80d2330e89d26896388a3f487eef27b return err } } + { + err := writer.WriteStringValue("artifactType", m.GetArtifactType()) + if err != nil { + return err + } + } { err := writer.WriteTimeValue("createdOn", m.GetCreatedOn()) if err != nil { @@ -260,12 +266,6 @@ func (m *ArtifactMetaData) Serialize(writer i878a80d2330e89d26896388a3f487eef27b return err } } - { - err := writer.WriteStringValue("type", m.GetTypeEscaped()) - if err != nil { - return err - } - } { err := writer.WriteAdditionalData(m.GetAdditionalData()) if err != nil { @@ -285,6 +285,11 @@ func (m *ArtifactMetaData) SetArtifactId(value *string) { m.artifactId = value } +// SetArtifactType sets the artifactType property value. The artifactType property +func (m *ArtifactMetaData) SetArtifactType(value *string) { + m.artifactType = value +} + // SetCreatedOn sets the createdOn property value. The createdOn property func (m *ArtifactMetaData) SetCreatedOn(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) { m.createdOn = value @@ -325,16 +330,12 @@ func (m *ArtifactMetaData) SetOwner(value *string) { m.owner = value } -// SetTypeEscaped sets the type property value. The type property -func (m *ArtifactMetaData) SetTypeEscaped(value *string) { - m.typeEscaped = value -} - // ArtifactMetaDataable type ArtifactMetaDataable interface { i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable GetArtifactId() *string + GetArtifactType() *string GetCreatedOn() *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time GetDescription() *string GetGroupId() *string @@ -343,8 +344,8 @@ type ArtifactMetaDataable interface { GetModifiedOn() *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time GetName() *string GetOwner() *string - GetTypeEscaped() *string SetArtifactId(value *string) + SetArtifactType(value *string) SetCreatedOn(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) SetDescription(value *string) SetGroupId(value *string) @@ -353,5 +354,4 @@ type ArtifactMetaDataable interface { SetModifiedOn(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) SetName(value *string) SetOwner(value *string) - SetTypeEscaped(value *string) } diff --git a/go-sdk/pkg/registryclient-v3/models/create_artifact.go b/go-sdk/pkg/registryclient-v3/models/create_artifact.go index 853d2874d4..1e9c41f80d 100644 --- a/go-sdk/pkg/registryclient-v3/models/create_artifact.go +++ b/go-sdk/pkg/registryclient-v3/models/create_artifact.go @@ -10,6 +10,8 @@ type CreateArtifact struct { additionalData map[string]any // The ID of a single artifact. artifactId *string + // The artifactType property + artifactType *string // The description property description *string // The firstVersion property @@ -18,8 +20,6 @@ type CreateArtifact struct { labels Labelsable // The name property name *string - // The type property - typeEscaped *string } // NewCreateArtifact instantiates a new CreateArtifact and sets the default values. @@ -44,6 +44,11 @@ func (m *CreateArtifact) GetArtifactId() *string { return m.artifactId } +// GetArtifactType gets the artifactType property value. The artifactType property +func (m *CreateArtifact) GetArtifactType() *string { + return m.artifactType +} + // GetDescription gets the description property value. The description property func (m *CreateArtifact) GetDescription() *string { return m.description @@ -62,6 +67,16 @@ func (m *CreateArtifact) GetFieldDeserializers() map[string]func(i878a80d2330e89 } return nil } + res["artifactType"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetArtifactType(val) + } + return nil + } res["description"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetStringValue() if err != nil { @@ -102,16 +117,6 @@ func (m *CreateArtifact) GetFieldDeserializers() map[string]func(i878a80d2330e89 } return nil } - res["type"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { - val, err := n.GetStringValue() - if err != nil { - return err - } - if val != nil { - m.SetTypeEscaped(val) - } - return nil - } return res } @@ -130,11 +135,6 @@ func (m *CreateArtifact) GetName() *string { return m.name } -// GetTypeEscaped gets the type property value. The type property -func (m *CreateArtifact) GetTypeEscaped() *string { - return m.typeEscaped -} - // Serialize serializes information the current object func (m *CreateArtifact) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { { @@ -144,31 +144,31 @@ func (m *CreateArtifact) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a } } { - err := writer.WriteStringValue("description", m.GetDescription()) + err := writer.WriteStringValue("artifactType", m.GetArtifactType()) if err != nil { return err } } { - err := writer.WriteObjectValue("firstVersion", m.GetFirstVersion()) + err := writer.WriteStringValue("description", m.GetDescription()) if err != nil { return err } } { - err := writer.WriteObjectValue("labels", m.GetLabels()) + err := writer.WriteObjectValue("firstVersion", m.GetFirstVersion()) if err != nil { return err } } { - err := writer.WriteStringValue("name", m.GetName()) + err := writer.WriteObjectValue("labels", m.GetLabels()) if err != nil { return err } } { - err := writer.WriteStringValue("type", m.GetTypeEscaped()) + err := writer.WriteStringValue("name", m.GetName()) if err != nil { return err } @@ -192,6 +192,11 @@ func (m *CreateArtifact) SetArtifactId(value *string) { m.artifactId = value } +// SetArtifactType sets the artifactType property value. The artifactType property +func (m *CreateArtifact) SetArtifactType(value *string) { + m.artifactType = value +} + // SetDescription sets the description property value. The description property func (m *CreateArtifact) SetDescription(value *string) { m.description = value @@ -212,25 +217,20 @@ func (m *CreateArtifact) SetName(value *string) { m.name = value } -// SetTypeEscaped sets the type property value. The type property -func (m *CreateArtifact) SetTypeEscaped(value *string) { - m.typeEscaped = value -} - // CreateArtifactable type CreateArtifactable interface { i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable GetArtifactId() *string + GetArtifactType() *string GetDescription() *string GetFirstVersion() CreateVersionable GetLabels() Labelsable GetName() *string - GetTypeEscaped() *string SetArtifactId(value *string) + SetArtifactType(value *string) SetDescription(value *string) SetFirstVersion(value CreateVersionable) SetLabels(value Labelsable) SetName(value *string) - SetTypeEscaped(value *string) } diff --git a/go-sdk/pkg/registryclient-v3/models/searched_artifact.go b/go-sdk/pkg/registryclient-v3/models/searched_artifact.go index ecb6a6ea9e..c2109844ed 100644 --- a/go-sdk/pkg/registryclient-v3/models/searched_artifact.go +++ b/go-sdk/pkg/registryclient-v3/models/searched_artifact.go @@ -11,6 +11,8 @@ type SearchedArtifact struct { additionalData map[string]any // The ID of a single artifact. artifactId *string + // The artifactType property + artifactType *string // The createdOn property createdOn *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time // The description property @@ -25,8 +27,6 @@ type SearchedArtifact struct { name *string // The owner property owner *string - // The type property - typeEscaped *string } // NewSearchedArtifact instantiates a new SearchedArtifact and sets the default values. @@ -51,6 +51,11 @@ func (m *SearchedArtifact) GetArtifactId() *string { return m.artifactId } +// GetArtifactType gets the artifactType property value. The artifactType property +func (m *SearchedArtifact) GetArtifactType() *string { + return m.artifactType +} + // GetCreatedOn gets the createdOn property value. The createdOn property func (m *SearchedArtifact) GetCreatedOn() *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time { return m.createdOn @@ -74,6 +79,16 @@ func (m *SearchedArtifact) GetFieldDeserializers() map[string]func(i878a80d2330e } return nil } + res["artifactType"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetArtifactType(val) + } + return nil + } res["createdOn"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetTimeValue() if err != nil { @@ -144,16 +159,6 @@ func (m *SearchedArtifact) GetFieldDeserializers() map[string]func(i878a80d2330e } return nil } - res["type"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { - val, err := n.GetStringValue() - if err != nil { - return err - } - if val != nil { - m.SetTypeEscaped(val) - } - return nil - } return res } @@ -182,11 +187,6 @@ func (m *SearchedArtifact) GetOwner() *string { return m.owner } -// GetTypeEscaped gets the type property value. The type property -func (m *SearchedArtifact) GetTypeEscaped() *string { - return m.typeEscaped -} - // Serialize serializes information the current object func (m *SearchedArtifact) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { { @@ -195,6 +195,12 @@ func (m *SearchedArtifact) Serialize(writer i878a80d2330e89d26896388a3f487eef27b return err } } + { + err := writer.WriteStringValue("artifactType", m.GetArtifactType()) + if err != nil { + return err + } + } { err := writer.WriteTimeValue("createdOn", m.GetCreatedOn()) if err != nil { @@ -237,12 +243,6 @@ func (m *SearchedArtifact) Serialize(writer i878a80d2330e89d26896388a3f487eef27b return err } } - { - err := writer.WriteStringValue("type", m.GetTypeEscaped()) - if err != nil { - return err - } - } { err := writer.WriteAdditionalData(m.GetAdditionalData()) if err != nil { @@ -262,6 +262,11 @@ func (m *SearchedArtifact) SetArtifactId(value *string) { m.artifactId = value } +// SetArtifactType sets the artifactType property value. The artifactType property +func (m *SearchedArtifact) SetArtifactType(value *string) { + m.artifactType = value +} + // SetCreatedOn sets the createdOn property value. The createdOn property func (m *SearchedArtifact) SetCreatedOn(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) { m.createdOn = value @@ -297,16 +302,12 @@ func (m *SearchedArtifact) SetOwner(value *string) { m.owner = value } -// SetTypeEscaped sets the type property value. The type property -func (m *SearchedArtifact) SetTypeEscaped(value *string) { - m.typeEscaped = value -} - // SearchedArtifactable type SearchedArtifactable interface { i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable GetArtifactId() *string + GetArtifactType() *string GetCreatedOn() *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time GetDescription() *string GetGroupId() *string @@ -314,8 +315,8 @@ type SearchedArtifactable interface { GetModifiedOn() *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time GetName() *string GetOwner() *string - GetTypeEscaped() *string SetArtifactId(value *string) + SetArtifactType(value *string) SetCreatedOn(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) SetDescription(value *string) SetGroupId(value *string) @@ -323,5 +324,4 @@ type SearchedArtifactable interface { SetModifiedOn(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) SetName(value *string) SetOwner(value *string) - SetTypeEscaped(value *string) } diff --git a/go-sdk/pkg/registryclient-v3/models/searched_version.go b/go-sdk/pkg/registryclient-v3/models/searched_version.go index 911cb08184..b5df3d603f 100644 --- a/go-sdk/pkg/registryclient-v3/models/searched_version.go +++ b/go-sdk/pkg/registryclient-v3/models/searched_version.go @@ -9,6 +9,10 @@ import ( type SearchedVersion struct { // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. additionalData map[string]any + // The ID of a single artifact. + artifactId *string + // The artifactType property + artifactType *string // The contentId property contentId *int64 // The createdOn property @@ -17,17 +21,15 @@ type SearchedVersion struct { description *string // The globalId property globalId *int64 + // An ID of a single artifact group. + groupId *string // The name property name *string // The owner property owner *string - // The references property - references []ArtifactReferenceable // Describes the state of an artifact or artifact version. The following statesare possible:* ENABLED* DISABLED* DEPRECATED state *VersionState - // The type property - typeEscaped *string - // The version property + // A single version of an artifact. Can be provided by the client when creating a new version,or it can be server-generated. The value can be any string unique to the artifact, but it isrecommended to use a simple integer or a semver value. version *string } @@ -48,6 +50,16 @@ func (m *SearchedVersion) GetAdditionalData() map[string]any { return m.additionalData } +// GetArtifactId gets the artifactId property value. The ID of a single artifact. +func (m *SearchedVersion) GetArtifactId() *string { + return m.artifactId +} + +// GetArtifactType gets the artifactType property value. The artifactType property +func (m *SearchedVersion) GetArtifactType() *string { + return m.artifactType +} + // GetContentId gets the contentId property value. The contentId property func (m *SearchedVersion) GetContentId() *int64 { return m.contentId @@ -66,6 +78,26 @@ func (m *SearchedVersion) GetDescription() *string { // GetFieldDeserializers the deserialization information for the current model func (m *SearchedVersion) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error) + res["artifactId"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetArtifactId(val) + } + return nil + } + res["artifactType"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetArtifactType(val) + } + return nil + } res["contentId"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetInt64Value() if err != nil { @@ -106,39 +138,33 @@ func (m *SearchedVersion) GetFieldDeserializers() map[string]func(i878a80d2330e8 } return nil } - res["name"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res["groupId"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { - m.SetName(val) + m.SetGroupId(val) } return nil } - res["owner"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res["name"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetStringValue() if err != nil { return err } if val != nil { - m.SetOwner(val) + m.SetName(val) } return nil } - res["references"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { - val, err := n.GetCollectionOfObjectValues(CreateArtifactReferenceFromDiscriminatorValue) + res["owner"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() if err != nil { return err } if val != nil { - res := make([]ArtifactReferenceable, len(val)) - for i, v := range val { - if v != nil { - res[i] = v.(ArtifactReferenceable) - } - } - m.SetReferences(res) + m.SetOwner(val) } return nil } @@ -152,16 +178,6 @@ func (m *SearchedVersion) GetFieldDeserializers() map[string]func(i878a80d2330e8 } return nil } - res["type"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { - val, err := n.GetStringValue() - if err != nil { - return err - } - if val != nil { - m.SetTypeEscaped(val) - } - return nil - } res["version"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetStringValue() if err != nil { @@ -180,6 +196,11 @@ func (m *SearchedVersion) GetGlobalId() *int64 { return m.globalId } +// GetGroupId gets the groupId property value. An ID of a single artifact group. +func (m *SearchedVersion) GetGroupId() *string { + return m.groupId +} + // GetName gets the name property value. The name property func (m *SearchedVersion) GetName() *string { return m.name @@ -190,28 +211,30 @@ func (m *SearchedVersion) GetOwner() *string { return m.owner } -// GetReferences gets the references property value. The references property -func (m *SearchedVersion) GetReferences() []ArtifactReferenceable { - return m.references -} - // GetState gets the state property value. Describes the state of an artifact or artifact version. The following statesare possible:* ENABLED* DISABLED* DEPRECATED func (m *SearchedVersion) GetState() *VersionState { return m.state } -// GetTypeEscaped gets the type property value. The type property -func (m *SearchedVersion) GetTypeEscaped() *string { - return m.typeEscaped -} - -// GetVersion gets the version property value. The version property +// GetVersion gets the version property value. A single version of an artifact. Can be provided by the client when creating a new version,or it can be server-generated. The value can be any string unique to the artifact, but it isrecommended to use a simple integer or a semver value. func (m *SearchedVersion) GetVersion() *string { return m.version } // Serialize serializes information the current object func (m *SearchedVersion) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + { + err := writer.WriteStringValue("artifactId", m.GetArtifactId()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("artifactType", m.GetArtifactType()) + if err != nil { + return err + } + } { err := writer.WriteInt64Value("contentId", m.GetContentId()) if err != nil { @@ -237,25 +260,19 @@ func (m *SearchedVersion) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0 } } { - err := writer.WriteStringValue("name", m.GetName()) + err := writer.WriteStringValue("groupId", m.GetGroupId()) if err != nil { return err } } { - err := writer.WriteStringValue("owner", m.GetOwner()) + err := writer.WriteStringValue("name", m.GetName()) if err != nil { return err } } - if m.GetReferences() != nil { - cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetReferences())) - for i, v := range m.GetReferences() { - if v != nil { - cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) - } - } - err := writer.WriteCollectionOfObjectValues("references", cast) + { + err := writer.WriteStringValue("owner", m.GetOwner()) if err != nil { return err } @@ -267,12 +284,6 @@ func (m *SearchedVersion) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0 return err } } - { - err := writer.WriteStringValue("type", m.GetTypeEscaped()) - if err != nil { - return err - } - } { err := writer.WriteStringValue("version", m.GetVersion()) if err != nil { @@ -293,6 +304,16 @@ func (m *SearchedVersion) SetAdditionalData(value map[string]any) { m.additionalData = value } +// SetArtifactId sets the artifactId property value. The ID of a single artifact. +func (m *SearchedVersion) SetArtifactId(value *string) { + m.artifactId = value +} + +// SetArtifactType sets the artifactType property value. The artifactType property +func (m *SearchedVersion) SetArtifactType(value *string) { + m.artifactType = value +} + // SetContentId sets the contentId property value. The contentId property func (m *SearchedVersion) SetContentId(value *int64) { m.contentId = value @@ -313,6 +334,11 @@ func (m *SearchedVersion) SetGlobalId(value *int64) { m.globalId = value } +// SetGroupId sets the groupId property value. An ID of a single artifact group. +func (m *SearchedVersion) SetGroupId(value *string) { + m.groupId = value +} + // SetName sets the name property value. The name property func (m *SearchedVersion) SetName(value *string) { m.name = value @@ -323,22 +349,12 @@ func (m *SearchedVersion) SetOwner(value *string) { m.owner = value } -// SetReferences sets the references property value. The references property -func (m *SearchedVersion) SetReferences(value []ArtifactReferenceable) { - m.references = value -} - // SetState sets the state property value. Describes the state of an artifact or artifact version. The following statesare possible:* ENABLED* DISABLED* DEPRECATED func (m *SearchedVersion) SetState(value *VersionState) { m.state = value } -// SetTypeEscaped sets the type property value. The type property -func (m *SearchedVersion) SetTypeEscaped(value *string) { - m.typeEscaped = value -} - -// SetVersion sets the version property value. The version property +// SetVersion sets the version property value. A single version of an artifact. Can be provided by the client when creating a new version,or it can be server-generated. The value can be any string unique to the artifact, but it isrecommended to use a simple integer or a semver value. func (m *SearchedVersion) SetVersion(value *string) { m.version = value } @@ -347,24 +363,26 @@ func (m *SearchedVersion) SetVersion(value *string) { type SearchedVersionable interface { i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetArtifactId() *string + GetArtifactType() *string GetContentId() *int64 GetCreatedOn() *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time GetDescription() *string GetGlobalId() *int64 + GetGroupId() *string GetName() *string GetOwner() *string - GetReferences() []ArtifactReferenceable GetState() *VersionState - GetTypeEscaped() *string GetVersion() *string + SetArtifactId(value *string) + SetArtifactType(value *string) SetContentId(value *int64) SetCreatedOn(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) SetDescription(value *string) SetGlobalId(value *int64) + SetGroupId(value *string) SetName(value *string) SetOwner(value *string) - SetReferences(value []ArtifactReferenceable) SetState(value *VersionState) - SetTypeEscaped(value *string) SetVersion(value *string) } diff --git a/go-sdk/pkg/registryclient-v3/models/version_meta_data.go b/go-sdk/pkg/registryclient-v3/models/version_meta_data.go index 1325e94a98..f658094b08 100644 --- a/go-sdk/pkg/registryclient-v3/models/version_meta_data.go +++ b/go-sdk/pkg/registryclient-v3/models/version_meta_data.go @@ -11,6 +11,8 @@ type VersionMetaData struct { additionalData map[string]any // The ID of a single artifact. artifactId *string + // The artifactType property + artifactType *string // The contentId property contentId *int64 // The createdOn property @@ -29,9 +31,7 @@ type VersionMetaData struct { owner *string // Describes the state of an artifact or artifact version. The following statesare possible:* ENABLED* DISABLED* DEPRECATED state *VersionState - // The type property - typeEscaped *string - // The version property + // A single version of an artifact. Can be provided by the client when creating a new version,or it can be server-generated. The value can be any string unique to the artifact, but it isrecommended to use a simple integer or a semver value. version *string } @@ -57,6 +57,11 @@ func (m *VersionMetaData) GetArtifactId() *string { return m.artifactId } +// GetArtifactType gets the artifactType property value. The artifactType property +func (m *VersionMetaData) GetArtifactType() *string { + return m.artifactType +} + // GetContentId gets the contentId property value. The contentId property func (m *VersionMetaData) GetContentId() *int64 { return m.contentId @@ -85,6 +90,16 @@ func (m *VersionMetaData) GetFieldDeserializers() map[string]func(i878a80d2330e8 } return nil } + res["artifactType"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetArtifactType(val) + } + return nil + } res["contentId"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetInt64Value() if err != nil { @@ -175,16 +190,6 @@ func (m *VersionMetaData) GetFieldDeserializers() map[string]func(i878a80d2330e8 } return nil } - res["type"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { - val, err := n.GetStringValue() - if err != nil { - return err - } - if val != nil { - m.SetTypeEscaped(val) - } - return nil - } res["version"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { val, err := n.GetStringValue() if err != nil { @@ -228,12 +233,7 @@ func (m *VersionMetaData) GetState() *VersionState { return m.state } -// GetTypeEscaped gets the type property value. The type property -func (m *VersionMetaData) GetTypeEscaped() *string { - return m.typeEscaped -} - -// GetVersion gets the version property value. The version property +// GetVersion gets the version property value. A single version of an artifact. Can be provided by the client when creating a new version,or it can be server-generated. The value can be any string unique to the artifact, but it isrecommended to use a simple integer or a semver value. func (m *VersionMetaData) GetVersion() *string { return m.version } @@ -246,6 +246,12 @@ func (m *VersionMetaData) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0 return err } } + { + err := writer.WriteStringValue("artifactType", m.GetArtifactType()) + if err != nil { + return err + } + } { err := writer.WriteInt64Value("contentId", m.GetContentId()) if err != nil { @@ -301,12 +307,6 @@ func (m *VersionMetaData) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0 return err } } - { - err := writer.WriteStringValue("type", m.GetTypeEscaped()) - if err != nil { - return err - } - } { err := writer.WriteStringValue("version", m.GetVersion()) if err != nil { @@ -332,6 +332,11 @@ func (m *VersionMetaData) SetArtifactId(value *string) { m.artifactId = value } +// SetArtifactType sets the artifactType property value. The artifactType property +func (m *VersionMetaData) SetArtifactType(value *string) { + m.artifactType = value +} + // SetContentId sets the contentId property value. The contentId property func (m *VersionMetaData) SetContentId(value *int64) { m.contentId = value @@ -377,12 +382,7 @@ func (m *VersionMetaData) SetState(value *VersionState) { m.state = value } -// SetTypeEscaped sets the type property value. The type property -func (m *VersionMetaData) SetTypeEscaped(value *string) { - m.typeEscaped = value -} - -// SetVersion sets the version property value. The version property +// SetVersion sets the version property value. A single version of an artifact. Can be provided by the client when creating a new version,or it can be server-generated. The value can be any string unique to the artifact, but it isrecommended to use a simple integer or a semver value. func (m *VersionMetaData) SetVersion(value *string) { m.version = value } @@ -392,6 +392,7 @@ type VersionMetaDataable interface { i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable GetArtifactId() *string + GetArtifactType() *string GetContentId() *int64 GetCreatedOn() *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time GetDescription() *string @@ -401,9 +402,9 @@ type VersionMetaDataable interface { GetName() *string GetOwner() *string GetState() *VersionState - GetTypeEscaped() *string GetVersion() *string SetArtifactId(value *string) + SetArtifactType(value *string) SetContentId(value *int64) SetCreatedOn(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) SetDescription(value *string) @@ -413,6 +414,5 @@ type VersionMetaDataable interface { SetName(value *string) SetOwner(value *string) SetState(value *VersionState) - SetTypeEscaped(value *string) SetVersion(value *string) } diff --git a/go-sdk/pkg/registryclient-v3/search/artifacts_request_builder.go b/go-sdk/pkg/registryclient-v3/search/artifacts_request_builder.go index 14b36d5c71..1ce22a42ac 100644 --- a/go-sdk/pkg/registryclient-v3/search/artifacts_request_builder.go +++ b/go-sdk/pkg/registryclient-v3/search/artifacts_request_builder.go @@ -11,7 +11,7 @@ type ArtifactsRequestBuilder struct { i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder } -// ArtifactsRequestBuilderGetQueryParameters returns a paginated list of all artifacts that match the provided filter criteria. +// ArtifactsRequestBuilderGetQueryParameters returns a paginated list of all artifacts that match the provided filter criteria.This operation can fail for the following reasons:* A server error occurred (HTTP error `500`) type ArtifactsRequestBuilderGetQueryParameters struct { // Filter by artifactId. ArtifactId *string `uriparametername:"artifactId"` @@ -53,12 +53,14 @@ type ArtifactsRequestBuilderGetRequestConfiguration struct { QueryParameters *ArtifactsRequestBuilderGetQueryParameters } -// ArtifactsRequestBuilderPostQueryParameters returns a paginated list of all artifacts with at least one version that matches theposted content. +// ArtifactsRequestBuilderPostQueryParameters returns a paginated list of all artifacts with at least one version that matches theposted content.This operation can fail for the following reasons:* Provided content (request body) was empty (HTTP error `400`)* A server error occurred (HTTP error `500`) type ArtifactsRequestBuilderPostQueryParameters struct { // Indicates the type of artifact represented by the content being used for the search. This is only needed when using the `canonical` query parameter, so that the server knows how to canonicalize the content prior to searching for matching artifacts. ArtifactType *string `uriparametername:"artifactType"` // Parameter that can be set to `true` to indicate that the server should "canonicalize" the content when searching for matching artifacts. Canonicalization is unique to each artifact type, but typically involves removing any extra whitespace and formatting the content in a consistent manner. Must be used along with the `artifactType` query parameter. Canonical *bool `uriparametername:"canonical"` + // Filter by artifact group. + GroupId *string `uriparametername:"groupId"` // The number of artifacts to return. Defaults to 20. Limit *int32 `uriparametername:"limit"` // The number of artifacts to skip before starting to collect the result set. Defaults to 0. @@ -100,7 +102,7 @@ func NewArtifactsRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee2633 return NewArtifactsRequestBuilderInternal(urlParams, requestAdapter) } -// Get returns a paginated list of all artifacts that match the provided filter criteria. +// Get returns a paginated list of all artifacts that match the provided filter criteria.This operation can fail for the following reasons:* A server error occurred (HTTP error `500`) func (m *ArtifactsRequestBuilder) Get(ctx context.Context, requestConfiguration *ArtifactsRequestBuilderGetRequestConfiguration) (i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.ArtifactSearchResultsable, error) { requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration) if err != nil { @@ -119,13 +121,14 @@ func (m *ArtifactsRequestBuilder) Get(ctx context.Context, requestConfiguration return res.(i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.ArtifactSearchResultsable), nil } -// Post returns a paginated list of all artifacts with at least one version that matches theposted content. +// Post returns a paginated list of all artifacts with at least one version that matches theposted content.This operation can fail for the following reasons:* Provided content (request body) was empty (HTTP error `400`)* A server error occurred (HTTP error `500`) func (m *ArtifactsRequestBuilder) Post(ctx context.Context, body []byte, contentType *string, requestConfiguration *ArtifactsRequestBuilderPostRequestConfiguration) (i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.ArtifactSearchResultsable, error) { requestInfo, err := m.ToPostRequestInformation(ctx, body, contentType, requestConfiguration) if err != nil { return nil, err } errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "400": i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.CreateErrorFromDiscriminatorValue, "500": i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.CreateErrorFromDiscriminatorValue, } res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.CreateArtifactSearchResultsFromDiscriminatorValue, errorMapping) @@ -138,7 +141,7 @@ func (m *ArtifactsRequestBuilder) Post(ctx context.Context, body []byte, content return res.(i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.ArtifactSearchResultsable), nil } -// ToGetRequestInformation returns a paginated list of all artifacts that match the provided filter criteria. +// ToGetRequestInformation returns a paginated list of all artifacts that match the provided filter criteria.This operation can fail for the following reasons:* A server error occurred (HTTP error `500`) func (m *ArtifactsRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *ArtifactsRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) if requestConfiguration != nil { @@ -152,7 +155,7 @@ func (m *ArtifactsRequestBuilder) ToGetRequestInformation(ctx context.Context, r return requestInfo, nil } -// ToPostRequestInformation returns a paginated list of all artifacts with at least one version that matches theposted content. +// ToPostRequestInformation returns a paginated list of all artifacts with at least one version that matches theposted content.This operation can fail for the following reasons:* Provided content (request body) was empty (HTTP error `400`)* A server error occurred (HTTP error `500`) func (m *ArtifactsRequestBuilder) ToPostRequestInformation(ctx context.Context, body []byte, contentType *string, requestConfiguration *ArtifactsRequestBuilderPostRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) if requestConfiguration != nil { diff --git a/go-sdk/pkg/registryclient-v3/search/groups_request_builder.go b/go-sdk/pkg/registryclient-v3/search/groups_request_builder.go index 7b6fcc81ce..c892bd09f3 100644 --- a/go-sdk/pkg/registryclient-v3/search/groups_request_builder.go +++ b/go-sdk/pkg/registryclient-v3/search/groups_request_builder.go @@ -11,7 +11,7 @@ type GroupsRequestBuilder struct { i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder } -// GroupsRequestBuilderGetQueryParameters returns a paginated list of all artifacts that match the provided filter criteria. +// GroupsRequestBuilderGetQueryParameters returns a paginated list of all groups that match the provided filter criteria.This operation can fail for the following reasons:* A server error occurred (HTTP error `500`) type GroupsRequestBuilderGetQueryParameters struct { // Filter by description. Description *string `uriparametername:"description"` @@ -60,7 +60,7 @@ func NewGroupsRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371c return NewGroupsRequestBuilderInternal(urlParams, requestAdapter) } -// Get returns a paginated list of all artifacts that match the provided filter criteria. +// Get returns a paginated list of all groups that match the provided filter criteria.This operation can fail for the following reasons:* A server error occurred (HTTP error `500`) func (m *GroupsRequestBuilder) Get(ctx context.Context, requestConfiguration *GroupsRequestBuilderGetRequestConfiguration) (i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.GroupSearchResultsable, error) { requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration) if err != nil { @@ -79,7 +79,7 @@ func (m *GroupsRequestBuilder) Get(ctx context.Context, requestConfiguration *Gr return res.(i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.GroupSearchResultsable), nil } -// ToGetRequestInformation returns a paginated list of all artifacts that match the provided filter criteria. +// ToGetRequestInformation returns a paginated list of all groups that match the provided filter criteria.This operation can fail for the following reasons:* A server error occurred (HTTP error `500`) func (m *GroupsRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *GroupsRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) if requestConfiguration != nil { diff --git a/go-sdk/pkg/registryclient-v3/search/search_request_builder.go b/go-sdk/pkg/registryclient-v3/search/search_request_builder.go index d6a76626c8..1fc8c59ede 100644 --- a/go-sdk/pkg/registryclient-v3/search/search_request_builder.go +++ b/go-sdk/pkg/registryclient-v3/search/search_request_builder.go @@ -33,3 +33,8 @@ func NewSearchRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371c func (m *SearchRequestBuilder) Groups() *GroupsRequestBuilder { return NewGroupsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) } + +// Versions search for versions in the registry. +func (m *SearchRequestBuilder) Versions() *VersionsRequestBuilder { + return NewVersionsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) +} diff --git a/go-sdk/pkg/registryclient-v3/search/versions_request_builder.go b/go-sdk/pkg/registryclient-v3/search/versions_request_builder.go new file mode 100644 index 0000000000..198bbcd001 --- /dev/null +++ b/go-sdk/pkg/registryclient-v3/search/versions_request_builder.go @@ -0,0 +1,180 @@ +package search + +import ( + "context" + i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71 "github.com/apicurio/apicurio-registry/go-sdk/pkg/registryclient-v3/models" + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" +) + +// VersionsRequestBuilder search for versions in the registry. +type VersionsRequestBuilder struct { + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder +} + +// VersionsRequestBuilderGetQueryParameters returns a paginated list of all versions that match the provided filter criteria.This operation can fail for the following reasons:* A server error occurred (HTTP error `500`) +type VersionsRequestBuilderGetQueryParameters struct { + // Filter by artifactId. + ArtifactId *string `uriparametername:"artifactId"` + // Filter by contentId. + ContentId *int64 `uriparametername:"contentId"` + // Filter by description. + Description *string `uriparametername:"description"` + // Filter by globalId. + GlobalId *int64 `uriparametername:"globalId"` + // Filter by artifact group. + GroupId *string `uriparametername:"groupId"` + // Filter by one or more name/value label. Separate each name/value pair using a colon. Forexample `labels=foo:bar` will return only artifacts with a label named `foo`and value `bar`. + Labels []string `uriparametername:"labels"` + // The number of versions to return. Defaults to 20. + Limit *int32 `uriparametername:"limit"` + // Filter by name. + Name *string `uriparametername:"name"` + // The number of versions to skip before starting to collect the result set. Defaults to 0. + Offset *int32 `uriparametername:"offset"` + // Sort order, ascending (`asc`) or descending (`desc`). + // Deprecated: This property is deprecated, use orderAsSortOrder instead + Order *string `uriparametername:"order"` + // Sort order, ascending (`asc`) or descending (`desc`). + OrderAsSortOrder *i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.SortOrder `uriparametername:"order"` + // The field to sort by. Can be one of:* `name`* `createdOn` + // Deprecated: This property is deprecated, use orderbyAsVersionSortBy instead + Orderby *string `uriparametername:"orderby"` + // The field to sort by. Can be one of:* `name`* `createdOn` + OrderbyAsVersionSortBy *i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.VersionSortBy `uriparametername:"orderby"` + // Filter by version number. + Version *string `uriparametername:"version"` +} + +// VersionsRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +type VersionsRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *VersionsRequestBuilderGetQueryParameters +} + +// VersionsRequestBuilderPostQueryParameters returns a paginated list of all versions that match the posted content.This operation can fail for the following reasons:* Provided content (request body) was empty (HTTP error `400`)* A server error occurred (HTTP error `500`) +type VersionsRequestBuilderPostQueryParameters struct { + // Filter by artifact Id. + ArtifactId *string `uriparametername:"artifactId"` + // Indicates the type of artifact represented by the content being used for the search. This is only needed when using the `canonical` query parameter, so that the server knows how to canonicalize the content prior to searching for matching versions. + ArtifactType *string `uriparametername:"artifactType"` + // Parameter that can be set to `true` to indicate that the server should "canonicalize" the content when searching for matching artifacts. Canonicalization is unique to each artifact type, but typically involves removing any extra whitespace and formatting the content in a consistent manner. Must be used along with the `artifactType` query parameter. + Canonical *bool `uriparametername:"canonical"` + // Filter by group Id. + GroupId *string `uriparametername:"groupId"` + // The number of versions to return. Defaults to 20. + Limit *int32 `uriparametername:"limit"` + // The number of versions to skip before starting to collect the result set. Defaults to 0. + Offset *int32 `uriparametername:"offset"` + // Sort order, ascending (`asc`) or descending (`desc`). + // Deprecated: This property is deprecated, use orderAsSortOrder instead + Order *string `uriparametername:"order"` + // Sort order, ascending (`asc`) or descending (`desc`). + OrderAsSortOrder *i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.SortOrder `uriparametername:"order"` + // The field to sort by. Can be one of:* `name`* `createdOn` + // Deprecated: This property is deprecated, use orderbyAsVersionSortBy instead + Orderby *string `uriparametername:"orderby"` + // The field to sort by. Can be one of:* `name`* `createdOn` + OrderbyAsVersionSortBy *i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.VersionSortBy `uriparametername:"orderby"` +} + +// VersionsRequestBuilderPostRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +type VersionsRequestBuilderPostRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *VersionsRequestBuilderPostQueryParameters +} + +// NewVersionsRequestBuilderInternal instantiates a new VersionsRequestBuilder and sets the default values. +func NewVersionsRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *VersionsRequestBuilder { + m := &VersionsRequestBuilder{ + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/search/versions{?version*,offset*,limit*,order*,orderby*,labels*,description*,groupId*,globalId*,contentId*,artifactId*,name*,canonical*,artifactType*}", pathParameters), + } + return m +} + +// NewVersionsRequestBuilder instantiates a new VersionsRequestBuilder and sets the default values. +func NewVersionsRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *VersionsRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewVersionsRequestBuilderInternal(urlParams, requestAdapter) +} + +// Get returns a paginated list of all versions that match the provided filter criteria.This operation can fail for the following reasons:* A server error occurred (HTTP error `500`) +func (m *VersionsRequestBuilder) Get(ctx context.Context, requestConfiguration *VersionsRequestBuilderGetRequestConfiguration) (i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.VersionSearchResultsable, error) { + requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "500": i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.CreateErrorFromDiscriminatorValue, + } + res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.CreateVersionSearchResultsFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.VersionSearchResultsable), nil +} + +// Post returns a paginated list of all versions that match the posted content.This operation can fail for the following reasons:* Provided content (request body) was empty (HTTP error `400`)* A server error occurred (HTTP error `500`) +func (m *VersionsRequestBuilder) Post(ctx context.Context, body []byte, contentType *string, requestConfiguration *VersionsRequestBuilderPostRequestConfiguration) (i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.VersionSearchResultsable, error) { + requestInfo, err := m.ToPostRequestInformation(ctx, body, contentType, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "400": i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.CreateErrorFromDiscriminatorValue, + "500": i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.CreateErrorFromDiscriminatorValue, + } + res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.CreateVersionSearchResultsFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(i00eb2e63d156923d00d8e86fe16b5d74daf30e363c9f185a8165cb42aa2f2c71.VersionSearchResultsable), nil +} + +// ToGetRequestInformation returns a paginated list of all versions that match the provided filter criteria.This operation can fail for the following reasons:* A server error occurred (HTTP error `500`) +func (m *VersionsRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *VersionsRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + requestInfo.Headers.TryAdd("Accept", "application/json") + return requestInfo, nil +} + +// ToPostRequestInformation returns a paginated list of all versions that match the posted content.This operation can fail for the following reasons:* Provided content (request body) was empty (HTTP error `400`)* A server error occurred (HTTP error `500`) +func (m *VersionsRequestBuilder) ToPostRequestInformation(ctx context.Context, body []byte, contentType *string, requestConfiguration *VersionsRequestBuilderPostRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + requestInfo.Headers.TryAdd("Accept", "application/json") + requestInfo.SetStreamContentAndContentType(body, *contentType) + return requestInfo, nil +} + +// WithUrl returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. +func (m *VersionsRequestBuilder) WithUrl(rawUrl string) *VersionsRequestBuilder { + return NewVersionsRequestBuilder(rawUrl, m.BaseRequestBuilder.RequestAdapter) +} diff --git a/integration-tests/src/test/java/io/apicurio/tests/auth/SimpleAuthIT.java b/integration-tests/src/test/java/io/apicurio/tests/auth/SimpleAuthIT.java index e0b0b4314b..30f4d68117 100644 --- a/integration-tests/src/test/java/io/apicurio/tests/auth/SimpleAuthIT.java +++ b/integration-tests/src/test/java/io/apicurio/tests/auth/SimpleAuthIT.java @@ -37,7 +37,7 @@ public class SimpleAuthIT extends ApicurioRegistryBaseIT { private static final CreateArtifact createArtifact = new CreateArtifact(); static { - createArtifact.setType(ArtifactType.JSON); + createArtifact.setArtifactType(ArtifactType.JSON); createArtifact.setFirstVersion(new CreateVersion()); createArtifact.getFirstVersion().setContent(new VersionContent()); createArtifact.getFirstVersion().getContent().setContentType(ContentTypes.APPLICATION_JSON); diff --git a/integration-tests/src/test/java/io/apicurio/tests/smokeTests/apicurio/AllArtifactTypesIT.java b/integration-tests/src/test/java/io/apicurio/tests/smokeTests/apicurio/AllArtifactTypesIT.java index 48088e428c..487b974eab 100644 --- a/integration-tests/src/test/java/io/apicurio/tests/smokeTests/apicurio/AllArtifactTypesIT.java +++ b/integration-tests/src/test/java/io/apicurio/tests/smokeTests/apicurio/AllArtifactTypesIT.java @@ -4,8 +4,10 @@ import io.apicurio.registry.rest.client.models.IfArtifactExists; import io.apicurio.registry.rest.client.models.Rule; import io.apicurio.registry.rest.client.models.RuleType; -import io.apicurio.registry.rest.client.models.VersionContent; +import io.apicurio.registry.rest.client.models.SortOrder; import io.apicurio.registry.rest.client.models.VersionMetaData; +import io.apicurio.registry.rest.client.models.VersionSearchResults; +import io.apicurio.registry.rest.client.models.VersionSortBy; import io.apicurio.registry.types.ArtifactType; import io.apicurio.registry.types.ContentTypes; import io.apicurio.registry.utils.tests.TestUtils; @@ -15,11 +17,15 @@ import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.List; import static io.apicurio.tests.utils.Constants.SMOKE; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; @Tag(SMOKE) @QuarkusIntegrationTest @@ -63,14 +69,18 @@ void doTest(String v1Resource, String v2Resource, String atype, String contentTy createArtifactVersion(groupId, artifactId, v2Content, contentType, null); // Find artifact by content - VersionContent vc = new VersionContent(); - vc.setContentType(contentType); - vc.setContent(v1Content); - VersionMetaData byContent = registryClient.groups().byGroupId(groupId).artifacts().byArtifactId(artifactId).post(vc); - assertNotNull(byContent); - assertNotNull(byContent.getGlobalId()); - assertEquals(artifactId, byContent.getArtifactId()); - assertNotNull(byContent.getVersion()); + InputStream contentIS = new ByteArrayInputStream(v1Content.getBytes(StandardCharsets.UTF_8)); + VersionSearchResults results = registryClient.search().versions().post(contentIS, contentType, config -> { + config.queryParameters.groupId = groupId; + config.queryParameters.artifactId = artifactId; + config.queryParameters.orderby = VersionSortBy.GlobalId; + config.queryParameters.order = SortOrder.Desc; + }); + assertNotNull(results); + assertTrue(results.getCount() > 0); + assertNotNull(results.getVersions().get(0).getGlobalId()); + assertEquals(artifactId, results.getVersions().get(0).getArtifactId()); + assertNotNull(results.getVersions().get(0).getVersion()); // Update artifact (invalid content) CreateVersion createVersion = TestUtils.clientCreateVersion("{\"This is not a valid content.", contentType); diff --git a/integration-tests/src/test/java/io/apicurio/tests/smokeTests/apicurio/ArtifactsIT.java b/integration-tests/src/test/java/io/apicurio/tests/smokeTests/apicurio/ArtifactsIT.java index 562d9b0308..853740ee71 100644 --- a/integration-tests/src/test/java/io/apicurio/tests/smokeTests/apicurio/ArtifactsIT.java +++ b/integration-tests/src/test/java/io/apicurio/tests/smokeTests/apicurio/ArtifactsIT.java @@ -12,7 +12,6 @@ import io.apicurio.registry.rest.client.models.Rule; import io.apicurio.registry.rest.client.models.RuleType; import io.apicurio.registry.rest.client.models.SortOrder; -import io.apicurio.registry.rest.client.models.VersionContent; import io.apicurio.registry.rest.client.models.VersionMetaData; import io.apicurio.registry.rest.client.models.VersionState; import io.apicurio.registry.rest.v2.beans.ArtifactContent; @@ -30,7 +29,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.ByteArrayInputStream; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.List; import java.util.UUID; import java.util.stream.Collectors; @@ -67,7 +68,7 @@ void createEmptyArtifact() throws Exception { // Create an empty artifact CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactId); - createArtifact.setType(ArtifactType.OPENAPI); + createArtifact.setArtifactType(ArtifactType.OPENAPI); createArtifact.setName(name); var response = registryClient.groups().byGroupId(groupId).artifacts().post(createArtifact); assertNotNull(response); @@ -358,14 +359,17 @@ void testAllowedSpecialCharacters() throws Exception { registryClient.groups().byGroupId(groupId).artifacts().byArtifactId(artifactId).get(); - VersionContent vc = new VersionContent(); - vc.setContent(content); - vc.setContentType(ContentTypes.APPLICATION_JSON); - retryOp((rc) -> rc.groups().byGroupId(groupId).artifacts().byArtifactId(artifactId).post(vc)); + InputStream contentIS = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)); + registryClient.search().versions().post(contentIS, ContentTypes.APPLICATION_JSON, config -> { + config.queryParameters.groupId = groupId; + config.queryParameters.artifactId = artifactId; + config.queryParameters.offset = 0; + config.queryParameters.limit = 10; + }); registryClient.search().artifacts().get(config -> { config.queryParameters.groupId = groupId; - config.queryParameters.name = artifactId; + config.queryParameters.artifactId = artifactId; config.queryParameters.offset = 0; config.queryParameters.limit = 10; }); @@ -399,10 +403,13 @@ void testAllowedSpecialCharactersCreateViaApi() throws Exception { registryClient.groups().byGroupId(groupId).artifacts().byArtifactId(artifactId).get(); - VersionContent vc = new VersionContent(); - vc.setContent(content); - vc.setContentType(ContentTypes.APPLICATION_JSON); - retryOp((rc) -> rc.groups().byGroupId(groupId).artifacts().byArtifactId(artifactId).post(vc)); + InputStream contentIS = new ByteArrayInputStream(content.getBytes(StandardCharsets.UTF_8)); + registryClient.search().versions().post(contentIS, ContentTypes.APPLICATION_JSON, config -> { + config.queryParameters.groupId = groupId; + config.queryParameters.artifactId = artifactId; + config.queryParameters.offset = 0; + config.queryParameters.limit = 10; + }); registryClient.search().artifacts().get(config -> { config.queryParameters.groupId = groupId; diff --git a/integration-tests/src/test/java/io/apicurio/tests/smokeTests/apicurio/MetadataIT.java b/integration-tests/src/test/java/io/apicurio/tests/smokeTests/apicurio/MetadataIT.java index 5635604096..1ccb14a5be 100644 --- a/integration-tests/src/test/java/io/apicurio/tests/smokeTests/apicurio/MetadataIT.java +++ b/integration-tests/src/test/java/io/apicurio/tests/smokeTests/apicurio/MetadataIT.java @@ -42,7 +42,7 @@ void getAndUpdateMetadataOfArtifact() throws Exception { assertThat(artifactMetaData.getCreatedOn().toInstant().toEpochMilli(), OrderingComparison.greaterThan(0L)); assertThat(artifactMetaData.getModifiedOn().toInstant().toEpochMilli(), OrderingComparison.greaterThan(0L)); assertThat(artifactMetaData.getArtifactId(), is(artifactId)); - assertThat(artifactMetaData.getType(), is("AVRO")); + assertThat(artifactMetaData.getArtifactType(), is("AVRO")); EditableArtifactMetaData emd = new EditableArtifactMetaData(); @@ -56,7 +56,7 @@ void getAndUpdateMetadataOfArtifact() throws Exception { LOGGER.info("Got metadata of artifact with ID {}: {}", artifactId, amd); assertThat(amd.getArtifactId(), is(artifactId)); - assertThat(amd.getType(), is("AVRO")); + assertThat(amd.getArtifactType(), is("AVRO")); assertThat(amd.getDescription(), is("The description of the artifact.")); assertThat(amd.getName(), is("Artifact Updated Name")); }); @@ -85,7 +85,7 @@ void getAndUpdateMetadataOfArtifactSpecificVersion() throws Exception { LOGGER.info("Got metadata of artifact with ID {}: {}", artifactId, versionMetaData); assertThat(versionMetaData.getVersion(), is("2")); - assertThat(versionMetaData.getType(), is("AVRO")); + assertThat(versionMetaData.getArtifactType(), is("AVRO")); EditableVersionMetaData emd = new EditableVersionMetaData(); emd.setName("Version 2 Name"); @@ -97,7 +97,7 @@ void getAndUpdateMetadataOfArtifactSpecificVersion() throws Exception { LOGGER.info("Got metadata of artifact with ID {} version 1: {}", artifactId, versionMetaData); assertThat(versionMetaData.getVersion(), is("1")); - assertThat(versionMetaData.getType(), is("AVRO")); + assertThat(versionMetaData.getArtifactType(), is("AVRO")); assertThat(versionMetaData.getName(), is("Version 1 Name")); assertThat(versionMetaData.getDescription(), nullValue()); } diff --git a/schema-resolver/src/main/java/io/apicurio/registry/resolver/AbstractSchemaResolver.java b/schema-resolver/src/main/java/io/apicurio/registry/resolver/AbstractSchemaResolver.java index cfe8dfe945..e3945fbe75 100644 --- a/schema-resolver/src/main/java/io/apicurio/registry/resolver/AbstractSchemaResolver.java +++ b/schema-resolver/src/main/java/io/apicurio/registry/resolver/AbstractSchemaResolver.java @@ -8,6 +8,7 @@ import io.apicurio.registry.resolver.utils.Utils; import io.apicurio.registry.rest.client.RegistryClient; import io.apicurio.registry.rest.client.models.HandleReferencesType; +import io.apicurio.registry.rest.client.models.SearchedVersion; import io.apicurio.registry.rest.client.models.VersionMetaData; import io.apicurio.registry.utils.IoUtil; import io.kiota.http.vertx.VertXRequestAdapter; @@ -352,4 +353,12 @@ protected void loadFromMetaData(VersionMetaData artifactMetadata, SchemaLookupRe resultBuilder.artifactId(artifactMetadata.getArtifactId()); resultBuilder.version(String.valueOf(artifactMetadata.getVersion())); } + + protected void loadFromSearchedVersion(SearchedVersion version, SchemaLookupResult.SchemaLookupResultBuilder resultBuilder) { + resultBuilder.globalId(version.getGlobalId()); + resultBuilder.contentId(version.getContentId()); + resultBuilder.groupId(version.getGroupId()); + resultBuilder.artifactId(version.getArtifactId()); + resultBuilder.version(String.valueOf(version.getVersion())); + } } diff --git a/schema-resolver/src/main/java/io/apicurio/registry/resolver/DefaultSchemaResolver.java b/schema-resolver/src/main/java/io/apicurio/registry/resolver/DefaultSchemaResolver.java index 11c77a91c2..fc90a30b07 100644 --- a/schema-resolver/src/main/java/io/apicurio/registry/resolver/DefaultSchemaResolver.java +++ b/schema-resolver/src/main/java/io/apicurio/registry/resolver/DefaultSchemaResolver.java @@ -7,14 +7,19 @@ import io.apicurio.registry.rest.client.models.CreateArtifactResponse; import io.apicurio.registry.rest.client.models.CreateVersion; import io.apicurio.registry.rest.client.models.IfArtifactExists; +import io.apicurio.registry.rest.client.models.SortOrder; import io.apicurio.registry.rest.client.models.VersionContent; import io.apicurio.registry.rest.client.models.VersionMetaData; +import io.apicurio.registry.rest.client.models.VersionSearchResults; +import io.apicurio.registry.rest.client.models.VersionSortBy; import io.apicurio.registry.types.ArtifactType; import io.apicurio.registry.types.ContentTypes; import io.apicurio.registry.utils.IoUtil; +import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -196,8 +201,6 @@ protected SchemaLookupResult resolveSchemaByContentId(long contentId) { byte[] schema = rawSchema.readAllBytes(); S parsed = schemaParser.parseSchema(schema, resolvedReferences); - - ps = new ParsedSchemaImpl() .setParsedSchema(parsed) .setRawSchema(schema); @@ -253,21 +256,25 @@ private SchemaLookupResult handleResolveSchemaByContent(ParsedSchema parse String rawSchemaString = IoUtil.toString(parsedSchema.getRawSchema()); return schemaCache.getByContent(rawSchemaString, contentKey -> { - VersionContent content = new VersionContent(); - content.setContent(contentKey); - VersionMetaData artifactMetadata = client - .groups() - .byGroupId(artifactReference.getGroupId() == null ? "default" : artifactReference.getGroupId()) - .artifacts() - .byArtifactId(artifactReference.getArtifactId()) - .post(content, config -> { - config.queryParameters.canonical = true; - config.headers.add("Content-Type", "application/get.extended+json"); - }); + InputStream is = new ByteArrayInputStream(contentKey.getBytes(StandardCharsets.UTF_8)); + String at = schemaParser.artifactType(); + String ct = toContentType(at); + VersionSearchResults results = client.search().versions().post(is, ct, config -> { + config.queryParameters.groupId = artifactReference.getGroupId() == null ? "default" : artifactReference.getGroupId(); + config.queryParameters.artifactId = artifactReference.getArtifactId(); + config.queryParameters.canonical = true; + config.queryParameters.artifactType = at; + config.queryParameters.orderby = VersionSortBy.GlobalId; + config.queryParameters.order = SortOrder.Desc; + }); + + if (results.getCount() == 0) { + throw new RuntimeException("Could not resolve artifact reference by content: " + artifactReference); + } SchemaLookupResult.SchemaLookupResultBuilder result = SchemaLookupResult.builder(); - loadFromMetaData(artifactMetadata, result); + loadFromSearchedVersion(results.getVersions().get(0), result); result.parsedSchema(parsedSchema); @@ -282,7 +289,7 @@ private SchemaLookupResult handleAutoCreateArtifact(ParsedSchema parsedSch return schemaCache.getByContent(rawSchemaString, contentKey -> { CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactReference.getArtifactId()); - createArtifact.setType(schemaParser.artifactType()); + createArtifact.setArtifactType(schemaParser.artifactType()); CreateVersion version = new CreateVersion(); version.setVersion(artifactReference.getVersion()); @@ -322,7 +329,7 @@ private SchemaLookupResult handleAutoCreateArtifact(ParsedSchema parsedSch return schemaCache.getByContent(rawSchemaString, contentKey -> { CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactReference.getArtifactId()); - createArtifact.setType(schemaParser.artifactType()); + createArtifact.setArtifactType(schemaParser.artifactType()); CreateVersion version = new CreateVersion(); version.setVersion(artifactReference.getVersion()); diff --git a/utils/maven-plugin/src/main/java/io/apicurio/registry/maven/AbstractDirectoryParser.java b/utils/maven-plugin/src/main/java/io/apicurio/registry/maven/AbstractDirectoryParser.java index 664d35600e..5734ec21d5 100644 --- a/utils/maven-plugin/src/main/java/io/apicurio/registry/maven/AbstractDirectoryParser.java +++ b/utils/maven-plugin/src/main/java/io/apicurio/registry/maven/AbstractDirectoryParser.java @@ -54,7 +54,7 @@ protected RegisterArtifact buildFromRoot(RegisterArtifact rootArtifact, String a nestedSchema.setArtifactId(artifactId); nestedSchema.setGroupId(rootArtifact.getGroupId()); nestedSchema.setContentType(rootArtifact.getContentType()); - nestedSchema.setType(rootArtifact.getType()); + nestedSchema.setArtifactType(rootArtifact.getArtifactType()); nestedSchema.setMinify(rootArtifact.getMinify()); nestedSchema.setContentType(rootArtifact.getContentType()); nestedSchema.setIfExists(rootArtifact.getIfExists()); @@ -77,7 +77,7 @@ private CreateArtifactResponse registerArtifact(RegisterArtifact artifact, Input String groupId = artifact.getGroupId(); String artifactId = artifact.getArtifactId(); String version = artifact.getVersion(); - String type = artifact.getType(); + String type = artifact.getArtifactType(); Boolean canonicalize = artifact.getCanonicalize(); String ct = artifact.getContentType() == null ? ContentTypes.APPLICATION_JSON : artifact.getContentType(); String data = null; @@ -95,7 +95,7 @@ private CreateArtifactResponse registerArtifact(RegisterArtifact artifact, Input CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactId); - createArtifact.setType(type); + createArtifact.setArtifactType(type); CreateVersion createVersion = new CreateVersion(); createVersion.setVersion(version); diff --git a/utils/maven-plugin/src/main/java/io/apicurio/registry/maven/RegisterArtifact.java b/utils/maven-plugin/src/main/java/io/apicurio/registry/maven/RegisterArtifact.java index ef0b24dfeb..29fb8079ad 100644 --- a/utils/maven-plugin/src/main/java/io/apicurio/registry/maven/RegisterArtifact.java +++ b/utils/maven-plugin/src/main/java/io/apicurio/registry/maven/RegisterArtifact.java @@ -10,7 +10,7 @@ public class RegisterArtifact { private String groupId; private String artifactId; private String version; - private String type; + private String artifactType; private File file; private IfArtifactExists ifExists; private Boolean canonicalize; @@ -112,17 +112,17 @@ public void setMinify(Boolean minify) { } /** - * @return the type + * @return the artifactType */ - public String getType() { - return type; + public String getArtifactType() { + return artifactType; } /** - * @param type the type to set + * @param artifactType the artifact type to set */ - public void setType(String type) { - this.type = type; + public void setArtifactType(String artifactType) { + this.artifactType = artifactType; } /** diff --git a/utils/maven-plugin/src/main/java/io/apicurio/registry/maven/RegisterRegistryMojo.java b/utils/maven-plugin/src/main/java/io/apicurio/registry/maven/RegisterRegistryMojo.java index bdc8fb0669..734c4361c9 100644 --- a/utils/maven-plugin/src/main/java/io/apicurio/registry/maven/RegisterRegistryMojo.java +++ b/utils/maven-plugin/src/main/java/io/apicurio/registry/maven/RegisterRegistryMojo.java @@ -161,7 +161,7 @@ private CreateArtifactResponse registerWithAutoRefs(RegisterArtifact artifact, R ContentHandle artifactContent = readContent(artifact.getFile()); // Find all references in the content - ArtifactTypeUtilProvider provider = this.utilProviderFactory.getArtifactTypeProvider(artifact.getType()); + ArtifactTypeUtilProvider provider = this.utilProviderFactory.getArtifactTypeProvider(artifact.getArtifactType()); ReferenceFinder referenceFinder = provider.getReferenceFinder(); Set externalReferences = referenceFinder.findExternalReferences(artifactContent); @@ -180,7 +180,7 @@ private CreateArtifactResponse registerWithAutoRefs(RegisterArtifact artifact, R String artifactId = externalRef.getResource(); File localFile = getLocalFile(iresource.getPath()); RegisterArtifact refArtifact = buildFromRoot(artifact, artifactId); - refArtifact.setType(iresource.getType()); + refArtifact.setArtifactType(iresource.getType()); refArtifact.setVersion(null); refArtifact.setFile(localFile); refArtifact.setContentType(getContentTypeByExtension(localFile.getName())); @@ -207,7 +207,7 @@ private CreateArtifactResponse registerWithAutoRefs(RegisterArtifact artifact, R } private void registerDirectory(RegisterArtifact artifact) throws IOException, ExecutionException, InterruptedException { - switch (artifact.getType()) { + switch (artifact.getArtifactType()) { case ArtifactType.AVRO: final AvroDirectoryParser avroDirectoryParser = new AvroDirectoryParser(getClient()); final ParsedDirectoryWrapper schema = avroDirectoryParser.parse(artifact.getFile()); @@ -224,7 +224,7 @@ private void registerDirectory(RegisterArtifact artifact) throws IOException, Ex registerArtifact(artifact, jsonSchemaDirectoryParser.handleSchemaReferences(artifact, jsonSchema.getSchema(), jsonSchema.getSchemaContents())); break; default: - throw new IllegalArgumentException(String.format("Artifact type not recognized for analyzing a directory structure %s", artifact.getType())); + throw new IllegalArgumentException(String.format("Artifact type not recognized for analyzing a directory structure %s", artifact.getArtifactType())); } } @@ -238,7 +238,7 @@ private CreateArtifactResponse registerArtifact(RegisterArtifact artifact, Input String groupId = artifact.getGroupId(); String artifactId = artifact.getArtifactId(); String version = artifact.getVersion(); - String type = artifact.getType(); + String type = artifact.getArtifactType(); Boolean canonicalize = artifact.getCanonicalize(); String ct = artifact.getContentType() == null ? ContentTypes.APPLICATION_JSON : artifact.getContentType(); String data = null; @@ -256,7 +256,7 @@ private CreateArtifactResponse registerArtifact(RegisterArtifact artifact, Input CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactId); - createArtifact.setType(type); + createArtifact.setArtifactType(type); CreateVersion createVersion = new CreateVersion(); createVersion.setVersion(version); @@ -372,7 +372,7 @@ protected static RegisterArtifact buildFromRoot(RegisterArtifact rootArtifact, S nestedSchema.setArtifactId(artifactId); nestedSchema.setGroupId(rootArtifact.getGroupId()); nestedSchema.setContentType(rootArtifact.getContentType()); - nestedSchema.setType(rootArtifact.getType()); + nestedSchema.setArtifactType(rootArtifact.getArtifactType()); nestedSchema.setMinify(rootArtifact.getMinify()); nestedSchema.setContentType(rootArtifact.getContentType()); nestedSchema.setIfExists(rootArtifact.getIfExists()); diff --git a/utils/tests/src/main/java/io/apicurio/registry/utils/tests/TestUtils.java b/utils/tests/src/main/java/io/apicurio/registry/utils/tests/TestUtils.java index a020606715..a83dd66ef9 100644 --- a/utils/tests/src/main/java/io/apicurio/registry/utils/tests/TestUtils.java +++ b/utils/tests/src/main/java/io/apicurio/registry/utils/tests/TestUtils.java @@ -264,7 +264,7 @@ public static String generateGroupId() { public static CreateArtifact clientCreateArtifact(String artifactId, String artifactType, String content, String contentType) { CreateArtifact createArtifact = new CreateArtifact(); createArtifact.setArtifactId(artifactId); - createArtifact.setType(artifactType); + createArtifact.setArtifactType(artifactType); createArtifact.setFirstVersion(new CreateVersion()); createArtifact.getFirstVersion().setContent(new VersionContent()); createArtifact.getFirstVersion().getContent().setContent(content); @@ -275,7 +275,7 @@ public static CreateArtifact clientCreateArtifact(String artifactId, String arti public static io.apicurio.registry.rest.v3.beans.CreateArtifact serverCreateArtifact(String artifactId, String artifactType, String content, String contentType) { return io.apicurio.registry.rest.v3.beans.CreateArtifact.builder() .artifactId(artifactId) - .type(artifactType) + .artifactType(artifactType) .firstVersion( io.apicurio.registry.rest.v3.beans.CreateVersion.builder() .content(