graphql / graphql-js

A reference implementation of GraphQL for JavaScript
http://graphql.org/graphql-js/
MIT License
20.09k stars 2.03k forks source link

Type of field in resolve #52

Closed mickhansen closed 9 years ago

mickhansen commented 9 years ago

When building a generic resolver (currently i'm trying to build one to map graphql to sequelize) it would be nice to be able to access information about the type of the current field.

Knowing whether or not something is a GraphQLList of a GraphQLObjectType or simply just a GraphQLObjectType will help the resolver in knowing whether to fetch an array of objects or a single object.

source and root (the first and third argument) seem to be empty, and ast (4th arg) only contains a Kind (which is 'Field') and the name value for that field.

mickhansen commented 9 years ago

Scratch that, going through graphl source i found a 5th argument fieldType which contains the info needed!