
Safer filtering with JPA & RSQL
Hi everyone,
I published a small library that came from a problem I kept running into while building Spring APIs.
I wanted to let users filter dynamically, but without exposing a completely open entry point where they could try arbitrary entity fields, operators, joins, or values.
I looked at a few approaches, including Shopify-style bracket operators, OData, and eventually landed on RSQL. I built this library on top of two existing projects: rsql-parser for parsing RSQL, and rsql-jpa-specification for translating RSQL into JPA Specifications.
Those libraries solve the parsing and query generation parts. What I wanted to add was a validation/contract layer on top: a way for each use case to explicitly define public field aliases, allowed operators, sortable fields, paging limits, value validation, and mandatory application predicates.
That became this library:
https://github.com/ggomarighetti/jpa-rsql-search
I’d really appreciate constructive feedback on the idea, the API, and the docs.