adapted ui to openapi ui

This commit is contained in:
Sandro La Bruzzo 2022-08-31 11:11:14 +02:00
parent ebedff0955
commit 44e7aaa694
4 changed files with 17 additions and 7 deletions

View File

@ -76,7 +76,7 @@ public class MainApplication extends AbstractDnetApp {
@Bean @Bean
public GroupedOpenApi publicApiV2() { public GroupedOpenApi publicApiV2() {
return GroupedOpenApi.builder() return GroupedOpenApi.builder()
.group(ScholixAPIConstants.API_V1_NAME) .group(ScholixAPIConstants.API_V2_NAME)
.pathsToMatch("/v2/**") .pathsToMatch("/v2/**")
.build(); .build();
} }
@ -86,4 +86,9 @@ public class MainApplication extends AbstractDnetApp {
return "ScholeExplorer APIs"; return "ScholeExplorer APIs";
} }
@Override
protected String swaggerDesc() {
return ScholixAPIConstants.API_DESCRIPTION;
}
} }

View File

@ -5,6 +5,7 @@ import java.util.stream.Collectors;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import io.swagger.v3.oas.annotations.media.Schema;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -21,7 +22,6 @@ import io.micrometer.core.annotation.Timed;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
@RestController @RestController
@ -36,7 +36,7 @@ public class ScholixControllerV1 extends AbstractDnetController {
@GetMapping("/linksFromPublisher") @GetMapping("/linksFromPublisher")
@Timed(value = "scholix.v1.linksFromPublisher", description = "Time taken to return links on Version 1.0 of Scholix collected from a publisher") @Timed(value = "scholix.v1.linksFromPublisher", description = "Time taken to return links on Version 1.0 of Scholix collected from a publisher")
public List<ScholixV1> linksFromPublisher( public List<ScholixV1> linksFromPublisher(
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships collected from a publisher", schema = @Schema(), required = true) final String publisher, @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships collected from a publisher", required = true) final String publisher,
@Parameter(in = ParameterIn.QUERY, description = "The page number") @RequestParam(required = false) final Integer page) throws ScholixException { @Parameter(in = ParameterIn.QUERY, description = "The page number") @RequestParam(required = false) final Integer page) throws ScholixException {
final int currentPage = page != null ? page : 0; final int currentPage = page != null ? page : 0;
@ -51,7 +51,7 @@ public class ScholixControllerV1 extends AbstractDnetController {
@GetMapping("/linksFromDatasource") @GetMapping("/linksFromDatasource")
@Timed(value = "scholix.v1.linksFromDatasource", description = "Time taken to return links on Version 1.0 of Scholix collected from a LinkProvider") @Timed(value = "scholix.v1.linksFromDatasource", description = "Time taken to return links on Version 1.0 of Scholix collected from a LinkProvider")
public List<ScholixV1> linksFromDatasource( public List<ScholixV1> linksFromDatasource(
@Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships collected from a LinkProvider", schema = @Schema()) @NotNull final String datasource, @Parameter(in = ParameterIn.QUERY, description = "Filter Scholix relationships collected from a LinkProvider") @NotNull final String datasource,
@Parameter(in = ParameterIn.QUERY, description = "The page number") @RequestParam(required = false) final Integer page) throws ScholixException { @Parameter(in = ParameterIn.QUERY, description = "The page number") @RequestParam(required = false) final Integer page) throws ScholixException {
final int currentPage = page != null ? page : 0; final int currentPage = page != null ? page : 0;
@ -61,6 +61,8 @@ public class ScholixControllerV1 extends AbstractDnetController {
return scholixData.stream().map(ScholixV1::fromScholix).collect(Collectors.toList()); return scholixData.stream().map(ScholixV1::fromScholix).collect(Collectors.toList());
} }
@Operation(summary = "Retrieve all scholix links from a persistent identifier", description = "The linksFromPid endpoint returns a list of scholix object related from a specific persistent identifier") @Operation(summary = "Retrieve all scholix links from a persistent identifier", description = "The linksFromPid endpoint returns a list of scholix object related from a specific persistent identifier")
@GetMapping("/linksFromPid") @GetMapping("/linksFromPid")
@Timed(value = "scholix.v1.linksFromPid", description = "Time taken to return links on Version 1.0 of Scholix related from a specific persistent identifier") @Timed(value = "scholix.v1.linksFromPid", description = "Time taken to return links on Version 1.0 of Scholix related from a specific persistent identifier")

View File

@ -22,8 +22,11 @@ management.metrics.distribution.percentiles.http.server.requests=0.5, 0.9, 0.95,
scholix.elastic.clusterNodes = 10.19.65.51:9200,10.19.65.52:9200,10.19.65.53:9200,10.19.65.54:9200 #scholix.elastic.clusterNodes = 10.19.65.51:9200,10.19.65.52:9200,10.19.65.53:9200,10.19.65.54:9200
#scholix.elastic.clusterNodes = localhost:9200 scholix.elastic.clusterNodes = localhost:9200
scholix.elastic.indexName = dli_scholix scholix.elastic.indexName = dli_scholix
scholix.elastic.socketTimeout = 60000 scholix.elastic.socketTimeout = 60000
scholix.elastic.connectionTimeout= 60000 scholix.elastic.connectionTimeout= 60000

View File

@ -446,7 +446,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.plugin.version>3.6.0</maven.compiler.plugin.version> <maven.compiler.plugin.version>3.6.0</maven.compiler.plugin.version>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<dhp-schemas-version>2.11.33</dhp-schemas-version> <dhp-schemas-version>2.12.2-SNAPSHOT</dhp-schemas-version>
<apache.solr.version>7.1.0</apache.solr.version> <apache.solr.version>7.1.0</apache.solr.version>
<mongodb.driver.version>3.4.2</mongodb.driver.version> <mongodb.driver.version>3.4.2</mongodb.driver.version>
<prometheus.version>0.10.0</prometheus.version> <prometheus.version>0.10.0</prometheus.version>