graphql-java-kickstart/graphql-spring-webclient

Document variable usage

balazsmaria opened this issue · 2 comments

Looking at GraphQLRequestBuilder.variables(Object variables) it's not entirely clear how to set variables.

What I did was:

		Map<String, String> vars = Map.of("myvar", "value");

		var request = GraphQLRequest.builder()
				.header(HttpHeaders.AUTHORIZATION, TOKEN)
				.resource("query.graphql")
				.variables(vars)
				.build();

I have used an immutable map
Map<String, Object> variables = ImmutableMap.of(key, value);