My GraphQL schema consists of various mutations and queries. I believe that validation of mutations should only occur when I send mutation { ... }
to the graphql server. However, currently, the server is informing me that I have not sent arguments for all declared mutations.
type User {
id: ID!,
username: String!
}
type Auth {
username: String
password: String
}
enum Kind {
COMPANY
PERSONAL
FREELANCE
OPEN_SOURCE
}
type Job {
kind: Kind!
name: String
link: String
github: String
npm: String
isTool: Boolean
address: String
}
type Project {
year: Int!
description: [String]!
job: Job
name: String
notImportant: Boolean
prefix: String
tags: [String]!
teamSize: String
}
type Query {
projects: [Project!]!
me: User
}
type Mutation {
login(authData: Auth): Boolean
addProject(project: Project): ID!
}
schema {
query: Query
mutation: Mutation
}
I have created an executable schema using graphql-tools
:
export const graphqlSchema = makeExecutableSchema({
typeDefs: `*here is that schema*`,
resolvers: mergeResolvers([projectResolvers, authResolvers]) as any,
resolverValidationOptions: {
requireResolversForResolveType: false,
requireResolversForArgs: false,
requireResolversForAllFields: false,
},
allowUndefinedInResolve: true,
});
(makeExecutableSchema
is a part of the exports of the graphql-tools
package)
(data in resolvers
is an object which does not contain Mutation
)
After launching the express server with express-graphql
and opening graphiql
, when I request a query (not a mutation) to get my projects, it displays an error:
https://i.sstatic.net/Z53Ax.png
What am I doing wrong? I hope for your assistance. Thank you!