smallrye/smallrye-graphql

Passing request arguments to @Source methods

Closed this issue · 2 comments

Hello. I was wondering, is it possible to pass request arguments to @Source methods?

@Query
public List<User> users(FilterUser filterUser) {...}

public List<Roles> roles(
     @Source User user, 
     FilterUser filterUser,  // This from users method 
     FilterRole filterRole
) {...}

You cannot use more than one @Source.

I haven't encountered anything like this. It just got interesting.

You can, but the client will have to pass in the value twice (one in the root (users) and again when asking for the source field (roles). You might get the values in the roles method by using the context (https://quarkus.io/guides/smallrye-graphql#context)

t1 commented

I think we can close this. If I'm wrong, feel free to reopen.