Add a case to detect for GraphQLList/GraphQLNonNull that's not being instantiated properly
When attempting to use GraphQLList as an input type, an error is generated:
Error:
This appears to be caused by isInputType in definitions.js not including GraphQLList as a valid type. https://github.com/graphql/graphql-js/blob/b14766205951f4fe6f712c9e24d47c0d117cc3bf/src/type/definition.js#L62-L69
My reading of the spec as well as the GraphQLInputType definition immediately above that includes GraphQLList as a valid type leads me to believe that this is an error.
getNamedType will pull out the underlying wrapped type. So it should still work. Can you paste the code that is leading to this error?
Sure, names changed to protect proprietary info, but it's basically:
var GraphQLCarAddWheelsMutation = mutationWithClientMutationId({ name: 'CarAddWheels', inputFields: { carId: { type: GraphQLInt}, wheelIds: {type: GraphQLList, kindOf: GraphQLInt} }, outputFields: { }, mutateAndGetPayload: (carId, wheelIds) => { addWheelstoCar(carId, wheelIds); return {}; } });
{type: new GraphQLList(GraphQLString)}
Sent from my iPhone
On Nov 23, 2015, at 1:11 PM, OverclockedTim [email protected] wrote:
Sure, names changed to protect proprietary info, but it's basically:
var GraphQLCarAddWheelsMutation = mutationWithClientMutationId({ name: 'CarAddWheels', inputFields: { carId: { type: GraphQLInt}, wheelIds: {type: GraphQLList, kindOf: GraphQLInt} }, outputFields: { }, mutateAndGetPayload: (carId, wheelIds) => { addWheelstoCar(carId, wheelIds); return {}; } });
— Reply to this email directly or view it on GitHub.
Well whatdya know, that works perfectly, thanks!
Would it be worth adding an example of List mutations to the Relay Mutation page? https://facebook.github.io/relay/docs/guides-mutations.html
Also, would it be worth clarifying the schema building message?
Would it be worth adding an example of List mutations to the Relay Mutation page? https://facebook.github.io/relay/docs/guides-mutations.html
Not sure how that's related. Perhaps another issue on the Relay issue tracker?
Also, would it be worth clarifying the schema building message? I think that'd be a good idea. Right now it's just stringifying anything that's passed to
typein the error message. Could add a case to detect forGraphQLList/GraphQLNonNullthat's not being instantiated properly though.
Sounds good, title change as per suggestion!
Closing this aging issue.
However this case will be kept in mind as documentation improves.