Use the DefaultValue
annotation parameter (accepts strings) where you set the default value alongside the QueryParam
annotation
@GET
@Path("/bookmarks")
@Produces(MediaType.APPLICATION_JSON)
@Operation(
summary = "Return bookmarks from repository",
description = "Return bookmarks from repository")
@ApiResponses({
@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "403", description = "Forbidden")
})
@RolesAllowed(ADMIN_ROLE)
public void getAllBookmarks(
@Parameter(description = "max number of returned bookmarks")
@DefaultValue(Integer.MAX_VALUE + "")
@QueryParam("maxResult") Integer maxResult) {
bookmarksService.getBookmarks(maxResult);
}
Shared with ❤️ from Codever. Use 👉 copy to mine functionality to add it to your personal snippets collection.
Top comments (0)