summaryrefslogtreecommitdiffstats
path: root/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest
diff options
context:
space:
mode:
authorWojciech Sliwka <wojciech.sliwka@nokia.com>2019-07-03 08:38:28 +0200
committerTomasz Golabek <tomasz.golabek@nokia.com>2019-07-23 11:33:02 +0000
commit38b3b95830568296bde457cd33f79277765f5704 (patch)
tree0dea07cbf7469f3c1f4b93d04510312ec86226e6 /openecomp-be/api/openecomp-sdc-rest-webapp/item-rest
parenta73cbca41fbba96855173f39c89c04d50d4d8672 (diff)
Migrate swagger to openapi v3
Issue-ID: SDC-2261 Change-Id: I614c15878b9d165a4468570e8318867632c88434 Signed-off-by: Wojciech Sliwka <wojciech.sliwka@nokia.com>
Diffstat (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/item-rest')
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/Items.java53
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/Versions.java34
2 files changed, 45 insertions, 42 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/Items.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/Items.java
index 942bc59495..a916f8df55 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/Items.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/Items.java
@@ -15,9 +15,15 @@
*/
package org.openecomp.sdcrests.item.rest;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import org.openecomp.sdc.versioning.types.Item;
import org.openecomp.sdcrests.item.types.ItemActionRequestDto;
import org.springframework.validation.annotation.Validated;
@@ -26,50 +32,47 @@ import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+
import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
@Path("/v1.0/items")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
-@Api(value = "Items")
+@OpenAPIDefinition(info = @Info(title = "Items"))
@Validated
public interface Items {
@GET
@Path("/")
- @ApiOperation(value = "Get list of items according to desired filters",
- responseContainer = "List")
- Response list(@ApiParam(value = "Filter by item status", allowableValues = "ACTIVE,ARCHIVED")
+ @Operation(description = "Get list of items according to desired filters", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = Item.class)))))
+ Response list(@Parameter(description = "Filter by item status", schema = @Schema(type = "string", allowableValues = {"ACTIVE", "ARCHIVED"}))
@QueryParam("itemStatus") String itemStatusFilter,
- @ApiParam(value = "Filter by version status" , allowableValues = "Certified,Draft")
+ @Parameter(description = "Filter by version status", schema = @Schema(type = "string", allowableValues = {"Certified", "Draft"}))
@QueryParam("versionStatus") String versionStatusFilter,
- @ApiParam(value = "Filter by item type" , allowableValues = "vsp,vlm")
+ @Parameter(description = "Filter by item type", schema = @Schema(type = "string", allowableValues = {"vsp", "vlm"}))
@QueryParam("itemType") String itemTypeFilter,
- @ApiParam(value = "Filter by user permission" , allowableValues = "Owner,Contributor")
+ @Parameter(description = "Filter by user permission", schema = @Schema(type = "string", allowableValues = {"Owner", "Contributor"}))
@QueryParam("permission") String permissionFilter,
- @ApiParam(value = "Filter by onboarding method" , allowableValues = "NetworkPackage,Manual")
+ @Parameter(description = "Filter by onboarding method", schema = @Schema(type = "string", allowableValues = {"NetworkPackage", "manual"}))
@QueryParam("onboardingMethod") String onboardingMethodFilter,
@NotNull(message = USER_MISSING_ERROR_MSG)
@HeaderParam(USER_ID_HEADER_PARAM) String user);
- @GET
- @Path("/{itemId}")
- @ApiOperation(value = "Get details of a item")
- Response getItem(@PathParam("itemId") String itemId,
+ @GET
+ @Path("/{itemId}")
+ @Operation(description = "Get details of a item")
+ Response getItem(@PathParam("itemId") String itemId,
@NotNull(message = USER_MISSING_ERROR_MSG)
@HeaderParam(USER_ID_HEADER_PARAM) String user);
- @PUT
- @Path("/{itemId}/actions")
- @ApiOperation(value = "Acts on item version")
- Response actOn(ItemActionRequestDto request,
- @PathParam("itemId") String itemId,
- @NotNull(message = USER_MISSING_ERROR_MSG)
- @HeaderParam(USER_ID_HEADER_PARAM) String user);
-
-
-
+ @PUT
+ @Path("/{itemId}/actions")
+ @Operation(description = "Acts on item version")
+ Response actOn(ItemActionRequestDto request,
+ @PathParam("itemId") String itemId,
+ @NotNull(message = USER_MISSING_ERROR_MSG)
+ @HeaderParam(USER_ID_HEADER_PARAM) String user);
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/Versions.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/Versions.java
index 73c224c6ef..6f72175175 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/Versions.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-services/src/main/java/org/openecomp/sdcrests/item/rest/Versions.java
@@ -20,9 +20,14 @@
package org.openecomp.sdcrests.item.rest;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
import org.openecomp.sdcrests.item.types.*;
import org.springframework.validation.annotation.Validated;
@@ -37,22 +42,20 @@ import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG
@Path("/v1.0/items/{itemId}/versions")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
-@Api(value = "Item Versions")
+@OpenAPIDefinition(info = @Info(title = "Item Versions"))
@Validated
public interface Versions {
@GET
@Path("/")
- @ApiOperation(value = "Lists item versions",
- response = VersionDto.class,
- responseContainer = "List")
+ @Operation(description = "Lists item versions", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation = VersionDto.class)))))
Response list(@PathParam("itemId") String itemId,
@NotNull(message = USER_MISSING_ERROR_MSG)
@HeaderParam(USER_ID_HEADER_PARAM) String user);
@POST
@Path("/{versionId}")
- @ApiOperation(value = "Creates a new item version")
+ @Operation(description = "Creates a new item version")
Response create(VersionRequestDto request,
@PathParam("itemId") String itemId,
@PathParam("versionId") String versionId,
@@ -61,7 +64,7 @@ public interface Versions {
@GET
@Path("/{versionId}")
- @ApiOperation(value = "Gets item version", response = VersionDto.class)
+ @Operation(description = "Gets item version", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = VersionDto.class))))
Response get(@PathParam("itemId") String itemId,
@PathParam("versionId") String versionId,
@NotNull(message = USER_MISSING_ERROR_MSG)
@@ -69,18 +72,15 @@ public interface Versions {
@GET
@Path("/{versionId}/activity-logs")
- @ApiOperation(value = "Gets item version activity log",
- response = ActivityLogDto.class,
- responseContainer = "List")
- Response getActivityLog(@ApiParam("Item Id") @PathParam("itemId") String itemId,
- @ApiParam("Version Id") @PathParam("versionId") String versionId,
+ @Operation(description = "Gets item version activity log", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation = ActivityLogDto.class)))))
+ Response getActivityLog(@Parameter(description = "Item Id") @PathParam("itemId") String itemId,
+ @Parameter( description = "Version Id") @PathParam("versionId") String versionId,
@NotNull(message = USER_MISSING_ERROR_MSG)
@HeaderParam(USER_ID_HEADER_PARAM) String user);
@GET
@Path("/{versionId}/revisions")
- @ApiOperation(value = "Gets item version revisions", response = RevisionDto.class,
- responseContainer = "List")
+ @Operation(description = "Gets item version revisions", responses = @ApiResponse(content = @Content(array = @ArraySchema( schema = @Schema(implementation = ActivityLogDto.class)))))
Response listRevisions(@PathParam("itemId") String itemId,
@PathParam("versionId") String versionId,
@NotNull(message = USER_MISSING_ERROR_MSG)
@@ -88,7 +88,7 @@ public interface Versions {
@PUT
@Path("/{versionId}/actions")
- @ApiOperation(value = "Acts on item version")
+ @Operation(description = "Acts on item version")
Response actOn(VersionActionRequestDto request,
@PathParam("itemId") String itemId,
@PathParam("versionId") String versionId,