-
Notifications
You must be signed in to change notification settings - Fork 701
Description
Querydsl is actually the best option in spring to get fully pageable and filtered rest endpoint. Combined with spring-data-rest it looks great.
But there is a game changer when we need little more advanced filtering e.g. "greaterThan", "greaterEqual", "contains", "startWith", etc.
In this situation generally spring-data-rest is not useful, we have to manually extend responses and controllers.
Extending predicate in controller looks very bad in MVC, DDD pattern.
Creating totally new predicate adding manually all equal conditions gives a headache.
My proposition is to add additional REST filter parameters for every Entity field e.g.:
&fieldNameGreaterThan=
&fieldNameGreaterEqual=
&fieldNameContains= a,b,c //for arrays/collections (optional mapping, standard should be ?fContains=x&fContains=y)
&fieldNameContains= someStringPart //for strings
&fieldNameStartWith= (optionally separated by comma)
&fieldNameNot= (optionally separated by comma)
It will resolve filtering problem in most used applications.