diff --git a/openapi/openapi-support-internal.json b/openapi/openapi-support-internal.json index 89914ed..23179ae 100644 --- a/openapi/openapi-support-internal.json +++ b/openapi/openapi-support-internal.json @@ -1,7 +1,7 @@ { "openapi" : "3.0.1", "info" : { - "title" : "pagopa-gpd-upload", + "title" : "GPD-Upload-Support-API", "description" : "Microservice to manage PagoPA GPD Upload", "termsOfService" : "https://www.pagopa.gov.it/", "version" : "0.1.22" @@ -659,7 +659,7 @@ "/support/uploads/{upload}/status/refresh" : { "get" : { "tags" : [ "Support API" ], - "summary" : "Support API to recover status on CREATE operation", + "summary" : "Support API to recover status on CREATE and DELETE operation", "description" : "Returns the debt positions upload report recovered.", "operationId" : "recoverStatus", "parameters" : [ { diff --git a/openapi/openapi.json b/openapi/openapi.json index ca11d1d..d760470 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -1,7 +1,7 @@ { "openapi" : "3.0.1", "info" : { - "title" : "pagopa-gpd-upload", + "title" : "GPD-Upload-API", "description" : "Microservice to manage PagoPA GPD Upload", "termsOfService" : "https://www.pagopa.gov.it/", "version" : "0.1.22" diff --git a/src/main/java/it/gov/pagopa/gpd/upload/Application.java b/src/main/java/it/gov/pagopa/gpd/upload/Application.java index b0c248a..846191f 100644 --- a/src/main/java/it/gov/pagopa/gpd/upload/Application.java +++ b/src/main/java/it/gov/pagopa/gpd/upload/Application.java @@ -9,7 +9,7 @@ @OpenAPIDefinition( info = @Info( - title = "pagopa-gpd-upload", + title = "${info.application.title}", version = "${openapi.application.version}", description = "Microservice to manage PagoPA GPD Upload", termsOfService = "https://www.pagopa.gov.it/" diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 72dc00c..f46f78b 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,5 +1,6 @@ info.application.artifactId=${project.artifactId} info.application.version=${project.version} +info.application.title=GPD-Upload-API openapi.application.version=0.1.22 info.properties.environment=env micronaut.application.name=GPD-Massive-Upload-service @@ -16,9 +17,11 @@ micronaut.server.max-request-size.multipart.max-file-size=104857600 micronaut.openapi.groups.external.primary=true micronaut.openapi.groups.external.filename=pagopa-gpd-upload-${openapi.application.version} micronaut.openapi.groups.external.display-name=GPD-Upload-API +micronaut.openapi.groups.external.title=GPD-Upload-API micronaut.openapi.groups.external.packages=it.gov.pagopa.gpd.upload.controller.external.* micronaut.openapi.groups.internal.primary=false micronaut.openapi.groups.internal.display-name=GPD-Upload-Support-API +micronaut.openapi.groups.internal.title=GPD-Upload-Support-API micronaut.openapi.groups.internal.filename=pagopa-gpd-upload-support micronaut.openapi.groups.internal.packages=it.gov.pagopa.gpd.upload.controller.* diff --git a/src/test/java/it/gov/pagopa/gpd/upload/OpenApiGenerationTest.java b/src/test/java/it/gov/pagopa/gpd/upload/OpenApiGenerationTest.java index b716cd9..8650854 100644 --- a/src/test/java/it/gov/pagopa/gpd/upload/OpenApiGenerationTest.java +++ b/src/test/java/it/gov/pagopa/gpd/upload/OpenApiGenerationTest.java @@ -33,26 +33,30 @@ class OpenApiGenerationTest { @Client("/") HttpClient client; + @Value("${info.application.title}") + String title; + @Test void swaggerSpringPlugin() throws Exception { - boolean result = saveOpenAPI("/swagger/pagopa-gpd-upload-" + version + ".json", "openapi.json"); + boolean result = saveOpenAPI("/swagger/pagopa-gpd-upload-" + version + ".json", "openapi.json", "GPD-Upload-API"); assertTrue(result); - boolean resultSupportAPI = saveOpenAPI("/swagger/pagopa-gpd-upload-support.json", "openapi-support-internal.json"); + boolean resultSupportAPI = saveOpenAPI("/swagger/pagopa-gpd-upload-support.json", "openapi-support-internal.json", "GPD-Upload-Support-API"); assertTrue(resultSupportAPI); } - private boolean saveOpenAPI(String fromUri, String toFile) throws IOException { - HttpResponse response = client.toBlocking().exchange(fromUri, String.class); - ObjectMapper objectMapper = new ObjectMapper(); - String responseBody = response.getBody().get(); - Object openAPI = objectMapper.readValue(responseBody, Object.class); - String formatted = new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(openAPI); - Path basePath = Paths.get("openapi/"); - Files.createDirectories(basePath); - Files.write(basePath.resolve(toFile), formatted.getBytes()); - return true; - } + private boolean saveOpenAPI(String fromUri, String toFile, String newTitle) throws IOException { + HttpResponse response = client.toBlocking().exchange(fromUri, String.class); + ObjectMapper objectMapper = new ObjectMapper(); + String responseBody = response.getBody().get(); + responseBody = responseBody.replace(title, newTitle); + Object openAPI = objectMapper.readValue(responseBody, Object.class); + String formatted = new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(openAPI); + Path basePath = Paths.get("openapi/"); + Files.createDirectories(basePath); + Files.write(basePath.resolve(toFile), formatted.getBytes()); + return true; + } @Bean @Primary diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 73e9eb7..90b16b3 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -1,4 +1,5 @@ info.application.artifactId=gpd-massive-upload +info.application.title=GPD-Upload-API info.application.version=0.1.22 info.properties.environment=test openapi.application.version=0.1.22