spring-projects / spring-projects/spring-data-rest

Spring Data REST PageMetadata doesn't preserve projection parameter for first, next, prev links [DATAREST-780]

Open
#1,153 0 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

type: bug
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Marc Zampetti opened DATAREST-780 and commented

When using the Collections resource of an Repository exposed via Spring Data REST, and one is using a projection as part of the query, the _links that are generated do not include the used projection. So any application that is trying to follow the HAL principals and use the _link metadata to page through the results will break since the expected output will change on pages 2 - N because the projection is no longer applied.

For example (NOTE URLs modified to remove some identifying info we don't want exposed):

GET /connect/avails?projection=ipm&size=1

returns 

_links: {
     first: {
          href: "/connect/avails?page=0&size=1"
     },
     self: {
          href: "/connect/avails"
     },
     next: {
          href: "/connect/avails?page=1&size=1"
     },
     last: {
          href: "/connect/avails?page=308429&size=1"
     },
     profile: {
          href: "/connect/connect/profile/avails"
     },
     search: {
         href: "/connect/avails/search"
     }
}

Affects: 2.4.2 (Gosling SR2)

1 votes, 2 watchers

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.