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

`filterByJacksonVisibility` breaks filtering on relations

Open
#2,578 2 comments 0 reactions 1 assignee View on GitHub

@mp911de is already working on this.

Since Jul 27, 2026.

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

Description

The following commit breaks filtering on relationship. https://github.com/spring-projects/spring-data-rest/commit/3dc76b887be2714d53afbe3024f758ecd50c29ed

I have an entity Dossier with a @ManyToMany on customers:

The DossierRepository extends the QuerydslBinderCustomizer to bind on the customer property.

@RepositoryRestResource(excerptProjection = DossierExcerpt.class)
public interface DossierRepository extends JpaRepository<Dossier, Integer>, QuerydslPredicateExecutor<Dossier>, QuerydslBinderCustomizer<QDossier> {
    @RestResource
    Page<Dossier> findAll(@QuerydslPredicate Predicate predicate, Pageable pageable);

    @Override
    default void customize(QuerydslBindings bindings, QDossier dossier) {
        // Like statements on firstName and lastName
        bindings.bind(dossier.customers.any().firstName).first(StringExpression::containsIgnoreCase);
        bindings.bind(dossier.customers.any().lastName).first(StringExpression::containsIgnoreCase);
    }

Formerly I could use: /api/dossiers?customers.firstName=John
However due to the strict checking in filterByJacksonVisibility this bind doesn't work anymore

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.