Added non-generic sub classes for swagger documentation purposes

This commit is contained in:
Jim Martens 2020-07-11 22:44:19 +02:00
parent b08c8cc9c3
commit e40b67e293
2 changed files with 25 additions and 13 deletions

View File

@ -44,7 +44,7 @@ public class OParlController {
@Operation(summary = "List of all agenda items in body", @Operation(summary = "List of all agenda items in body",
description = "returns a list of all agenda items in requested body", responses = { description = "returns a list of all agenda items in requested body", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200", @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", @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class))) schema = @Schema(implementation = ErrorObject.class)))
}) })
@ -62,7 +62,7 @@ public class OParlController {
@Operation(summary = "List of available bodies", @Operation(summary = "List of available bodies",
description = "returns a list of available bodies in this OParl system", responses = { description = "returns a list of available bodies in this OParl system", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200", @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() { public ObjectList<Body> bodies() {
log.info("method invoked /v1.1/bodies"); log.info("method invoked /v1.1/bodies");
@ -107,7 +107,7 @@ public class OParlController {
@Operation(summary = "List of all consultations in body", @Operation(summary = "List of all consultations in body",
description = "returns a list of all consultations in requested body", responses = { description = "returns a list of all consultations in requested body", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200", @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", @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class))) schema = @Schema(implementation = ErrorObject.class)))
}) })
@ -142,7 +142,7 @@ public class OParlController {
@Operation(summary = "List of all files in body", @Operation(summary = "List of all files in body",
description = "returns a list of all files in requested body", responses = { description = "returns a list of all files in requested body", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200", @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", @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class))) schema = @Schema(implementation = ErrorObject.class)))
}) })
@ -176,7 +176,7 @@ public class OParlController {
@GetMapping("/body/{id}/legislativeTerms") @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 = { @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", @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", @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class))) schema = @Schema(implementation = ErrorObject.class)))
}) })
@ -211,7 +211,7 @@ public class OParlController {
@Operation(summary = "List of all locations in body", @Operation(summary = "List of all locations in body",
description = "returns a list of all locations in requested body", responses = { description = "returns a list of all locations in requested body", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200", @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", @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class))) schema = @Schema(implementation = ErrorObject.class)))
}) })
@ -246,7 +246,7 @@ public class OParlController {
@Operation(summary = "List of all meetings in body", @Operation(summary = "List of all meetings in body",
description = "returns a list of all meetings in requested body", responses = { description = "returns a list of all meetings in requested body", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200", @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", @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class))) schema = @Schema(implementation = ErrorObject.class)))
}) })
@ -264,7 +264,7 @@ public class OParlController {
@Operation(summary = "List of all meetings in organization", @Operation(summary = "List of all meetings in organization",
description = "returns a list of all meetings in requested organization", responses = { description = "returns a list of all meetings in requested organization", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200", @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", @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class))) schema = @Schema(implementation = ErrorObject.class)))
}) })
@ -298,7 +298,7 @@ public class OParlController {
@GetMapping("/body/{id}/memberships") @GetMapping("/body/{id}/memberships")
@Operation(summary = "List of all memberships in body", description = "returns a list of all memberships in requested body", responses = { @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", @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", @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class))) schema = @Schema(implementation = ErrorObject.class)))
}) })
@ -316,7 +316,7 @@ public class OParlController {
@Operation(summary = "List of all memberships in organization", @Operation(summary = "List of all memberships in organization",
description = "returns a list of all memberships in requested organization", responses = { description = "returns a list of all memberships in requested organization", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200", @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", @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class))) schema = @Schema(implementation = ErrorObject.class)))
}) })
@ -359,7 +359,7 @@ public class OParlController {
@GetMapping("/body/{id}/organizations") @GetMapping("/body/{id}/organizations")
@Operation(summary = "List of all organizations in body", description = "returns a list of all organizations in requested body", responses = { @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", @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", @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class))) schema = @Schema(implementation = ErrorObject.class)))
}) })
@ -394,7 +394,7 @@ public class OParlController {
@Operation(summary = "List of all papers in body", @Operation(summary = "List of all papers in body",
description = "returns a list of all papers in requested body", responses = { description = "returns a list of all papers in requested body", responses = {
@ApiResponse(description = "Successful Operation", responseCode = "200", @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", @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class))) schema = @Schema(implementation = ErrorObject.class)))
}) })
@ -428,7 +428,7 @@ public class OParlController {
@GetMapping("/body/{id}/persons") @GetMapping("/body/{id}/persons")
@Operation(summary = "List of all persons in body", description = "returns a list of all persons in requested body", responses = { @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", @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", @ApiResponse(responseCode = "404", description = "Not found", content = @Content(mediaType = "application/json",
schema = @Schema(implementation = ErrorObject.class))) schema = @Schema(implementation = ErrorObject.class)))
}) })

View File

@ -25,4 +25,16 @@ public class ObjectList<T> {
@NonNull @NonNull
@Schema(description = "contains links related to this list", required = true) @Schema(description = "contains links related to this list", required = true)
private final Links links; 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> {}
} }