Skip to content

Commit

Permalink
fix spring doc annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
GordeaS authored and GordeaS committed Mar 19, 2024
1 parent 5cc9270 commit 8b1c839
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import eu.europeana.api.commons.web.http.HttpHeaders;
import io.swagger.v3.oas.annotations.Hidden;

/**
* Created by luthien on 2019-08-13.
*/
@RestController
@Hidden
public class UserSetErrorController extends AbstractErrorController {

public UserSetErrorController(ErrorAttributes errorAttributes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import eu.europeana.set.web.model.SetOperationResponse;
import eu.europeana.set.web.service.controller.BaseRest;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

@RestController
Expand All @@ -39,7 +40,7 @@ public ApiWriteLockService getApiWriteLockService() {

@PostMapping(value = "/set/admin/lock", produces = { HttpHeaders.CONTENT_TYPE_JSON_UTF8,
HttpHeaders.CONTENT_TYPE_JSONLD_UTF8 })
@Tag(description = "Lock write operations. Authorization required.", name = "Lock Write Operations")
@Operation(description = "Lock write operations. Authorization required.", summary = "Lock Write Operations")
public ResponseEntity<String> lockWriteOperations(
HttpServletRequest request) throws HttpException, ApiWriteLockException {

Expand Down Expand Up @@ -74,7 +75,7 @@ private boolean isLocked(ApiWriteLock activeLock) {

@DeleteMapping(value = "/set/admin/lock", produces = {
HttpHeaders.CONTENT_TYPE_JSON_UTF8, HttpHeaders.CONTENT_TYPE_JSONLD_UTF8 })
@Tag(name = "Unlock write operations")
@Operation(summary = "Unlock write operations")
public ResponseEntity<String> unlockWriteOperations(
HttpServletRequest request) throws HttpException, ApiWriteLockException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import eu.europeana.set.web.search.UserSetLdSerializer;
import eu.europeana.set.web.service.controller.BaseRest;
import eu.europeana.set.web.utils.UserSetXMLSerializer;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

@RestController
Expand All @@ -55,7 +56,7 @@ public class AuxiliaryMethodsRest extends BaseRest {
* @throws HttpException
*/
@GetMapping(value = { "/set/elevation" }, produces = {MediaType.APPLICATION_XML_VALUE})
@Tag(description = "Generate Elevation file for best bets", name = "Generate elevation file")
@Operation(description = "Generate Elevation file for best bets", summary = "Generate elevation file")
public ResponseEntity<String> generateElevationFile(
@RequestParam(value = CommonApiConstants.PARAM_WSKEY, required = true) String wsKey,
HttpServletRequest request) throws HttpException {
Expand All @@ -72,7 +73,7 @@ public ResponseEntity<String> generateElevationFile(
* @throws UserSetServiceException
*/
@GetMapping(value = "/set/stats", produces = {HttpHeaders.CONTENT_TYPE_JSON_UTF8})
@Tag(description = SwaggerConstants.SET_USAGE_STATS, name = "Generate usage statistics")
@Operation(description = SwaggerConstants.SET_USAGE_STATS, summary = "Generate usage statistics")
public ResponseEntity<String> generateUsageStats(
@RequestParam(value = CommonApiConstants.PARAM_WSKEY, required = true) String wsKey,
HttpServletRequest request) throws IOException, ApplicationAuthenticationException, UserSetServiceException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import eu.europeana.set.web.search.UserSetLdSerializer;
import eu.europeana.set.web.search.UserSetQueryBuilder;
import eu.europeana.set.web.service.controller.BaseRest;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

@RestController
Expand All @@ -52,7 +53,7 @@ public synchronized UserSetQueryBuilder getQueryBuilder() {

@GetMapping(value = {"/set/search", "/set/search.json", "/set/search.jsonld"},
produces = {HttpHeaders.CONTENT_TYPE_JSONLD_UTF8, HttpHeaders.CONTENT_TYPE_JSON_UTF8})
@Tag(description = SwaggerConstants.SEARCH, name = "Search user sets")
@Operation(description = SwaggerConstants.SEARCH, summary = "Search user sets")
public ResponseEntity<String> searchUserSet(
@RequestParam(value = CommonApiConstants.PARAM_WSKEY, required = false) String wskey,
@RequestParam(value = CommonApiConstants.QUERY_PARAM_QUERY, required = true) String query,
Expand Down Expand Up @@ -122,7 +123,7 @@ private ResponseEntity<String> buildSearchResponse(String jsonLd) {
value = {"/set/{identifier}/search", "/set/{identifier}/search.json",
"/set/{identifier}/search.jsonld"},
produces = {HttpHeaders.CONTENT_TYPE_JSONLD_UTF8, HttpHeaders.CONTENT_TYPE_JSON_UTF8})
@Tag(description = SwaggerConstants.SEARCH_ITEMS_IN_SET, name = "Search items in set")
@Operation(description = SwaggerConstants.SEARCH_ITEMS_IN_SET, summary = "Search items in set")
public ResponseEntity<String> searchItemsInSet(
@PathVariable(value = WebUserSetFields.PATH_PARAM_SET_ID) String identifier,
@RequestParam(value = CommonApiConstants.PARAM_WSKEY, required = false) String wskey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import eu.europeana.set.web.http.UserSetHttpHeaders;
import eu.europeana.set.web.model.vocabulary.SetOperations;
import eu.europeana.set.web.service.controller.BaseRest;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;

/**
Expand All @@ -71,7 +72,7 @@ public WebUserSetRest() {

@PostMapping(value = "/set/",
produces = {HttpHeaders.CONTENT_TYPE_JSONLD_UTF8, HttpHeaders.CONTENT_TYPE_JSON_UTF8})
@Tag(name="Create user set", description = SwaggerConstants.SAMPLES_JSONLD)
@Operation(summary="Create user set", description = SwaggerConstants.SAMPLES_JSONLD)
public ResponseEntity<String> createUserSet(@RequestBody String userSet,
@RequestParam(value = CommonApiConstants.QUERY_PARAM_PROFILE, required = false,
defaultValue = CommonApiConstants.PROFILE_MINIMAL) String profile,
Expand Down Expand Up @@ -156,7 +157,7 @@ protected ResponseEntity<String> storeUserSet(String userSetJsonLdStr,

@GetMapping(value = {"/set/{identifier}", "/set/{identifier}.jsonld"},
produces = {HttpHeaders.CONTENT_TYPE_JSONLD_UTF8, HttpHeaders.CONTENT_TYPE_JSON_UTF8})
@Tag(description = SwaggerConstants.SEARCH_HELP_NOTE, name = "Retrieve a user set")
@Operation(description = SwaggerConstants.SEARCH_HELP_NOTE, summary = "Retrieve a user set")
public ResponseEntity<String> getUserSet(
@RequestParam(value = CommonApiConstants.PARAM_WSKEY, required = false) String wskey,
@PathVariable(value = WebUserSetFields.PATH_PARAM_SET_ID) String identifier,
Expand Down Expand Up @@ -258,8 +259,8 @@ private boolean mustFetchItems(UserSet userSet, LdProfiles profile) {

@PutMapping(value = {"/set/{identifier}"},
produces = {HttpHeaders.CONTENT_TYPE_JSONLD_UTF8, HttpHeaders.CONTENT_TYPE_JSON_UTF8})
@Tag(description = SwaggerConstants.UPDATE_SAMPLES_JSONLD,
name = "Update an existing user set")
@Operation(description = SwaggerConstants.UPDATE_SAMPLES_JSONLD,
summary = "Update an existing user set")
public ResponseEntity<String> updateUserSet(
@PathVariable(value = WebUserSetFields.PATH_PARAM_SET_ID) String identifier,
@RequestBody String userSet,
Expand Down Expand Up @@ -362,7 +363,7 @@ && getUserSetService().hasEditorRole(authentication)) {

@PutMapping(value = {"/set/{identifier}/publish"},
produces = {HttpHeaders.CONTENT_TYPE_JSONLD_UTF8, HttpHeaders.CONTENT_TYPE_JSON_UTF8})
@Tag(description = SwaggerConstants.PUBLISH_SET_NOTE, name = "Publish an existing user set")
@Operation(description = SwaggerConstants.PUBLISH_SET_NOTE, summary = "Publish an existing user set")
public ResponseEntity<String> publishUserSet(
@PathVariable(value = WebUserSetFields.PATH_PARAM_SET_ID) String identifier,
@RequestParam(value = CommonApiConstants.QUERY_PARAM_PROFILE, required = false,
Expand All @@ -387,7 +388,7 @@ public ResponseEntity<String> publishUserSet(

@PutMapping(value = {"/set/{identifier}/unpublish"},
produces = {HttpHeaders.CONTENT_TYPE_JSONLD_UTF8, HttpHeaders.CONTENT_TYPE_JSON_UTF8})
@Tag(description = SwaggerConstants.PUBLISH_SET_NOTE, name = "Unpublish an existing user set")
@Operation(description = SwaggerConstants.PUBLISH_SET_NOTE, summary = "Unpublish an existing user set")
public ResponseEntity<String> unpublishUserSet(
@PathVariable(value = WebUserSetFields.PATH_PARAM_SET_ID) String identifier,
@RequestParam(value = CommonApiConstants.QUERY_PARAM_PROFILE, required = false,
Expand Down Expand Up @@ -430,8 +431,8 @@ protected ResponseEntity<String> publishUnpublishUserSet(String identifier,

@PutMapping(value = {"/set/{identifier}/{datasetId}/{localId}"},
produces = {HttpHeaders.CONTENT_TYPE_JSONLD_UTF8, HttpHeaders.CONTENT_TYPE_JSON_UTF8})
@Tag(description = SwaggerConstants.INSERT_ITEM_NOTE,
name = "Insert item to an existing user set")
@Operation(description = SwaggerConstants.INSERT_ITEM_NOTE,
summary = "Insert item to an existing user set")
public ResponseEntity<String> insertItemIntoUserSet(
@PathVariable(value = WebUserSetFields.PATH_PARAM_SET_ID) String identifier,
@PathVariable(value = WebUserSetFields.PATH_PARAM_DATASET_ID)
Expand Down Expand Up @@ -526,8 +527,8 @@ protected ResponseEntity<String> insertItemIntoUserSet(HttpServletRequest reques

@RequestMapping(value = {"/set/{identifier}/{datasetId}/{localId}"}, method = {RequestMethod.GET},
produces = {HttpHeaders.CONTENT_TYPE_JSONLD_UTF8, HttpHeaders.CONTENT_TYPE_JSON_UTF8})
@Tag(description = SwaggerConstants.CHECK_ITEM_NOTE,
name = "Check if item is member of the Set")
@Operation(description = SwaggerConstants.CHECK_ITEM_NOTE,
summary = "Check if item is member of the Set")
public ResponseEntity<String> isItemInUserSet(
@RequestParam(value = CommonApiConstants.PARAM_WSKEY, required = false) String wskey,
@PathVariable(value = WebUserSetFields.PATH_PARAM_SET_ID) String identifier,
Expand Down Expand Up @@ -612,7 +613,7 @@ protected ResponseEntity<String> isItemInUserSet(String wsKey, String identifier

@DeleteMapping(value = {"/set/{identifier}/{datasetId}/{localId}"},
produces = {HttpHeaders.CONTENT_TYPE_JSONLD_UTF8, HttpHeaders.CONTENT_TYPE_JSON_UTF8})
@Tag(description = SwaggerConstants.DELETE_ITEM_NOTE, name = "Delete a item from the set")
@Operation(description = SwaggerConstants.DELETE_ITEM_NOTE, summary = "Delete a item from the set")
public ResponseEntity<String> deleteItemFromUserSet(
@PathVariable(value = WebUserSetFields.PATH_PARAM_SET_ID) String identifier,
@PathVariable(value = WebUserSetFields.PATH_PARAM_DATASET_ID)
Expand Down Expand Up @@ -713,7 +714,7 @@ protected ResponseEntity<String> deleteItemFromUserSet(HttpServletRequest reques
}

@DeleteMapping(value = {"/set/{identifier}"})
@Tag(name= "Delete Set", description = "Delete an existing user set")
@Operation(summary= "Delete Set", description = "Delete an existing user set")
public ResponseEntity<String> deleteUserSet(
@PathVariable(value = WebUserSetFields.PATH_PARAM_SET_ID) String identifier,
HttpServletRequest request) throws HttpException {
Expand Down Expand Up @@ -791,7 +792,7 @@ protected ResponseEntity<String> deleteUserSet(HttpServletRequest request, Strin
* @throws HttpException
*/
@DeleteMapping(value = {"/set/"})
@Tag(name="Delete Sets", description = "Delete sets associated with user")
@Operation(summary="Delete Sets", description = "Delete sets associated with user")
public ResponseEntity<String> deleteUserAssociatedSet(
@RequestParam(value = WebUserSetFields.PATH_PARAM_CREATOR_ID,
required = false) String creator,
Expand Down

0 comments on commit 8b1c839

Please sign in to comment.