Variables
Declares the names and GraphQL types of the variables produced by a implementation.
Java equivalent of Kotlin's @Variables annotation. Apply to a nested static class that implements VariablesProvider inside a resolver class.
Each entry has the form "name: Type" (whitespace ignored) where Type is a GraphQL type expression matching the variable's usage in the fragment.
Example
= "fragment _ on Query { intermediary(arg: $x) }")
public static class FromVariablesProviderResolver extends QueryResolvers.FromVariablesProvider {
public CompletableFuture<Integer> resolve(Context ctx) { ... }
= "x: Int!")
public static class TestVariablesProvider implements VariablesProvider<Arguments.NoArguments> {
public CompletableFuture<Map<String, Object>> provide(
VariablesProviderContext<Arguments.NoArguments> ctx) {
return CompletableFuture.completedFuture(Map.of("x", 123));
}
}
}
Content copied to clipboard