micronaut-projects / micronaut-projects/micronaut-data

`Pageable` behavior undocumented in Micronaut `@Controller` methods

Open
#1,995 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

type: docs
Dominant language
Java
Stars
482
Forks
229
Avg merge
1d 7h
Merged PRs (30d)
32

Description

### Issue description

`Pageable` objects can be used in Micronaut Controller methods just fine (I found an example [here](https://guides.micronaut.io/latest/micronaut-data-jdbc-repository-maven-groovy.html), but the behavior itself isn't documented (or I haven't found it!). This is somewhat related to https://github.com/micronaut-projects/micronaut-data/issues/293

Best I can tell, if your `@Pageable` is a `@QueryValue`, then the object's values are flattened out and can be submitted as query params. I know that `number`, `page`, and `sort` all work just fine, though interestingly `sort` takes a comma-delimited list of `sortBy` and `direction` values.

If this were to be documented, where should it live? ~I almost think it would belong in the Micronaut Core docs - as a consequence, I'm a bit surprised that `Pageable` itself isn't part of the core code.~ Probably belongs in Micronaut Data docs thinking of it more, I'm jut not sure where it makes sense to talk about deserialization for the server's controllers.

Also, what actually controls this behavior in-code? I'd need to find that if I wanted to submit the docs update myself. I haven't found it quite yet, though clearly [others](https://github.com/micronaut-projects/micronaut-data/issues/219#issuecomment-800703051) knew about it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Micronaut Data JDBC repository guide and the related Micronaut Data issues to identify the documented Pageable example and the controller behavior described here. Locate the appropriate Micronaut Data documentation section, then document query-parameter binding for number, page, and sort, including the comma-delimited sort format.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.