无法查询类型为“rootVariation”的字段“furniture”

2024-04-28 23:43:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用下面的查询在graphiql中创建一个furniture对象,其中我得到一个错误Cannot query field“furniture”on type“rootvariation”。在

这是我为创建家具对象所做的查询

mutation {
  newFurniture(input: {name: "graphFurniture", content: "This furniture is cool", category: "Bedroom Items"}) {
    clientMutationId
  }
    furniture{ // error is shown here 
            name
      content
      category {
        name
      }
    }
}

这是我的变异密码

^{pr2}$

为什么我会犯这样的错误?在


Tags: 对象namefieldisontype错误content
1条回答
网友
1楼 · 发布于 2024-04-28 23:43:32

不能在“变异”范围内查询家具。这是两个独立的操作:

mutation {
  newFurniture(input: {name: "graphFurniture", content: "This furniture is cool", category: "Bedroom Items"}) {
    clientMutationId
  }
}

query {
  furniture {
    name
    content
    category {
      name
    }
  }
}

相关问题 更多 >