Browse Source

Added non-generic sub classes for swagger documentation purposes

master
Jim Martens 10 months ago
parent
commit
e40b67e293
  1. 26
      oparl-server/src/main/java/de/twomartens/oparlservice/control/OParlController.java
  2. 12
      oparl-server/src/main/java/de/twomartens/oparlservice/entity/ObjectList.java

26
oparl-server/src/main/java/de/twomartens/oparlservice/control/OParlController.java

@ -44,7 +44,7 @@ public class OParlController {
@Operation(summary = "List of all agenda items in body",
description = "returns a list of all agenda items in requested body", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.class))),
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.ObjectListAgendaItem.class))),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class)))
})
@ -62,7 +62,7 @@ public class OParlController {
@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)))
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.ObjectListBody.class)))
})
public ObjectList<Body> bodies() {
log.info("method invoked /v1.1/bodies");
@ -107,7 +107,7 @@ public class OParlController {
@Operation(summary = "List of all consultations in body",
description = "returns a list of all consultations in requested body", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.class))),
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.ObjectListConsultation.class))),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class)))
})
@ -142,7 +142,7 @@ public class OParlController {
@Operation(summary = "List of all files in body",
description = "returns a list of all files in requested body", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.class))),
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.ObjectListFile.class))),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class)))
})
@ -176,7 +176,7 @@ public class OParlController {
@GetMapping("/body/{id}/legislativeTerms")
@Operation(summary = "List of all legislative terms of a body", description = "returns a list of all legislative terms of requested body", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.class))),
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.ObjectListLegislativeTerm.class))),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class)))
})
@ -211,7 +211,7 @@ public class OParlController {
@Operation(summary = "List of all locations in body",
description = "returns a list of all locations in requested body", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.class))),
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.ObjectListLocation.class))),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class)))
})
@ -246,7 +246,7 @@ public class OParlController {
@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))),
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.ObjectListMeeting.class))),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class)))
})
@ -264,7 +264,7 @@ public class OParlController {
@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))),
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.ObjectListMeeting.class))),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class)))
})
@ -298,7 +298,7 @@ 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", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.class))),
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.ObjectListMembership.class))),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class)))
})
@ -316,7 +316,7 @@ public class OParlController {
@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))),
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.ObjectListMembership.class))),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class)))
})
@ -359,7 +359,7 @@ 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", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.class))),
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.ObjectListOrganization.class))),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class)))
})
@ -394,7 +394,7 @@ public class OParlController {
@Operation(summary = "List of all papers in body",
description = "returns a list of all papers in requested body", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.class))),
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.ObjectListPaper.class))),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class)))
})
@ -428,7 +428,7 @@ 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", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200",
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.class))),
content = @Content(mediaType = "application/json", schema = @Schema(implementation = ObjectList.ObjectListPerson.class))),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class)))
})

12
oparl-server/src/main/java/de/twomartens/oparlservice/entity/ObjectList.java

@ -25,4 +25,16 @@ public class ObjectList<T> {
@NonNull
@Schema(description = "contains links related to this list", required = true)
private final Links links;
public static class ObjectListAgendaItem extends ObjectList<AgendaItem> {}
public static class ObjectListBody extends ObjectList<Body> {}
public static class ObjectListConsultation extends ObjectList<Consultation> {}
public static class ObjectListFile extends ObjectList<File> {}
public static class ObjectListLegislativeTerm extends ObjectList<LegislativeTerm> {}
public static class ObjectListLocation extends ObjectList<Location> {}
public static class ObjectListMeeting extends ObjectList<Meeting> {}
public static class ObjectListMembership extends ObjectList<Membership> {}
public static class ObjectListOrganization extends ObjectList<Organization> {}
public static class ObjectListPaper extends ObjectList<Paper> {}
public static class ObjectListPerson extends ObjectList<Person> {}
}
Loading…
Cancel
Save