private string FormatDirectiveArguments(QueryArguments arguments) { if (arguments == null || !arguments.Any()) { return(null); } return(string.Join(Environment.NewLine, arguments.Select(arg => $" {PrintInputValue(arg)}"))); }
private static Dictionary <string, object> GetArgumentValues(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(type, value, variables); coercedValue = coercedValue ?? arg.DefaultValue; acc[arg.Name] = coercedValue; 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 != 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; }); }
internal static IEnumerable <Change> AddedElements(QueryArguments oldElements, QueryArguments newElements, CreateChangeGraphTypeArgument creator) { return(newElements .Where(t => !oldElements.Any(ot => ot.Name.Equals(t.Name))) .Select(d => creator(d))); }