add missing required

This commit is contained in:
Jeremie Panzer
2019-05-02 13:42:49 +02:00
parent 7f40a430fd
commit 0b3a0fb3ed
3 changed files with 15 additions and 9 deletions

View File

@@ -292,7 +292,8 @@ public class FeedREST {
@UnitOfWork @UnitOfWork
@ApiOperation(value = "Queue a feed for refresh", notes = "Manually add a feed to the refresh queue") @ApiOperation(value = "Queue a feed for refresh", notes = "Manually add a feed to the refresh queue")
@Timed @Timed
public Response queueForRefresh(@ApiParam(hidden = true) @SecurityCheck User user, @ApiParam(value = "Feed id") IDRequest req) { public Response queueForRefresh(@ApiParam(hidden = true) @SecurityCheck User user,
@ApiParam(value = "Feed id", required = true) IDRequest req) {
Preconditions.checkNotNull(req); Preconditions.checkNotNull(req);
Preconditions.checkNotNull(req.getId()); Preconditions.checkNotNull(req.getId());
@@ -311,7 +312,8 @@ public class FeedREST {
@UnitOfWork @UnitOfWork
@ApiOperation(value = "Mark feed entries", notes = "Mark feed entries as read (unread is not supported)") @ApiOperation(value = "Mark feed entries", notes = "Mark feed entries as read (unread is not supported)")
@Timed @Timed
public Response markFeedEntries(@ApiParam(hidden = true) @SecurityCheck User user, @ApiParam(value = "Mark request") MarkRequest req) { public Response markFeedEntries(@ApiParam(hidden = true) @SecurityCheck User user,
@ApiParam(value = "Mark request", required = true) MarkRequest req) {
Preconditions.checkNotNull(req); Preconditions.checkNotNull(req);
Preconditions.checkNotNull(req.getId()); Preconditions.checkNotNull(req.getId());
@@ -349,7 +351,7 @@ public class FeedREST {
@ApiOperation(value = "Fetch a feed's icon", notes = "Fetch a feed's icon") @ApiOperation(value = "Fetch a feed's icon", notes = "Fetch a feed's icon")
@Timed @Timed
public Response getFavicon(@ApiParam(hidden = true) @SecurityCheck User user, public Response getFavicon(@ApiParam(hidden = true) @SecurityCheck User user,
@ApiParam(value = "subscription id") @PathParam("id") Long id) { @ApiParam(value = "subscription id", required = true) @PathParam("id") Long id) {
Preconditions.checkNotNull(id); Preconditions.checkNotNull(id);
FeedSubscription subscription = feedSubscriptionDAO.findById(user, id); FeedSubscription subscription = feedSubscriptionDAO.findById(user, id);
@@ -514,7 +516,8 @@ public class FeedREST {
@Consumes(MediaType.MULTIPART_FORM_DATA) @Consumes(MediaType.MULTIPART_FORM_DATA)
@ApiOperation(value = "OPML import", notes = "Import an OPML file, posted as a FORM with the 'file' name") @ApiOperation(value = "OPML import", notes = "Import an OPML file, posted as a FORM with the 'file' name")
@Timed @Timed
public Response importOpml(@ApiParam(hidden = true) @SecurityCheck User user, @FormDataParam("file") InputStream input) { public Response importOpml(@ApiParam(hidden = true) @SecurityCheck User user,
@ApiParam(value = "ompl file", required = true) @FormDataParam("file") InputStream input) {
String publicUrl = config.getApplicationSettings().getPublicUrl(); String publicUrl = config.getApplicationSettings().getPublicUrl();
if (StringUtils.isBlank(publicUrl)) { if (StringUtils.isBlank(publicUrl)) {

View File

@@ -61,7 +61,8 @@ public class ServerREST {
@ApiOperation(value = "proxy image") @ApiOperation(value = "proxy image")
@Produces("image/png") @Produces("image/png")
@Timed @Timed
public Response get(@ApiParam(hidden = true) @SecurityCheck User user, @QueryParam("u") String url) { public Response get(@ApiParam(hidden = true) @SecurityCheck User user,
@ApiParam(value = "image url", required = true) @QueryParam("u") String url) {
if (!config.getApplicationSettings().getImageProxyEnabled()) { if (!config.getApplicationSettings().getImageProxyEnabled()) {
return Response.status(Status.FORBIDDEN).build(); return Response.status(Status.FORBIDDEN).build();
} }

View File

@@ -226,7 +226,8 @@ public class UserREST {
@UnitOfWork @UnitOfWork
@ApiOperation(value = "Register a new account") @ApiOperation(value = "Register a new account")
@Timed @Timed
public Response register(@Valid @ApiParam(required = true) RegistrationRequest req, @Context SessionHelper sessionHelper) { public Response register(@Valid @ApiParam(required = true) RegistrationRequest req,
@Context @ApiParam(hidden = true) SessionHelper sessionHelper) {
try { try {
User registeredUser = userService.register(req.getName(), req.getPassword(), req.getEmail(), Arrays.asList(Role.USER)); User registeredUser = userService.register(req.getName(), req.getPassword(), req.getEmail(), Arrays.asList(Role.USER));
userService.login(req.getName(), req.getPassword()); userService.login(req.getName(), req.getPassword());
@@ -243,7 +244,7 @@ public class UserREST {
@UnitOfWork @UnitOfWork
@ApiOperation(value = "Login and create a session") @ApiOperation(value = "Login and create a session")
@Timed @Timed
public Response login(@ApiParam(required = true) LoginRequest req, @Context SessionHelper sessionHelper) { public Response login(@ApiParam(required = true) LoginRequest req, @ApiParam(hidden = true) @Context SessionHelper sessionHelper) {
Optional<User> user = userService.login(req.getName(), req.getPassword()); Optional<User> user = userService.login(req.getName(), req.getPassword());
if (user.isPresent()) { if (user.isPresent()) {
sessionHelper.setLoggedInUser(user.get()); sessionHelper.setLoggedInUser(user.get());
@@ -258,7 +259,7 @@ public class UserREST {
@UnitOfWork @UnitOfWork
@ApiOperation(value = "send a password reset email") @ApiOperation(value = "send a password reset email")
@Timed @Timed
public Response sendPasswordReset(@Valid PasswordResetRequest req) { public Response sendPasswordReset(@Valid @ApiParam(required = true) PasswordResetRequest req) {
User user = userDAO.findByEmail(req.getEmail()); User user = userDAO.findByEmail(req.getEmail());
if (user == null) { if (user == null) {
return Response.status(Status.PRECONDITION_FAILED).entity("Email not found.").type(MediaType.TEXT_PLAIN).build(); return Response.status(Status.PRECONDITION_FAILED).entity("Email not found.").type(MediaType.TEXT_PLAIN).build();
@@ -294,7 +295,8 @@ public class UserREST {
@UnitOfWork @UnitOfWork
@Produces(MediaType.TEXT_HTML) @Produces(MediaType.TEXT_HTML)
@Timed @Timed
public Response passwordRecoveryCallback(@QueryParam("email") String email, @QueryParam("token") String token) { public Response passwordRecoveryCallback(@ApiParam(required = true) @QueryParam("email") String email,
@ApiParam(required = true) @QueryParam("token") String token) {
Preconditions.checkNotNull(email); Preconditions.checkNotNull(email);
Preconditions.checkNotNull(token); Preconditions.checkNotNull(token);