Skip to content

Commit

Permalink
Fix issue with @ResponseStatus and @ApiResponse being out of sync. (g…
Browse files Browse the repository at this point in the history
…eonetwork#7588)

* Fix issue with @ResponseStatus and @ApiResponse being out of sync.
Update @ApiResponse so that they are in sync with @ResponseStatus

* Change Delete on record/tags so that it returns OK 200.
  • Loading branch information
ianwallen authored Jan 9, 2024
1 parent b300811 commit 6dacf28
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public void deleteRecord(
MediaType.APPLICATION_JSON_VALUE
}
)
@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "Report about deleted records."),
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Report about deleted records."),
@ApiResponse(responseCode = "403", description = ApiParams.API_RESPONSE_NOT_ALLOWED_ONLY_EDITOR)})
@PreAuthorize("hasAuthority('Editor')")
@ResponseStatus(HttpStatus.OK)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ ResponseEntity<Element> processRecordPreview(
RequestMethod.POST,}, produces = MediaType.APPLICATION_XML_VALUE)
@PreAuthorize("hasAuthority('Editor')")
@ResponseStatus(HttpStatus.OK)
@ApiResponses(value = {@ApiResponse(responseCode = "204", description = "Record processed and saved."),
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Record processed and saved."),
@ApiResponse(responseCode = "403", description = ApiParams.API_RESPONSE_NOT_ALLOWED_CAN_EDIT)})
public @ResponseBody
ResponseEntity processRecord(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,9 @@ public MetadataProcessingReport tagRecords(
produces = {
MediaType.APPLICATION_JSON_VALUE
})
@ResponseStatus(value = HttpStatus.NO_CONTENT)
@ResponseStatus(value = HttpStatus.OK)
@ApiResponses(value = {
@ApiResponse(responseCode = "201", description = "Report about removed records."),
@ApiResponse(responseCode = "200", description = "Report about removed records."),
@ApiResponse(responseCode = "403", description = ApiParams.API_RESPONSE_NOT_ALLOWED_ONLY_EDITOR)
})
@PreAuthorize("hasAuthority('Editor')")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public MetadataResource putResourceFromURL(
// @PreAuthorize("permitAll")
@RequestMapping(value = "/{resourceId:.+}", method = RequestMethod.GET)
@ResponseStatus(value = HttpStatus.OK)
@ApiResponses(value = {@ApiResponse(responseCode = "201", description = "Record attachment."),
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Record attachment."),
@ApiResponse(responseCode = "403", description = "Operation not allowed. "
+ "User needs to be able to download the resource.")})
public void getResource(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public ResponseEntity updateSource(
@PreAuthorize("hasAuthority('Administrator')")
@ResponseStatus(HttpStatus.NO_CONTENT)
@ApiResponses(value = {
@ApiResponse(responseCode = "201", description = "Source deleted."),
@ApiResponse(responseCode = "204", description = "Source deleted."),
@ApiResponse(responseCode = "403", description = ApiParams.API_RESPONSE_NOT_ALLOWED_ONLY_ADMIN)
})
@ResponseBody
Expand Down

0 comments on commit 6dacf28

Please sign in to comment.