java – Filtering using GraphQL in spring boot

Is there any way to filter only using graphQL and not making any changes in spring boot?

This filtered result is coming from the filter which is done in java part. I want the same result with the graphQL doing the filtering and not the java.

In simple words, Java will return the complete list and the graphQL should filter it before displaying the output.

The schema :

` type Query {
userList(filter: String, range: String, sort: String): [User]
}

type User {
id: ID
name: String
userAddressList: [UserAddress]

}

type UserAddress {
id: ID
userId: Int
address: String
user: User

}`

The Query :

` query{
userList(
filter: “[{userAddressList:{address: nanjangud}}]”,

){
id
name
userAddressList {
address
}
}
}`

The result :

"data": { "userList": [ { "id": "1", "name": "sdfg", "userAddressList": [ { "address": "Nanjangud" } ] } ] }

Read more here: Source link