Is Spring-GraphQL a good replacement to RSQL?

509 Views Asked by At

RSQL is a query language for parametrized filtering of entries in RESTful APIs, meaning I can do something like

curl -X GET http://localhost:8081/api/v1/employee?search=lastName==Doe

where the search query param can take multiple filters -

search=lastName==Doe;firstName==John

which translates to select * from employee where firstName = 'John' and lastName = 'Doe'

In GraphQL I need to define a schema in schema.graphqls which only supports a fixed query as -

type Query {
   employeeByLastName(lastName: String): Employee
   employeeByFirstName(firstName: String): Employee
}

Is it possible to define a single query in GraphQL that can filter on any field without specifying the field explicitly in the schema?

Something like -

type Query {
   filter(params: String[]): Employee
}

Note: I am new to GraphQL, I am following this link

0

There are 0 best solutions below