Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add statement about of Pageable to documentation

See original GitHub issue

Issue Description

Setup information hikaku version: 2.0.0-SNAPSHOT implementation converter: SpringConverter

Describe the bug Spring data supports the idea of Pageable. A pageable is an object build by request parameter, supporting page, size and sort (parameter names are changeable). These parameters might be part of an api, but are not explizit mapped to query parameter. The documentation says “Query Parameter based on an object” are not supported, but I think a Pageable should be mentioned explizitly.

Expected behavior Add support for Pageable or add a note that Pageable are currently not supported in hikaku.

Code samples: Can you provide specifications or code snippets?

public ResponseEntity<Person> getPersons(
        @RequestParam(name = "language", required = false) String language,
        @PageableDefault Pageable pageable) {

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

cc-jhrcommented, Jul 19, 2019

Hi @jrehwaldt, thank you for giving feedback on this topic.

First of all, as stated in the list of currently not supported features in the of the spring converter, query parameter based on classes/interfaces are currently not supported in general. So depending on the solution for that, this might solve the cases mentioned above already. It might make sense to implement the general approach before we focus on specific interfaces or classes.

From my perspective the PagaeableDifferenceEvaluator idea wouldn’t work. Hikaku is designed to convert a specification or an implementation to an internal domain model of a REST endpoint. After that the model for the specification is compared to the model of the implementation in the core. At the time of the actual comparison, there is therefore no additional information about the implementation, such as class types and the like. This is intentional.

However I like the idea of creating rules dynamically for the config to ignore specific bits, instead of static rules.

jrehwaldtcommented, Aug 12, 2019

As I see it the proposal from #47 unfortunately doesn’t solve either the general nor the original issue.

  • Pageable is an interface, which you excluded from your proposal
  • The proposal assumes a strict mapping from query parameter to an object property, but the latter should be an implementation detail and not bound to external names. Imho, a query parameter sort could be mapped to sortOrder internally.

A truly general solution would be to allow deriving arbitrary parameters from unknown objects declared in endpoint mappings, something like (Object) -> Set<Parameter>, with Parameter being any of these.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Paging with Spring Boot - Reflectoring
The most common way to create a Pageable instance is to use the PageRequest implementation: Pageable pageable = PageRequest. of(0, 5, ...
Read more >
Swagger documentation for Spring Pageable interface
The issue I have is that the pageable parameter is detected with content-type application/json and I don't know how to pass a value...
Read more >
Spring Data JPA Tutorial: Pagination - Petri Kainulainen
This blog post describes how you can paginate your query results with Spring Data JPA.
Read more >
Pagination and Sorting using Spring Data JPA - Baeldung
Learn how to paginate and sort query results in Spring Data JPA.
Read more >
4. Paging and Sorting - Spring
To add paging support to your Repositories, you need to extend the PagingAndSortingRepository<T,ID> interface rather than the basic CrudRepository<T,ID> ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found