我是否错误地设置了架构?

时间:2019-01-21 07:07:24

标签: graphql

我错误地设置了模式吗?我可以在操场上进行突变和查询,但是在前端遇到以下错误:“网络错误:意外的令牌<在位置0的JSON中” ,然后我在后端签入,该消息显示在下面,可能有人帮帮我吗?

# import * from './generated/prisma.graphql'

    type Mutation{
        createLeague(name: String, zhName: String, image: String, season: String, nation: String, clubs: Club): League!
        createClub(name: String, zhName: String, tla: String, badge: String, leagues: League): Club!

    }

    type Query{
        leagues: [League]!
        clubs: [Club]!
    }
Error: The type of Mutation.createLeague(clubs:) must be Input Type but got: Club.

The type of Mutation.createClub(leagues:) must be Input Type but got: League.
    at assertValidSchema (/mnt/c/Users/chisi/coding/tipson0.1/server/node_modules/graphql/type/validate.js:78:11)
    at Object.validate (/mnt/c/Users/chisi/coding/tipson0.1/server/node_modules/graphql/validation/validate.js:55:35)
    at doRunQuery (/mnt/c/Users/chisi/coding/tipson0.1/server/node_modules/apollo-server-core/dist/runQuery.js:111:42)
    at /mnt/c/Users/chisi/coding/tipson0.1/server/node_modules/apollo-server-core/dist/runQuery.js:21:56
    at process._tickCallback (internal/process/next_tick.js:68:7)
Error: The type of Mutation.createLeague(clubs:) must be Input Type but got: Club.

The type of Mutation.createClub(leagues:) must be Input Type but got: League.
    at assertValidSchema (/mnt/c/Users/chisi/coding/tipson0.1/server/node_modules/graphql/type/validate.js:78:11)
    at Object.validate (/mnt/c/Users/chisi/coding/tipson0.1/server/node_modules/graphql/validation/validate.js:55:35)
    at doRunQuery (/mnt/c/Users/chisi/coding/tipson0.1/server/node_modules/apollo-server-core/dist/runQuery.js:111:42)
    at /mnt/c/Users/chisi/coding/tipson0.1/server/node_modules/apollo-server-core/dist/runQuery.js:21:56
    at process._tickCallback (internal/process/next_tick.js:68:7)

0 个答案:

没有答案