micronaut-data icon indicating copy to clipboard operation
micronaut-data copied to clipboard

Add the ability to define default pagination + sort properties for Pageable

Open ghillert opened this issue 4 years ago • 2 comments

As Micronaut provides the ability to handle io.micronaut.data.model.Pageable as a controller parameter, it would be useful to also add support for:

  • @PageableDefault
  • @SortDefault

That way sensible defaults can be defined on a per-controller basis.

ghillert avatar Mar 29 '21 20:03 ghillert

Note that these can already be globally defined here https://micronaut-projects.github.io/micronaut-data/latest/guide/configurationreference.html#io.micronaut.data.runtime.config.DataConfiguration.PageableConfiguration

Seems odd to want different behaviour per controller, but ok

graemerocher avatar Apr 23 '21 09:04 graemerocher

One reason we'd want this is if different controllers use different sort by fields. Granted, at that point, you're not running as much of a microservice...

MT-Jacobs avatar Jan 30 '23 16:01 MT-Jacobs