From 38b3b95830568296bde457cd33f79277765f5704 Mon Sep 17 00:00:00 2001 From: Wojciech Sliwka Date: Wed, 3 Jul 2019 08:38:28 +0200 Subject: Migrate swagger to openapi v3 Issue-ID: SDC-2261 Change-Id: I614c15878b9d165a4468570e8318867632c88434 Signed-off-by: Wojciech Sliwka --- .../sdcrests/vsp/rest/VnfPackageRepository.java | 33 +++++++++++++--------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vnf-repository-rest-services/src/main/java') diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vnf-repository-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VnfPackageRepository.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vnf-repository-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VnfPackageRepository.java index 8723bf2237..8c0e004732 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vnf-repository-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VnfPackageRepository.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vnf-repository-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/VnfPackageRepository.java @@ -19,9 +19,6 @@ package org.openecomp.sdcrests.vsp.rest; import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM; import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; import java.io.File; import javax.validation.constraints.NotNull; import javax.ws.rs.Consumes; @@ -33,43 +30,51 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; + +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.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; import org.openecomp.sdcrests.vendorsoftwareproducts.types.UploadFileResponseDto; import org.springframework.validation.annotation.Validated; @Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/vnfrepository") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) -@Api(value = "VNF Repository packages") +@OpenAPIDefinition(info = @Info(title = "VNF Repository packages")) @Validated public interface VnfPackageRepository extends VspEntities { @GET @Path("/vnfpackages") @Produces(MediaType.APPLICATION_OCTET_STREAM) - @ApiOperation(value = "Get VNF packages from VNF Repository", - notes = "Call VNF Repository to get VNF package details", response = File.class) + @Operation(description = "Get VNF packages from VNF Repository", + summary = "Call VNF Repository to get VNF package details", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = File.class)))) Response getVnfPackages(@PathParam("vspId") String vspId, - @ApiParam(value = "Version Id") @PathParam("versionId") String versionId, + @Parameter(description= "Version Id") @PathParam("versionId") String versionId, @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception; @GET @Path("/vnfpackage/{csarId}/download") @Produces(MediaType.APPLICATION_OCTET_STREAM) - @ApiOperation(value = "Download VNF package from VNF Repository", - notes = "Download VNF package from VNF repository and send to client", response = File.class) + @Operation(description = "Download VNF package from VNF Repository", + summary = "Download VNF package from VNF repository and send to client", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = File.class)))) Response downloadVnfPackage(@PathParam("vspId") String vspId, - @ApiParam(value = "Version Id") @PathParam("versionId") String versionId, + @Parameter(description = "Version Id") @PathParam("versionId") String versionId, @PathParam("csarId") String csarId, @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception; @POST @Path("/vnfpackage/{csarId}/import") @Produces(MediaType.APPLICATION_JSON) - @ApiOperation(value = "Import VNF package from VNF Repository", - notes = "Call VNF Repository to download VNF package, validate it and send the response", - response = UploadFileResponseDto.class) + @Operation(description = "Import VNF package from VNF Repository", + summary = "Call VNF Repository to download VNF package, validate it and send the response", + responses = @ApiResponse(content = @Content(schema = @Schema(implementation = UploadFileResponseDto.class)))) Response importVnfPackage(@PathParam("vspId") String vspId, - @ApiParam(value = "Version Id") @PathParam("versionId") String versionId, + @Parameter(description = "Version Id") @PathParam("versionId") String versionId, @PathParam("csarId") String csarId, @NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user) throws Exception; -- cgit 1.2.3-korg