I have graphql schema which contains a couple of mutations and queries. I think validation of mutation should call only when I send mutation { ... }
to graphql server but currently, the server says me that I did not send 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
}
And I create executable schema via 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
it is part of the exports of graphql-tools
package)
(data in resolvers
it is object which not contain Mutation
)
When I launch express server with express-graphql
and open graphiql
and put query (not mutation) for getting my projects it says me:
What's I do wrong? Hope for your help, thanks!