From 730452a797cff069f933cca4a98f0ac0fb018d4f Mon Sep 17 00:00:00 2001 From: Paul Latzelsperger Date: Wed, 27 Dec 2023 14:58:25 +0100 Subject: [PATCH] fix api --- .github/workflows/apidoc.yaml | 2 +- .../org/eclipse/edc/identityhub/api/v1/PresentationApi.java | 6 ++---- .../api/didmanagement/v1/DidManagementApiController.java | 4 ++-- .../didmanagement/v1/DidManagementApiControllerTest.java | 6 +++--- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/apidoc.yaml b/.github/workflows/apidoc.yaml index b441169df..c30231e3c 100644 --- a/.github/workflows/apidoc.yaml +++ b/.github/workflows/apidoc.yaml @@ -25,7 +25,7 @@ concurrency: jobs: Publish-To-SwaggerHub: # do NOT run on forks. The Org ("edc") is unique all across SwaggerHub - # if: github.repository == 'eclipse-edc/IdentityHub' + if: github.repository == 'eclipse-edc/IdentityHub' runs-on: ubuntu-latest env: rootDir: resources/openapi/yaml diff --git a/core/identity-hub-api/src/main/java/org/eclipse/edc/identityhub/api/v1/PresentationApi.java b/core/identity-hub-api/src/main/java/org/eclipse/edc/identityhub/api/v1/PresentationApi.java index 03cbff974..cf2738d52 100644 --- a/core/identity-hub-api/src/main/java/org/eclipse/edc/identityhub/api/v1/PresentationApi.java +++ b/core/identity-hub-api/src/main/java/org/eclipse/edc/identityhub/api/v1/PresentationApi.java @@ -17,7 +17,6 @@ import io.swagger.v3.oas.annotations.OpenAPIDefinition; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn; import io.swagger.v3.oas.annotations.enums.SecuritySchemeType; import io.swagger.v3.oas.annotations.info.Info; import io.swagger.v3.oas.annotations.media.ArraySchema; @@ -37,9 +36,8 @@ @SecurityScheme(name = "Authentication", description = "Self-Issued ID token containing an access_token", type = SecuritySchemeType.HTTP, - scheme = "Bearer", - bearerFormat = "JWT", - in = SecuritySchemeIn.HEADER) + scheme = "bearer", + bearerFormat = "JWT") public interface PresentationApi { @Tag(name = "Resolution API") diff --git a/extensions/did/did-management-api/src/main/java/org/eclipse/edc/identityhub/api/didmanagement/v1/DidManagementApiController.java b/extensions/did/did-management-api/src/main/java/org/eclipse/edc/identityhub/api/didmanagement/v1/DidManagementApiController.java index 87335bfba..9445fde29 100644 --- a/extensions/did/did-management-api/src/main/java/org/eclipse/edc/identityhub/api/didmanagement/v1/DidManagementApiController.java +++ b/extensions/did/did-management-api/src/main/java/org/eclipse/edc/identityhub/api/didmanagement/v1/DidManagementApiController.java @@ -15,7 +15,6 @@ package org.eclipse.edc.identityhub.api.didmanagement.v1; import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.DELETE; import jakarta.ws.rs.POST; import jakarta.ws.rs.PUT; import jakarta.ws.rs.Path; @@ -84,7 +83,8 @@ public void updateDid(DidDocument document, @QueryParam("republish") boolean rep } @Override - @DELETE + @POST + @Path("/delete") public void deleteDidFromBody(DidRequestPayload request) { documentService.deleteById(request.did()) .orElseThrow(exceptionMapper(DidDocument.class, request.did())); diff --git a/extensions/did/did-management-api/src/test/java/org/eclipse/edc/identityhub/api/didmanagement/v1/DidManagementApiControllerTest.java b/extensions/did/did-management-api/src/test/java/org/eclipse/edc/identityhub/api/didmanagement/v1/DidManagementApiControllerTest.java index 636e9a8a3..2dc77185f 100644 --- a/extensions/did/did-management-api/src/test/java/org/eclipse/edc/identityhub/api/didmanagement/v1/DidManagementApiControllerTest.java +++ b/extensions/did/did-management-api/src/test/java/org/eclipse/edc/identityhub/api/didmanagement/v1/DidManagementApiControllerTest.java @@ -256,7 +256,7 @@ void deleteDid_success() { when(didDocumentServiceMock.deleteById(eq(TEST_DID))).thenReturn(ServiceResult.success()); baseRequest() .body(new DidRequestPayload(TEST_DID)) - .delete("/") + .post("/delete") .then() .log().ifError() .statusCode(204); @@ -270,7 +270,7 @@ void deleteDid_whenNotExist_expect404() { when(didDocumentServiceMock.deleteById(eq(TEST_DID))).thenReturn(ServiceResult.notFound("test-message")); baseRequest() .body(new DidRequestPayload(TEST_DID)) - .delete("/") + .post("/delete") .then() .log().ifError() .statusCode(404); @@ -284,7 +284,7 @@ void deleteDid_whenAlreadyPublished_expect409() { when(didDocumentServiceMock.deleteById(eq(TEST_DID))).thenReturn(ServiceResult.conflict("test-message")); baseRequest() .body(new DidRequestPayload(TEST_DID)) - .delete("/") + .post("/delete") .then() .log().ifError() .statusCode(409);