public Dictionary <string, object> GetArgumentValues(ISchema schema, QueryArguments definitionArguments, Arguments astArguments, Variables variables) { if (definitionArguments == null || !definitionArguments.Any()) { return(null); } return(definitionArguments.Aggregate(new Dictionary <string, object>(), (acc, arg) => { var value = astArguments != null ? astArguments.ValueFor(arg.Name) : null; var type = schema.FindType(arg.Type); if (value is Variable) { var variable = (Variable)value; value = variables.ValueFor(variable.Name); } object coercedValue = null; if (IsValidValue(schema, type, value)) { coercedValue = CoerceValue(schema, type, value, variables); } acc[arg.Name] = coercedValue ?? arg.DefaultValue; return acc; })); }
public Dictionary <string, object> GetArgumentValues(Schema schema, QueryArguments definitionArguments, Arguments astArguments, Variables variables) { if (definitionArguments == null || !definitionArguments.Any()) { return(null); } return(definitionArguments.Aggregate(new Dictionary <string, object>(), (acc, arg) => { var value = astArguments != null ? astArguments.ValueFor(arg.Name) : null; var coercedValue = CoerceValueAst(schema, schema.FindType(arg.Type), value, variables); acc[arg.Name] = coercedValue ?? arg.DefaultValue; return acc; })); }
public Dictionary <string, object> GetArgumentValues(ISchema schema, QueryArguments definitionArguments, Arguments astArguments, Variables variables) { if (definitionArguments == null || !definitionArguments.Any()) { return(null); } return(definitionArguments.Aggregate(new Dictionary <string, object>(), (acc, arg) => { var value = astArguments?.ValueFor(arg.Name); var type = arg.ResolvedType; var coercedValue = CoerceValue(schema, type, value, variables); coercedValue = coercedValue ?? arg.DefaultValue; acc[arg.Name] = coercedValue; return acc; })); }