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

Optional parameters for find method

Open
#93 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

It might be somewhere in the documentation but I couldn't find it.
Say I have a query method

findByXAndYAndZ(@Param("u") String x, @Param("v") String y,@Param("w") String z);

When omitting any of the params the method complains about missing parameters, however I'd like some of those options to be optional. I could write something along the lines of

findByX
findByXAndY
findByXAndYAndZ

However it does not seem to be possible to expose them under the same path/rel.

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.

Research direction

Start by examining how the shown findByXAndYAndZ query method binds request parameters and exposes its path/rel. Compare that behavior with the desired findByX, findByXAndY, and findByXAndYAndZ forms. Done should define whether omitted parameters are supported under one path/rel and include coverage or documentation for the resulting behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.