名称在解析器中定义,但枚举不在模式中
name was defined in resolvers, but enum is not in schema
使用 appolo 服务器 2 测试版,
我有一个像这样的解析器:
Travaux: new GraphQLEnumType({
name: 'Travaux',
values: {
ins: { value: 'en instruction' },
val: { value: 'valide' },
ech: { value: 'échu' }
}
})
和架构
gql`
type Query {
titre(id: String!): Titre
}
type Titre {
travaux: Travaux
}
enum Travaux {
ins
val
ech
}
`
这会出错:
Travaux.name was defined in resolvers, but enum is not in schema
如果我删除 Travaux
解析器,它就可以工作……
这里有什么?
解析器必须是:
Travaux = {
ins: 'en instruction',
val: 'valide',
ech: 'échu'
}
使用 appolo 服务器 2 测试版,
我有一个像这样的解析器:
Travaux: new GraphQLEnumType({
name: 'Travaux',
values: {
ins: { value: 'en instruction' },
val: { value: 'valide' },
ech: { value: 'échu' }
}
})
和架构
gql`
type Query {
titre(id: String!): Titre
}
type Titre {
travaux: Travaux
}
enum Travaux {
ins
val
ech
}
`
这会出错:
Travaux.name was defined in resolvers, but enum is not in schema
如果我删除 Travaux
解析器,它就可以工作……
这里有什么?
解析器必须是:
Travaux = {
ins: 'en instruction',
val: 'valide',
ech: 'échu'
}