Skip to content

Commit

Permalink
Merge pull request #25
Browse files Browse the repository at this point in the history
Add @ApiResponses & method rename
  • Loading branch information
hayco committed Mar 16, 2021
2 parents 3734930 + 7b14370 commit e57d41f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public FileMetadataResource(FileMetadataService fileMetadataService) {
@Produces(APPLICATION_JSON)
@ApiOperation(value = POST_ERROR_MSG)
@ApiResponses(value = {@ApiResponse(code = 405, message = POST_ERROR_MSG)})
public Response postFileMetadata() {
public Response postFileMetadataIsNotAllowed() {
throw new MethodNotAllowedException(POST_ERROR_MSG);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import nl.knaw.huc.api.FormType;
import nl.knaw.huc.api.ResultType;
import nl.knaw.huc.core.Type;
Expand Down Expand Up @@ -41,6 +43,7 @@ public TypesResource(TypeService typeService) {
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Create type")
@ApiResponses(value = {@ApiResponse(code = 200, response = ResultType.class, message = "OK")})
public Response createType(
@Valid @NotNull FormType form
) {
Expand All @@ -54,6 +57,8 @@ public Response createType(
@GET
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve types")
@ApiResponses(value = {@ApiResponse(code = 200, response = ResultType.class, responseContainer = "List",
message = "OK")})
public Response getTypes() {
log.debug("Retrieve all types");
var all = typeService
Expand All @@ -68,7 +73,8 @@ public Response getTypes() {
@GET
@Path("/{id}")
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve types")
@ApiOperation(value = "Retrieve type")
@ApiResponses(value = {@ApiResponse(code = 200, response = ResultType.class, message = "OK")})
public Response getType(
@NotNull @PathParam("id") Short id
) {
Expand All @@ -83,6 +89,7 @@ public Response getType(
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Create or update type")
@ApiResponses(value = {@ApiResponse(code = 200, response = ResultType.class, message = "OK")})
public Response putType(
@NotNull @PathParam("id") Short id,
@NotNull @Valid FormType form
Expand All @@ -98,6 +105,7 @@ public Response putType(
@DELETE
@Path("/{id}")
@ApiOperation(value = "Delete type")
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK")})
public Response deleteType(
@NotNull @PathParam("id") Short id
) {
Expand Down

0 comments on commit e57d41f

Please sign in to comment.