mickhansen / graphql-sequelize

GraphQL & Relay for MySQL & Postgres via Sequelize
MIT License
1.9k stars 172 forks source link

When using `JSONType` I get `Error: One of the provided types for building the Schema is missing a name.` #696

Closed vjpr closed 3 years ago

vjpr commented 3 years ago
Error: One of the provided types for building the Schema is missing a name.
    at devAssert (/(xxx/node_modules/.pnpm/graphql@15.3.0/node_modules/graphql/jsutils/devAssert.js:12:11)
    at new GraphQLSchema (/xxxr/node_modules/.pnpm/graphql@15.3.0/node_modules/graphql/type/schema.js:191:42)

It seems to only occur when I am using JSONType in a schema.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

gyandeepsinha commented 1 year ago

const mutation = new GraphQLObjectType({ name : 'Mutation', fields : { addClient : { type : ClientType, args : { name : {type : GraphQLNonNull(GraphQLString)}, email : {type : GraphQLNonNull(GraphQLString)}, phone : {type : GraphQLNonNull(GraphQLString)} }, async resolve(parent, args){ const clientObject = new client({ name : args.name, email : args.email, phone : args.phone }); return await clientObject.save();
} }, addProject : { type : ProjectType, args : { clientId : {type : GraphQLNonNull(GraphQLID)}, name : {type : GraphQLNonNull(GraphQLString)}, description : {type : GraphQLNonNull(GraphQLString)}, status : {type : GraphQLNonNull(GraphQLString)} }, async resolve(parent, args){ const projectObject = new project({ clientId : args.clientId, name : args.name, description : args.description, status : args.status }); return await project.save(); } } } }); I have removed a single quote from'ClientType' from line no: 5. My previous code was type: 'ClientType'. I have searched and spent 2 days on this error but did not get a proper solution. Just Imagine just a single quote can hustle you hard!