相关疑难解决方法(0)

GraphQL错误字段类型必须是输入类型,但得到:

这是突变:

const createNotebook = mutationWithClientMutationId ({
    name: 'CreateNotebook',
    inputFields: {
        token: {
            type: GraphQLString,
        },

        details: {
            type: NotebookDetails,
        },
    },
    outputFields: {

    },
    async mutateCRNotebook(input, context) {
        const data = getJSONFromRelativeURL(input.token);

    },
});
Run Code Online (Sandbox Code Playgroud)

以下是突变详细信息字段中使用的模式:

const NotebookDetails = new GraphQLObjectType({
    name: 'NotebookDetails',
    interfaces: [nodeInterface],

    fields: () => ({
        id: globalIdField('NotebookDetails'),

        description: {
            type: GraphQLString,
            description: '...',
            resolve(obj) {
                return obj.description;
            },
        },

        language: {
            type: GraphQLString,
            description: '...',
            resolve(obj) {
                return obj.language;
            },
        },

    }),

});
Run Code Online (Sandbox Code Playgroud)

我在运行此代码时出错:

api_1    | Error: …
Run Code Online (Sandbox Code Playgroud)

javascript graphql

20
推荐指数
3
解决办法
1万
查看次数

标签 统计

graphql ×1

javascript ×1