It would be nice to be able to annotate the @RequestJsonApiPage parameter with either PageableDefault or SortDefault, and have custom defaults sort and pagination set for when those parameters lack. Something like
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping(value = "/app", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class RestController {
@GetMapping
public Response<Void> get(final @RequestJsonApiPage @PageableDefault(
page = 0, size = 100,
sort = {"id", "name"},
direction = Sort.Direction.ASC
) Pageable page) throws Exception {
return Response.<Void, Void>builder()
.build();
}
}
Or them:
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping(value = "/app", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class RestController {
@GetMapping
public Response<Void> get(
@sortDefault(sort={"name", "age"}, direction=Sort.Direction.ASC)
final @RequestJsonApiPage Pageable page) throws Exception {
final Sort sort = page.getSort();
// do anything with sort
return Response.<Void, Void>builder()
.build();
}
}
It would be nice to be able to annotate the
@RequestJsonApiPageparameter with eitherPageableDefaultorSortDefault, and have custom defaults sort and pagination set for when those parameters lack. Something likeOr them: