Skip to content

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

Open
@spring-projects-issues

Description

@spring-projects-issues

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions