Skip to content
Snippets Groups Projects
Commit 380a49a0 authored by Lars Johansson's avatar Lars Johansson
Browse files

Added REST API documentation with Springdoc and Swagger UI

parent 96848443
No related branches found
No related tags found
No related merge requests found
Showing with 787 additions and 268 deletions
......@@ -66,6 +66,12 @@
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
......
This diff is collapsed.
......@@ -27,11 +27,20 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.Operation;
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 io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
/**
* This part of REST API provides healthcheck for Naming application.
*
* @author Lars Johansson
*/
@Tag(name = "Healthcheck",
description = "perform healthcheck for Naming application")
@RestController
@RequestMapping("/healthcheck")
@EnableAutoConfiguration
......@@ -51,6 +60,14 @@ public class HealthcheckController {
*
* @return server timestamp
*/
@Operation(
summary = "Perform healthcheck for Naming application in general and healtcheck endpoint in particular",
description = "Perform healthcheck for Naming application in general and healtcheck endpoint in particular. "
+ "To be used mainly for checking HTTP response code, in particular HTTP STATUS OK - 200."
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Method completed OK. Return healthcheck as server timestamp.", content = @Content(mediaType = "text/plain", schema = @Schema(implementation = String.class)))
})
@GetMapping
public String readHealthcheck() {
// return healthcheck as server timestamp
......
......@@ -59,6 +59,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.Hidden;
/**
* This part of REST API provides verification of data migration for Naming application.
*
......@@ -74,6 +76,7 @@ import org.springframework.web.bind.annotation.RestController;
*
* @author Lars Johansson
*/
@Hidden
@RestController
@RequestMapping("/verification")
@EnableAutoConfiguration
......@@ -128,7 +131,7 @@ public class VerificationController {
*
* @return report of data migration
*/
@GetMapping ("/migration_devicerevision")
@GetMapping("/migration_devicerevision")
public String readMigrationDeviceRevision() {
// verification of
// name vs. devicerevision, device
......@@ -310,7 +313,7 @@ public class VerificationController {
*
* @return report of data migration
*/
@GetMapping ("/migration_namepartrevision")
@GetMapping("/migration_namepartrevision")
public String readMigrationNamePartRevision() {
// verification of
// systemgroup
......@@ -785,7 +788,7 @@ public class VerificationController {
*
* @return report of reachability of data
*/
@GetMapping ("/data_reachable")
@GetMapping("/data_reachable")
public String readDataReachable() {
StringBuilder reportHtml = new StringBuilder();
......@@ -921,7 +924,7 @@ public class VerificationController {
*
* @return
*/
@GetMapping ("/restapi_oldvsnew")
@GetMapping("/restapi_oldvsnew")
public String readRestApiOldVsNew() {
StringBuilder reportHtml = new StringBuilder();
......
......@@ -26,6 +26,8 @@ import java.util.logging.Logger;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import io.swagger.v3.oas.annotations.Hidden;
import org.apache.commons.lang3.StringUtils;
import org.openepics.names.repository.IDeviceGroupRepository;
import org.openepics.names.repository.IDeviceTypeRepository;
......@@ -54,6 +56,7 @@ import com.google.common.collect.Lists;
*
* @author Lars Johansson
*/
@Hidden
@RestController
@RequestMapping("/rest/deviceNames")
@EnableAutoConfiguration
......
......@@ -27,11 +27,14 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.v3.oas.annotations.Hidden;
/**
* This part of REST API provides healthcheck of Naming application.
*
* @author Lars Johansson
*/
@Hidden
@RestController
@RequestMapping("/rest/healthcheck")
@EnableAutoConfiguration
......
......@@ -49,11 +49,14 @@ import org.springframework.web.bind.annotation.RestController;
import com.google.common.collect.Lists;
import io.swagger.v3.oas.annotations.Hidden;
/**
* This part of REST API provides history for names and name part data for Naming application.
*
* @author Lars Johansson
*/
@Hidden
@RestController
@RequestMapping("/rest/history")
@EnableAutoConfiguration
......
......@@ -51,11 +51,14 @@ import org.springframework.web.bind.annotation.RestController;
import com.google.common.collect.Lists;
import io.swagger.v3.oas.annotations.Hidden;
/**
* This part of REST API provides name part data for Naming application.
*
* @author Lars Johansson
*/
@Hidden
@RestController
@RequestMapping("/rest/parts")
@EnableAutoConfiguration
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment