public class ValuesResolver
extends java.lang.Object
Constructor and Description |
---|
ValuesResolver() |
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Object> |
coerceArgumentValues(GraphQLSchema schema,
java.util.List<VariableDefinition> variableDefinitions,
java.util.Map<java.lang.String,java.lang.Object> variableValues)
The http://facebook.github.io/graphql/#sec-Coercing-Variable-Values says :
|
java.util.Map<java.lang.String,java.lang.Object> |
getArgumentValues(GraphqlFieldVisibility fieldVisibility,
java.util.List<GraphQLArgument> argumentTypes,
java.util.List<Argument> arguments,
java.util.Map<java.lang.String,java.lang.Object> variables) |
java.util.Map<java.lang.String,java.lang.Object> |
getArgumentValues(java.util.List<GraphQLArgument> argumentTypes,
java.util.List<Argument> arguments,
java.util.Map<java.lang.String,java.lang.Object> variables) |
public java.util.Map<java.lang.String,java.lang.Object> coerceArgumentValues(GraphQLSchema schema, java.util.List<VariableDefinition> variableDefinitions, java.util.Map<java.lang.String,java.lang.Object> variableValues)
1. Let coercedValues be an empty unordered Map. 2. Let variableDefinitions be the variables defined by operation. 3. For each variableDefinition in variableDefinitions: a. Let variableName be the name of variableDefinition. b. Let variableType be the expected type of variableDefinition. c. Let defaultValue be the default value for variableDefinition. d. Let value be the value provided in variableValues for the name variableName. e. If value does not exist (was not provided in variableValues): i. If defaultValue exists (including null): 1. Add an entry to coercedValues named variableName with the value defaultValue. ii. Otherwise if variableType is a Non‐Nullable type, throw a query error. iii. Otherwise, continue to the next variable definition. f. Otherwise, if value cannot be coerced according to the input coercion rules of variableType, throw a query error. g. Let coercedValue be the result of coercing value according to the input coercion rules of variableType. h. Add an entry to coercedValues named variableName with the value coercedValue. 4. Return coercedValues.
schema
- the schemavariableDefinitions
- the variable definitionsvariableValues
- the supplied variablespublic java.util.Map<java.lang.String,java.lang.Object> getArgumentValues(java.util.List<GraphQLArgument> argumentTypes, java.util.List<Argument> arguments, java.util.Map<java.lang.String,java.lang.Object> variables)
public java.util.Map<java.lang.String,java.lang.Object> getArgumentValues(GraphqlFieldVisibility fieldVisibility, java.util.List<GraphQLArgument> argumentTypes, java.util.List<Argument> arguments, java.util.Map<java.lang.String,java.lang.Object> variables)