mirror of
https://github.com/theonedev/onedev.git
synced 2025-12-08 18:26:30 +00:00
Add validation annotation for resources.
This commit is contained in:
parent
26535f960a
commit
f3332cfea0
@ -3,6 +3,7 @@ package com.pmease.gitop.rest.resource;
|
||||
import io.dropwizard.jersey.params.LongParam;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.validation.Valid;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
@ -36,7 +37,7 @@ public class ProjectResource {
|
||||
}
|
||||
|
||||
@POST
|
||||
public Long save(Project project) {
|
||||
public Long save(@Valid Project project) {
|
||||
projectManager.save(project);
|
||||
return project.getId();
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.pmease.gitop.rest.resource;
|
||||
import io.dropwizard.jersey.params.LongParam;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.validation.Valid;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
@ -35,7 +36,7 @@ public class UserResource {
|
||||
}
|
||||
|
||||
@POST
|
||||
public Long save(User user) {
|
||||
public Long save(@Valid User user) {
|
||||
userManager.save(user);
|
||||
return user.getId();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user