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 --- .../application-config-rest-services/pom.xml | 2 +- .../rest/ApplicationConfiguration.java | 24 ++++++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest') diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/pom.xml index 3e8d8e9160..816bcb841a 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/pom.xml +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/pom.xml @@ -15,7 +15,7 @@ - io.swagger + io.swagger.core.v3 swagger-annotations ${swagger.version} diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/ApplicationConfiguration.java b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/ApplicationConfiguration.java index 4da561eac4..c7f16bf18e 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/ApplicationConfiguration.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/ApplicationConfiguration.java @@ -20,43 +20,49 @@ package org.openecomp.sdcrests.applicationconfig.rest; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.Operation; +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.apache.cxf.jaxrs.ext.multipart.Multipart; +import org.openecomp.sdcrests.applicationconfiguration.types.ApplicationConfigDto; import org.openecomp.sdcrests.applicationconfiguration.types.ConfigurationDataDto; +import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper; import org.springframework.validation.annotation.Validated; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.io.InputStream; +import java.util.List; @Path("/v1.0/application-configuration") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) -@Api(value = "Application Configuration") +@OpenAPIDefinition(info = @Info(title = "Application Configuration")) @Validated public interface ApplicationConfiguration { @POST @Path("/") @Consumes(MediaType.MULTIPART_FORM_DATA) - @ApiOperation(value = "Insert JSON schema into application config table") + @Operation(description = "Insert JSON schema into application config table") Response insertToTable(@QueryParam("namespace") String namespace, @QueryParam("key") String key, - @Multipart("value") InputStream fileContainingSchema); + @Multipart("description") InputStream fileContainingSchema); @GET @Path("/{namespace}/{key}") - @ApiOperation(value = "Get JSON schema by namespace and key", - response = ConfigurationDataDto.class) + @Operation(description = "Get JSON schema by namespace and key", responses = @ApiResponse(content = @Content(schema = @Schema(implementation = ConfigurationDataDto.class)))) Response getFromTable(@PathParam("namespace") String namespace, @PathParam("key") String key); @GET @Path("/{namespace}") - @ApiOperation(value = "Get List of keys and values by namespace", - responseContainer = "List") + @Operation(description = "Get List of keys and descriptions by namespace", responses = @ApiResponse(content = @Content(array = @ArraySchema(schema = @Schema(implementation = ApplicationConfigDto.class))))) Response getListOfConfigurationByNamespaceFromTable(@PathParam("namespace") String namespace); } -- cgit 1.2.3-korg