Skip to content

Commit 408b3f7

Browse files
committed
feat: define defualt value to resource
Signed-off-by: Otavio Santana <[email protected]>
1 parent b2f09bc commit 408b3f7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/os/expert/sample/GoalResource.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33

44
import jakarta.inject.Inject;
5+
import jakarta.ws.rs.DefaultValue;
56
import jakarta.ws.rs.GET;
67
import jakarta.ws.rs.PUT;
78
import jakarta.ws.rs.Path;
@@ -28,7 +29,8 @@ public GoalResource(GoalService goalService) {
2829
}
2930

3031
@GET
31-
public List<Goal> goals(@QueryParam("page") int page,@QueryParam("size") int size) {
32+
public List<Goal> goals(@QueryParam("page") @DefaultValue("1") int page,
33+
@QueryParam("size") @DefaultValue("10") int size) {
3234
LOGGER.info("Listing goals, page: " + page + ", size: " + size);
3335
return goalService.findGoals(page, size);
3436
}

0 commit comments

Comments
 (0)