protected async Task <object> ExecuteFieldGroupAsync( IExecutorContext context, ObjectType objectType, object objectValue, Dictionary <string, object> coercedVariableValues, KeyValuePair <string, List <GraphQLFieldSelection> > fieldGroup, NodePath path) { if (objectType == null) { throw new ArgumentNullException(nameof(objectType)); } var schema = context.Schema; var fields = fieldGroup.Value; var fieldName = fields.First().Name.Value; path.Append(fieldName); // __typename hack if (fieldName == "__typename") { return(objectType.Name); } var fieldType = schema .GetField(objectType.Name, fieldName)? .Type; if (fieldType == null) { throw new GraphQLError( $"Object '{objectType.Name}' does not have field '{fieldName}'"); } var responseValue = await ExecuteFieldAsync( context, objectType, objectValue, fields, fieldType, coercedVariableValues, path).ConfigureAwait(false); return(responseValue); }
public static async Task <object> ExecuteFieldGroupAsync( IExecutorContext context, ObjectType objectType, object objectValue, KeyValuePair <string, IReadOnlyCollection <GraphQLFieldSelection> > fieldGroup, NodePath path) { if (objectType == null) { throw new ArgumentNullException(nameof(objectType)); } var schema = context.Schema; var fields = fieldGroup.Value; var fieldName = fields.First().Name.Value; path.Append(fieldName); // __typename hack if (fieldName == "__typename") { return(objectType.Name); } var fieldType = schema .GetField(objectType.Name, fieldName)? .Type; if (fieldType == null) { throw new QueryExecutionException( $"Object '{objectType.Name}' does not have field '{fieldName}'", path); } var responseValue = await ExecuteFieldAsync( context, objectType, objectValue, fields, fieldType, path).ConfigureAwait(false); return(responseValue); }