Commit ccbaa52d authored by naji's avatar naji
Browse files

Docs: add tags, summary and descriptions

parent 09cfae29
......@@ -54,6 +54,9 @@ import fr.gouv.vitamui.pastis.util.pua.NoticeFromPUA;
import fr.gouv.vitamui.pastis.util.pua.PuaFromJSON;
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.servers.Server;
import io.swagger.v3.oas.annotations.servers.ServerVariable;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.json.JSONObject;
......@@ -86,7 +89,14 @@ import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
@OpenAPIDefinition(tags = @Tag(name="pastis"))
@OpenAPIDefinition(tags = { @Tag(name = "pastis"),@Tag(name="test") },
info = @Info(title = "Pastis Rest Api", description = ""),
servers = { @Server(url = "dev.vitamui.com" ,
variables = { @ServerVariable(name = "scheme", allowableValues = {"https", "http"}, defaultValue = "https"),
@ServerVariable(name = "port", description = "Api port",defaultValue = "8051")})
, @Server(url = "localhost" ,
variables = { @ServerVariable(name = "scheme", allowableValues ={"https", "http"}, defaultValue = "http"),
@ServerVariable(name = "port", description = "Api port", defaultValue = "8051")}) })
@RestController
class ProfileController {
......@@ -119,12 +129,17 @@ class ProfileController {
private List<PastisProfile> pastisProfiles = new ArrayList<>();
@Operation(summary = "method for test Api is running",
description = "method for test Api is running",
tags = {"test"})
@RequestMapping(value = "/test", method = RequestMethod.GET)
String test() {
return "Pastis API is listening...";
}
@Operation(summary = "Retrieve RNG representation of the JSON structure")
@Operation(summary = "Retrieve RNG representation of the JSON structure",
description = "Retrieve RNG representation of the JSON structure of archive profile",
tags = {"pastis"})
@RequestMapping(value = "/getarchiveprofile", method = RequestMethod.POST, consumes = APPLICATION_JSON_UTF8, produces = MediaType.APPLICATION_XML_VALUE)
String getArchiveProfile(@RequestBody final ElementProperties json) throws IOException {
......@@ -165,6 +180,9 @@ class ProfileController {
return response;
}
@Operation(summary = "Retrieve JSON representation of archive unit profile",
description = "Retrieve JSON representation of archive unit profile",
tags = {"pastis"})
@RequestMapping(value = "/getarchiveunitprofile", method = RequestMethod.POST, consumes = APPLICATION_JSON_UTF8, produces = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<String> getArchiveUnitProfile(@RequestBody final ProfileNotice json) throws IOException {
......@@ -185,6 +203,9 @@ class ProfileController {
}
@Operation(summary = "Retrieve JSON representation of the RNG structure",
description = "Retrieve JSON representation of the RNG structure",
tags = {"pastis"})
@RequestMapping (value = "/createprofile", method = RequestMethod.GET)
ResponseEntity<String> createprofile() throws URISyntaxException {
PastisSAX2Handler handler = new PastisSAX2Handler();
......@@ -208,6 +229,9 @@ class ProfileController {
return ResponseEntity.ok(getJson.getJsonParsedTree(handler.elementRNGRoot));
}
@Operation(summary = "Load Profile",
description = "Load profile by Id",
tags = {"pastis"})
@RequestMapping (value = "/edit", method = RequestMethod.POST)
ResponseEntity<String> loadProfile(@RequestParam(name = "id") String id) throws JsonProcessingException {
PastisSAX2Handler handler = new PastisSAX2Handler();
......@@ -256,7 +280,9 @@ class ProfileController {
return ResponseEntity.ok(response.toString());
}
@Operation(summary = "Upload profile PA or PUA",
description = "Upload profile PA or PUA",
tags = {"pastis"})
@RequestMapping (value = "/new", method = RequestMethod.POST,
consumes = "multipart/form-data", produces = "application/json")
ResponseEntity<String> loadProfileFromFile(@RequestParam MultipartFile file) {
......@@ -306,7 +332,9 @@ class ProfileController {
return ResponseEntity.ok(response.toString());
}
@Operation(summary = "Generate Json Struct from RNG file",
description = "Generate Json Struct from RNG file",
tags = {"pastis"})
@RequestMapping (value = "/createprofilefromfile",
method = RequestMethod.POST,consumes = "multipart/form-data",
produces = "application/json")
......@@ -332,6 +360,9 @@ class ProfileController {
return ResponseEntity.ok(getJson.getJsonParsedTree(handler.elementRNGRoot));
}
@Operation(summary = "Retrieve all profiles PA and PUA",
description = "Retrieve all profiles PA and PUA",
tags = {"pastis"})
@RequestMapping (value = "/getprofiles", method = RequestMethod.GET)
ResponseEntity<List<PastisProfile>> getFiles() throws IOException {
Resource[] resources = ResourcePatternUtils
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment