These are chat archives for graphql-java/graphql-java

30th
Jan 2018
Michael Rubin
@mrubin
Jan 30 10:03
Does anyone know of working examples of supporting the deflate websocket extension (for subscriptions)?
Albert Lockett
@albertlockett_twitter
Jan 30 16:13

Hi. In graphql-java-tools query arguments get mapped to POJOs automatically which are passed to the resolver functions as arguments.

I can see the arguments for items in my query selectionSet using DataFetchingEnvironment.getSelectionSet().getArguments() method, but the results are all in HashMaps.

Is there a way to automatically map the arguments from the selectinoSet into the POJO?

Albert Lockett
@albertlockett_twitter
Jan 30 16:20

For example: If my IDL looks like this:

input InputType {
  name: String
}

type Person {
  name: String
  friendsWith(where: InputType): [Person]
}

Query {
  people(where: InputType): [Person]
}

And my query is like:

query {
  people(where: { name: "Jim" }) {
    friendsWith(where: { name: "Bob" }) {
      name
    }
  }
}

I might have a resolver function like:

public List<Person> people(InputType where, DataFetchingEnvironment env) {


  Map<String, Object> friendFilter = env.getSelection().getArguments().get("someField").get("where");

  // Is there a way to automatically map friendFilter to type InputType?
}