1
我试图运行与graphql Express服务器,我收到以下错误:GraphQL与快递错误:Query.example字段类型必须是输出类型,但得到:[对象的对象]
Error: Query.example field type must be Output Type but got: [object Object].
express-
app.use('/graphql', graphqlHTTP(req => ({
schema,
pretty: true
})));
架构看起来像:在路线graphql使用
export default new GraphQLSchema({
query: new GraphQLObjectType({
name: 'Query',
fields: queries
})
});
查询只有一个查询从这里进口:
import {
GraphQLList,
GraphQLID,
GraphQLNonNull
} from 'graphql';
import exampleScheme from '../models/schemes/example';
import {example as exampleData} from '../models/jsons'
export default {
type: exampleScheme,
resolve (root, params, options) {
return exampleData;
}
};
的架构(exampleScheme)和数据(exampleScheme)的另一个项目工作,所以我认为他们不是问题。
任何想法? '输出类型'是什么意思?
感谢HagaiCo,因为我从另一个项目导入了这些方案,exmaple scheme是'GraphQLSchema'而不是'GraphQLObjectType'。 – alonp99