In GraphQL, an input
cannot be used as a type
and a type
cannot be used as an input
. Unfortunately, even if the fields appear identical to an existing type, you always have to define a separate input to use as an argument. Try something like this:
const NotebookDetailsInput = new GraphQLInputObjectType({
name: 'NotebookDetailsInput',
fields: () => ({
id: { type: GraphQLID },
description: { type: GraphQLString },
language: { type: GraphQLString },
})
});
If using SDL, the same type would look like this:
input {
id: ID
description: String
language: String
}
Please see this answer for an extensive explanation of why it’s necessary to do this.