Skip to content

Commit

Permalink
[PAGOPA-1595] refactoring openapi definition
Browse files Browse the repository at this point in the history
  • Loading branch information
cap-ang committed May 2, 2024
1 parent e319844 commit f76f4eb
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 13 deletions.
7 changes: 5 additions & 2 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
"url": "https://{host}{basePath}",
"variables": {
"basePath": {
"default": "/upload/gpd/debt-positions-service/v1"
"default": "/upload/gpd/debt-positions-service/v1",
"enum": [
"/upload/gpd/debt-positions-service/v1"
]
},
"host": {
"default": "api.dev.platform.pagopa.it",
Expand Down Expand Up @@ -826,4 +829,4 @@
}
}
}
}
}
39 changes: 35 additions & 4 deletions src/main/java/it/gov/pagopa/gpd/upload/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,43 @@
import io.micronaut.runtime.Micronaut;
import io.swagger.v3.oas.annotations.*;
import io.swagger.v3.oas.annotations.info.*;
import io.swagger.v3.oas.annotations.servers.Server;
import io.swagger.v3.oas.annotations.servers.ServerVariable;


@OpenAPIDefinition(
info = @Info(
title = "pagopa-gpd-upload",
version = "0.0.1"
)
info = @Info(
title = "pagopa-gpd-upload",
version = "${openapi.application.version}",
description = "Microservice to manage PagoPA GPD Upload",
termsOfService = "https://www.pagopa.gov.it/"
),
servers = {
@Server(
url = "http://localhost:8080"
),
@Server(
url = "https://{host}{basePath}",
variables = {
@ServerVariable(
name = "basePath",
defaultValue = "/upload/gpd/debt-positions-service/v1",
allowableValues = {
"/upload/gpd/debt-positions-service/v1"
}
),
@ServerVariable(
name = "host",
defaultValue = "api.dev.platform.pagopa.it",
allowableValues = {
"api.dev.platform.pagopa.it",
"api.uat.platform.pagopa.it",
"api.platform.pagopa.it"
}
)
}
)
}
)
public class Application {

Expand Down
13 changes: 6 additions & 7 deletions src/main/java/it/gov/pagopa/gpd/upload/config/RequestFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@
import org.reactivestreams.Publisher;

@Slf4j
@Filter("/**")
@Filter("/brokers")
public class RequestFilter implements HttpServerFilter {
@Override
public Publisher<MutableHttpResponse<?>> doFilter(HttpRequest<?> request, ServerFilterChain chain) {
if(!request.getPath().equals("/info")) {
log.info("Request: " + request.getMethodName() + request.getPath() + ", content-length: " + request.getContentLength());
request.getHeaders().forEach(h -> log.debug(
"header: " + h.getKey() + " = " + h.getValue())
);
}
log.info("Request: " + request.getMethodName() + request.getPath() + ", content-length: " + request.getContentLength());
request.getHeaders().forEach(h -> log.debug(
"header: " + h.getKey() + " = " + h.getValue())
);

return chain.proceed(request);
}
}
1 change: 1 addition & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
info.application.artifactId=${project.artifactId}
info.application.version=${project.version}
openapi.application.version=0.1.22
info.properties.environment=env
micronaut.application.name=GPD-Massive-Upload-service
micronaut.router.static-resources.swagger.paths=classpath:META-INF/swagger
Expand Down

0 comments on commit f76f4eb

Please sign in to comment.