diff --git a/oparl-server/src/main/java/de/twomartens/oparlservice/control/OParlController.java b/oparl-server/src/main/java/de/twomartens/oparlservice/control/OParlController.java
index a8a137a..839e437 100644
--- a/oparl-server/src/main/java/de/twomartens/oparlservice/control/OParlController.java
+++ b/oparl-server/src/main/java/de/twomartens/oparlservice/control/OParlController.java
@@ -1,17 +1,18 @@
package de.twomartens.oparlservice.control;
-import de.twomartens.oparlservice.entity.*;
import de.twomartens.oparlservice.entity.System;
+import de.twomartens.oparlservice.entity.*;
import de.twomartens.oparlservice.service.OParlService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
+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 lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.server.ResponseStatusException;
-import java.util.List;
-
@Slf4j
@RestController
@RequestMapping(path = "/v1.1")
@@ -23,21 +24,34 @@ public class OParlController {
}
@GetMapping("/")
- @Operation(summary = "System information", description = "returns information about the OParl system")
+ @Operation(summary = "System information", description = "returns information about the OParl system", responses = {
+ @ApiResponse(description = "Successful Operation", responseCode = "200", content = @Content(
+ mediaType = "application/json", schema = @Schema(implementation = System.class)
+ ))
+ })
public System system() {
log.info("method invoked /v1.1");
return service.getSystem();
}
@GetMapping("/bodies")
- @Operation(summary = "List of available bodies", description = "returns a list of available bodies in this OParl system")
+ @Operation(summary = "List of available bodies",
+ description = "returns a list of available bodies in this OParl system", responses = {
+ @ApiResponse(description = "Successful Operation", responseCode = "200",
+ content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.class)))
+ })
public ObjectList
bodies() {
log.info("method invoked /v1.1/bodies");
return this.service.getBodies();
}
@GetMapping("/body/{id}")
- @Operation(summary = "information about body", description = "returns information about the requested body")
+ @Operation(summary = "information about body", description = "returns information about the requested body", responses = {
+ @ApiResponse(description = "Successful Operation", responseCode = "200",
+ content = @Content(mediaType = "application/json", schema = @Schema(implementation = Body.class))),
+ @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = ErrorObject.class)))
+ })
public Body body(
@PathVariable
@Parameter(description = "body ID", example = "0")
@@ -49,7 +63,12 @@ public class OParlController {
}
@GetMapping("/term/{id}")
- @Operation(summary = "information about legislative term", description = "returns information about the requested legislative term")
+ @Operation(summary = "information about legislative term", description = "returns information about the requested legislative term", responses = {
+ @ApiResponse(description = "Successful Operation", responseCode = "200",
+ content = @Content(mediaType = "application/json", schema = @Schema(implementation = LegislativeTerm.class))),
+ @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = ErrorObject.class)))
+ })
public LegislativeTerm legislativeTerm(
@PathVariable
@Parameter(description = "legislative term ID", example = "21")
@@ -61,7 +80,12 @@ public class OParlController {
}
@GetMapping("/body/{id}/organizations")
- @Operation(summary = "List of all organizations in body", description = "returns a list of all organizations in requested body")
+ @Operation(summary = "List of all organizations in body", description = "returns a list of all organizations in requested body", responses = {
+ @ApiResponse(description = "Successful Operation", responseCode = "200",
+ content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.class))),
+ @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = ErrorObject.class)))
+ })
public ObjectList organizationsInBody(
@PathVariable
@Parameter(description = "body ID", example = "0")
@@ -73,7 +97,12 @@ public class OParlController {
}
@GetMapping("/organization/{id}")
- @Operation(summary = "information about organization", description = "returns the requested organization")
+ @Operation(summary = "information about organization", description = "returns the requested organization", responses = {
+ @ApiResponse(description = "Successful Operation", responseCode = "200",
+ content = @Content(mediaType = "application/json", schema = @Schema(implementation = Organization.class))),
+ @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = ErrorObject.class)))
+ })
public Organization organization(
@PathVariable
@Parameter(description = "organization ID", example = "0")
@@ -85,7 +114,12 @@ public class OParlController {
}
@GetMapping("/body/{id}/persons")
- @Operation(summary = "List of all persons in body", description = "returns a list of all persons in requested body")
+ @Operation(summary = "List of all persons in body", description = "returns a list of all persons in requested body", responses = {
+ @ApiResponse(description = "Successful Operation", responseCode = "200",
+ content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.class))),
+ @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = ErrorObject.class)))
+ })
public ObjectList persons(
@PathVariable
@Parameter(description = "body ID", example = "0")
@@ -97,7 +131,12 @@ public class OParlController {
}
@GetMapping("/person/{id}")
- @Operation(summary = "information about person", description = "returns the requested person")
+ @Operation(summary = "information about person", description = "returns the requested person", responses = {
+ @ApiResponse(description = "Successful Operation", responseCode = "200",
+ content = @Content(mediaType = "application/json", schema = @Schema(implementation = Person.class))),
+ @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = ErrorObject.class)))
+ })
public Person person(
@PathVariable
@Parameter(description = "person ID", example = "0")
@@ -109,7 +148,12 @@ public class OParlController {
}
@GetMapping("/body/{id}/memberships")
- @Operation(summary = "List of all memberships in body", description = "returns a list of all memberships in requested body")
+ @Operation(summary = "List of all memberships in body", description = "returns a list of all memberships in requested body", responses = {
+ @ApiResponse(description = "Successful Operation", responseCode = "200",
+ content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.class))),
+ @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = ErrorObject.class)))
+ })
public ObjectList membershipsInBody(
@PathVariable
@Parameter(description = "body ID", example = "0")
@@ -121,7 +165,13 @@ public class OParlController {
}
@GetMapping("/organization/{id}/memberships")
- @Operation(summary = "List of all memberships in organization", description = "returns a list of all memberships in requested organization")
+ @Operation(summary = "List of all memberships in organization",
+ description = "returns a list of all memberships in requested organization", responses = {
+ @ApiResponse(description = "Successful Operation", responseCode = "200",
+ content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.class))),
+ @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = ErrorObject.class)))
+ })
public ObjectList membershipsInOrganization(
@PathVariable
@Parameter(description = "organization ID", example = "0")
@@ -133,7 +183,12 @@ public class OParlController {
}
@GetMapping("/membership/{id}")
- @Operation(summary = "information about membership", description = "returns the requested membership")
+ @Operation(summary = "information about membership", description = "returns the requested membership", responses = {
+ @ApiResponse(description = "Successful Operation", responseCode = "200",
+ content = @Content(mediaType = "application/json", schema = @Schema(implementation = Membership.class))),
+ @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = ErrorObject.class)))
+ })
public Membership membership(
@PathVariable
@Parameter(description = "membership ID", example = "0")
@@ -145,7 +200,13 @@ public class OParlController {
}
@GetMapping("/body/{id}/meetings")
- @Operation(summary = "List of all meetings in body", description = "returns a list of all meetings in requested body")
+ @Operation(summary = "List of all meetings in body",
+ description = "returns a list of all meetings in requested body", responses = {
+ @ApiResponse(description = "Successful Operation", responseCode = "200",
+ content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.class))),
+ @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = ErrorObject.class)))
+ })
public ObjectList meetingsInBody(
@PathVariable
@Parameter(description = "body ID", example = "0")
@@ -157,7 +218,13 @@ public class OParlController {
}
@GetMapping("/organization/{id}/meetings")
- @Operation(summary = "List of all meetings in organization", description = "returns a list of all meetings in requested organization")
+ @Operation(summary = "List of all meetings in organization",
+ description = "returns a list of all meetings in requested organization", responses = {
+ @ApiResponse(description = "Successful Operation", responseCode = "200",
+ content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.class))),
+ @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = ErrorObject.class)))
+ })
public ObjectList meetingsInOrganization(
@PathVariable
@Parameter(description = "organization ID", example = "0")
@@ -169,7 +236,12 @@ public class OParlController {
}
@GetMapping("/meeting/{id}")
- @Operation(summary = "information about meeting", description = "returns the requested meeting")
+ @Operation(summary = "information about meeting", description = "returns the requested meeting", responses = {
+ @ApiResponse(description = "Successful Operation", responseCode = "200",
+ content = @Content(mediaType = "application/json", schema = @Schema(implementation = Meeting.class))),
+ @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = ErrorObject.class)))
+ })
public Meeting meeting(
@PathVariable
@Parameter(description = "meeting ID", example = "0")
@@ -181,7 +253,12 @@ public class OParlController {
}
@GetMapping("/agendaItem/{id}")
- @Operation(summary = "information about agenda item", description = "returns the requested agenda item")
+ @Operation(summary = "information about agenda item", description = "returns the requested agenda item", responses = {
+ @ApiResponse(description = "Successful Operation", responseCode = "200",
+ content = @Content(mediaType = "application/json", schema = @Schema(implementation = Body.class))),
+ @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
+ schema = @Schema(implementation = ErrorObject.class)))
+ })
public AgendaItem agendaItem(
@PathVariable
@Parameter(description = "agendaItem ID", example = "0")