From 8da275536a1763075c84f6590f0bb1bbbd767b42 Mon Sep 17 00:00:00 2001 From: Robert Stupp Date: Wed, 14 Aug 2024 10:09:28 +0200 Subject: [PATCH] u rest-services --- .../services/rest/RestContentResource.java | 3 +++ .../services/rest/RestDiffResource.java | 2 ++ .../services/rest/RestNamespaceResource.java | 6 ++++++ .../services/rest/RestTreeResource.java | 12 ++++++++++++ .../services/rest/RestV2ConfigResource.java | 2 ++ .../services/rest/RestV2TreeResource.java | 16 ++++++++++++++++ 6 files changed, 41 insertions(+) diff --git a/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestContentResource.java b/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestContentResource.java index d35d2e12942..36658043195 100644 --- a/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestContentResource.java +++ b/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestContentResource.java @@ -19,6 +19,7 @@ import jakarta.enterprise.context.RequestScoped; import jakarta.inject.Inject; import jakarta.ws.rs.Path; +import org.eclipse.microprofile.openapi.annotations.Operation; import org.projectnessie.api.v1.http.HttpContentApi; import org.projectnessie.error.NessieNotFoundException; import org.projectnessie.model.Content; @@ -55,6 +56,7 @@ private ContentService resource() { @Override @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.getContent") public Content getContent(ContentKey key, String ref, String hashOnRef) throws NessieNotFoundException { return resource().getContent(key, ref, hashOnRef, false, false).getContent(); @@ -62,6 +64,7 @@ public Content getContent(ContentKey key, String ref, String hashOnRef) @Override @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.getMultipleContents") public GetMultipleContentsResponse getMultipleContents( String ref, String hashOnRef, GetMultipleContentsRequest request) throws NessieNotFoundException { diff --git a/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestDiffResource.java b/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestDiffResource.java index 7fd9fab9d9b..6250f1e1d04 100644 --- a/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestDiffResource.java +++ b/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestDiffResource.java @@ -21,6 +21,7 @@ import jakarta.enterprise.context.RequestScoped; import jakarta.inject.Inject; import jakarta.ws.rs.Path; +import org.eclipse.microprofile.openapi.annotations.Operation; import org.projectnessie.api.v1.http.HttpDiffApi; import org.projectnessie.api.v1.params.DiffParams; import org.projectnessie.error.NessieNotFoundException; @@ -58,6 +59,7 @@ private DiffService resource() { @Override @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.getDiff") public DiffResponse getDiff(DiffParams params) throws NessieNotFoundException { ImmutableDiffResponse.Builder builder = DiffResponse.builder(); return resource() diff --git a/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestNamespaceResource.java b/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestNamespaceResource.java index d96e267b8e6..bae9f21b6fc 100644 --- a/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestNamespaceResource.java +++ b/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestNamespaceResource.java @@ -20,6 +20,7 @@ import jakarta.inject.Inject; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.Path; +import org.eclipse.microprofile.openapi.annotations.Operation; import org.projectnessie.api.v1.http.HttpNamespaceApi; import org.projectnessie.api.v1.params.MultipleNamespacesParams; import org.projectnessie.api.v1.params.NamespaceParams; @@ -60,6 +61,7 @@ private NamespaceService resource() { @Override @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.createNamespace") public Namespace createNamespace(NamespaceParams params, Namespace namespace) throws NessieNamespaceAlreadyExistsException, NessieReferenceNotFoundException { return resource().createNamespace(params.getRefName(), namespace); @@ -67,6 +69,7 @@ public Namespace createNamespace(NamespaceParams params, Namespace namespace) @Override @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.deleteNamespace") public void deleteNamespace(@NotNull NamespaceParams params) throws NessieReferenceNotFoundException, NessieNamespaceNotEmptyException, @@ -76,6 +79,7 @@ public void deleteNamespace(@NotNull NamespaceParams params) @Override @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.getNamespace") public Namespace getNamespace(@NotNull NamespaceParams params) throws NessieNamespaceNotFoundException, NessieReferenceNotFoundException { return resource() @@ -84,6 +88,7 @@ public Namespace getNamespace(@NotNull NamespaceParams params) @Override @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.getNamespaces") public GetNamespacesResponse getNamespaces(@NotNull MultipleNamespacesParams params) throws NessieReferenceNotFoundException { return resource() @@ -92,6 +97,7 @@ public GetNamespacesResponse getNamespaces(@NotNull MultipleNamespacesParams par @Override @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.updateProperties") public void updateProperties(NamespaceParams params, NamespaceUpdate namespaceUpdate) throws NessieNamespaceNotFoundException, NessieReferenceNotFoundException { resource() diff --git a/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestTreeResource.java b/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestTreeResource.java index dfb4a51618c..97f74d7c030 100644 --- a/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestTreeResource.java +++ b/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestTreeResource.java @@ -23,6 +23,7 @@ import jakarta.enterprise.context.RequestScoped; import jakarta.inject.Inject; import jakarta.ws.rs.Path; +import org.eclipse.microprofile.openapi.annotations.Operation; import org.projectnessie.api.v1.http.HttpTreeApi; import org.projectnessie.api.v1.params.BaseMergeTransplant; import org.projectnessie.api.v1.params.CommitLogParams; @@ -75,6 +76,7 @@ private TreeService resource() { } @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.getAllReferences") @Override public ReferencesResponse getAllReferences(ReferencesParams params) { Integer maxRecords = params.maxRecords(); @@ -105,12 +107,14 @@ public void hasMore(String pagingToken) { } @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.getDefaultBranch") @Override public Branch getDefaultBranch() throws NessieNotFoundException { return resource().getDefaultBranch(); } @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.createReference") @Override public Reference createReference(String sourceRefName, Reference reference) throws NessieNotFoundException, NessieConflictException { @@ -120,12 +124,14 @@ public Reference createReference(String sourceRefName, Reference reference) } @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.getReferenceByName") @Override public Reference getReferenceByName(GetReferenceParams params) throws NessieNotFoundException { return resource().getReferenceByName(params.getRefName(), params.fetchOption()); } @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.getEntries") @Override public EntriesResponse getEntries(String refName, EntriesParams params) throws NessieNotFoundException { @@ -164,6 +170,7 @@ public void hasMore(String pagingToken) { } @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.getCommitLog") @Override public LogResponse getCommitLog(String ref, CommitLogParams params) throws NessieNotFoundException { @@ -198,6 +205,7 @@ public void hasMore(String pagingToken) { } @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.assignReference") @Override public void assignReference( Reference.ReferenceType referenceType, @@ -209,6 +217,7 @@ public void assignReference( } @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.deleteReference") @Override public void deleteReference( Reference.ReferenceType referenceType, String referenceName, String expectedHash) @@ -217,6 +226,7 @@ public void deleteReference( } @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.transplantCommitsIntoBranch") @Override public MergeResponse transplantCommitsIntoBranch( String branchName, String expectedHash, String message, Transplant transplant) @@ -237,6 +247,7 @@ public MergeResponse transplantCommitsIntoBranch( } @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.mergeRefIntoBranch") @Override public MergeResponse mergeRefIntoBranch(String branchName, String expectedHash, Merge merge) throws NessieNotFoundException, NessieConflictException { @@ -267,6 +278,7 @@ private void validateKeepIndividual( } @JsonView(Views.V1.class) + @Operation(operationId = "nessie.v1.commitMultipleOperations") @Override public Branch commitMultipleOperations( String branchName, String expectedHash, Operations operations) diff --git a/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestV2ConfigResource.java b/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestV2ConfigResource.java index 043cf8075b0..0d982cf2036 100644 --- a/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestV2ConfigResource.java +++ b/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestV2ConfigResource.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Set; import java.util.stream.Collectors; +import org.eclipse.microprofile.openapi.annotations.Operation; import org.projectnessie.api.v2.http.HttpConfigApi; import org.projectnessie.error.NessieConflictException; import org.projectnessie.model.ImmutableRepositoryConfigResponse; @@ -59,6 +60,7 @@ public RestV2ConfigResource( @Override @JsonView(Views.V2.class) + @Operation(operationId = "nessie.v2.getConfig") public NessieConfiguration getConfig() { return config.getConfig(); } diff --git a/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestV2TreeResource.java b/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestV2TreeResource.java index 04249787ef0..e69b0236304 100644 --- a/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestV2TreeResource.java +++ b/servers/rest-services/src/main/java/org/projectnessie/services/rest/RestV2TreeResource.java @@ -29,6 +29,7 @@ import java.util.List; import java.util.Locale; import java.util.stream.Collectors; +import org.eclipse.microprofile.openapi.annotations.Operation; import org.projectnessie.api.v2.http.HttpTreeApi; import org.projectnessie.api.v2.params.CommitLogParams; import org.projectnessie.api.v2.params.DiffParams; @@ -125,6 +126,7 @@ private ContentService content() { } @JsonView(Views.V2.class) + @Operation(operationId = "nessie.v2.getAllReferences") @Override public ReferencesResponse getAllReferences(ReferencesParams params) { Integer maxRecords = params.maxRecords(); @@ -155,6 +157,7 @@ public void hasMore(String pagingToken) { } @JsonView(Views.V2.class) + @Operation(operationId = "nessie.v2.createReference") @Override public SingleReferenceResponse createReference(String name, String type, Reference reference) throws NessieNotFoundException, NessieConflictException { @@ -174,6 +177,7 @@ public SingleReferenceResponse createReference(String name, String type, Referen } @JsonView(Views.V2.class) + @Operation(operationId = "nessie.v2.getReferenceByName") @Override public SingleReferenceResponse getReferenceByName(GetReferenceParams params) throws NessieNotFoundException { @@ -187,6 +191,7 @@ public SingleReferenceResponse getReferenceByName(GetReferenceParams params) } @JsonView(Views.V2.class) + @Operation(operationId = "nessie.v2.getReferenceHistory") @Override public ReferenceHistoryResponse getReferenceHistory(ReferenceHistoryParams params) throws NessieNotFoundException { @@ -198,6 +203,7 @@ public ReferenceHistoryResponse getReferenceHistory(ReferenceHistoryParams param } @JsonView(Views.V2.class) + @Operation(operationId = "nessie.v2.getEntries") @Override public EntriesResponse getEntries(String ref, EntriesParams params) throws NessieNotFoundException { @@ -237,6 +243,7 @@ public void hasMore(String pagingToken) { } @JsonView(Views.V2.class) + @Operation(operationId = "nessie.v2.getCommitLog") @Override public LogResponse getCommitLog(String ref, CommitLogParams params) throws NessieNotFoundException { @@ -272,6 +279,7 @@ public void hasMore(String pagingToken) { } @JsonView(Views.V2.class) + @Operation(operationId = "nessie.v2.getDiff") @Override public DiffResponse getDiff(DiffParams params) throws NessieNotFoundException { Integer maxRecords = params.maxRecords(); @@ -312,6 +320,7 @@ public void hasMore(String pagingToken) { } @JsonView(Views.V2.class) + @Operation(operationId = "nessie.v2.assignReference") @Override public SingleReferenceResponse assignReference(String type, String ref, Reference assignTo) throws NessieNotFoundException, NessieConflictException { @@ -324,6 +333,7 @@ public SingleReferenceResponse assignReference(String type, String ref, Referenc } @JsonView(Views.V2.class) + @Operation(operationId = "nessie.v2.deleteReference") @Override public SingleReferenceResponse deleteReference(String type, String ref) throws NessieConflictException, NessieNotFoundException { @@ -342,6 +352,7 @@ private static Reference.ReferenceType parseReferenceType(String type) { } @JsonView(Views.V2.class) + @Operation(operationId = "nessie.v2.getContent") @Override public ContentResponse getContent( ContentKey key, String ref, boolean withDocumentation, boolean forWrite) @@ -353,6 +364,7 @@ public ContentResponse getContent( } @JsonView(Views.V2.class) + @Operation(operationId = "nessie.v2.getSeveralContents") @Override public GetMultipleContentsResponse getSeveralContents( String ref, List keys, boolean withDocumentation, boolean forWrite) @@ -363,6 +375,7 @@ public GetMultipleContentsResponse getSeveralContents( } @JsonView(Views.V2.class) + @Operation(operationId = "nessie.v2.getMultipleContents") @Override public GetMultipleContentsResponse getMultipleContents( String ref, GetMultipleContentsRequest request, boolean withDocumentation, boolean forWrite) @@ -378,6 +391,7 @@ public GetMultipleContentsResponse getMultipleContents( } @JsonView(Views.V2.class) + @Operation(operationId = "nessie.v2.transplantCommitsIntoBranch") @Override public MergeResponse transplantCommitsIntoBranch(String branch, Transplant transplant) throws NessieNotFoundException, NessieConflictException { @@ -401,6 +415,7 @@ public MergeResponse transplantCommitsIntoBranch(String branch, Transplant trans } @JsonView(Views.V2.class) + @Operation(operationId = "nessie.v2.mergeRefIntoBranch") @Override public MergeResponse mergeRefIntoBranch(String branch, Merge merge) throws NessieNotFoundException, NessieConflictException { @@ -436,6 +451,7 @@ public MergeResponse mergeRefIntoBranch(String branch, Merge merge) } @JsonView(Views.V2.class) + @Operation(operationId = "nessie.v2.commitMultipleOperations") @Override public CommitResponse commitMultipleOperations(String branch, Operations operations) throws NessieNotFoundException, NessieConflictException {