Typescript 为什么GraphQl说我忘了发送args进行突变
我有一个graphql模式,它包含两个突变和查询。我认为只有当我将Typescript 为什么GraphQl说我忘了发送args进行突变,typescript,graphql,express-graphql,Typescript,Graphql,Express Graphql,我有一个graphql模式,它包含两个突变和查询。我认为只有当我将mutation{…}发送到graphql服务器时,才应该调用突变验证,但目前,服务器告诉我,我没有发送所有声明突变的参数 type User { id: ID!, username: String! } type Auth { username: String password: String } enum Kind { COMPANY PERSONAL FREELANCE OPEN_SOUR
mutation{…}
发送到graphql服务器时,才应该调用突变验证,但目前,服务器告诉我,我没有发送所有声明突变的参数
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
}
我通过graphql工具
创建可执行模式:
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
它是graphql工具
包导出的一部分)(解析程序中的数据是不包含变异的对象) 当我使用
expressgraphql
启动express server并打开graphiql
并放置查询(而不是变异)以获取我的项目时,它会告诉我:
我做错了什么?
希望你的帮助,谢谢 嘿,我找到了我自己问题的答案。GraphQl告诉我应该在schema中修复什么,但我不理解他。 输入类型(突变的参数应为输入类型):
input MyInput {
foo: String
}
...
type Mutation {
getBar(foo: MyInput): String
}