spring-projects / spring-projects/spring-data-rest
please support optionally null parameters in finder endpoints [DATAREST-90]
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
Josh Long opened DATAREST-90 and commented
For example, suppose i have the following repository:
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.repository.annotation.RestResource;
import java.util.List;
@RestResource(path = "users", rel = "users")
public interface UserRepository extends PagingAndSortingRepository<User, Long> {
User findByUsername(@Param ("username") String username);
List<User> findUsersByFirstNameOrLastNameOrUsername( @Param ("firstName") String firstName, @Param("lastName") String lastName, @Param("username") String username);
}
if i use the endpoint and specify all the parameters, everything works. http://localhost:8080/users/search/findUsersByFirstNameOrLastNameOrUsername?firstName=X&username=Y&lastName=Z, but fails when one of the query parameters are missing.
No further details from DATAREST-90
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Spring Data REST finder endpoint shown in the issue and trace how repository query parameters are handled when a parameter is absent. Reproduce the example using findUsersByFirstNameOrLastNameOrUsername with one or more missing parameters. Done means the finder endpoint accepts omitted parameters instead of failing while preserving the existing behavior when all parameters are supplied.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100