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

Specifying null handling for 'sort' query params [DATAREST-1098]

Open
#1,409 4 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

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

Description

Casey Link opened DATAREST-1098 and commented

It should be possible (or would be very nice!) to be able to specify the null handling when sorting a response with spring-data-rest.

This is quite important for our use cases, as we have some tables where nulls should be sorted last or first, depending on the specific field.

I see two possibilities here:

  1. the sort query param accepts an additional positional argument like ?sort=name,desc,nullslast
  2. QuerydslBinderCustomizer and QuerydslBindings are extended such that the sort details can be customized on the repository.
{
    default void customize(QuerydslBindings bindings, QPerson person)
    {
        bindings.bind(person.name).sort().nullsLast();
    }

Affects: 2.6.4 (Ingalls SR4)

1 votes, 3 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.