小编Dan*_*ili的帖子

不能用字符串数组编写突变

不能在具有列表标量类型的 graphql 操场中使用 set。

我已经创建了我的 Prisma datamodel.graphql 并部署了它。我的运动类型中的一个字段是运动列表。我使用列表标量类型来定义这个字段,并在我的mutation.js 文件中写入了伴随的mutation。当我尝试在我的 graphql 操场中添加新练习时,出现此错误。

{
  "data": null,
  "errors": [
    {
      "message": "Variable \"$_v0_data\" got invalid value {\"name\":\"split squat 3\",\"movement\":[\"push\",\"pull\"],\"liked\":false}; Field \"0\" is not defined by type ExerciseCreatemovementInput at value.movement.\nVariable \"$_v0_data\" got invalid value {\"name\":\"split squat 3\",\"movement\":[\"push\",\"pull\"],\"liked\":false}; Field \"1\" is not defined by type ExerciseCreatemovementInput at value.movement.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "createExercise"
      ]
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

这是我在 graphql 操场上写的突变。

mutation {
  createExercise(
    name: "split squat 3"
    movement: …
Run Code Online (Sandbox Code Playgroud)

javascript graphql prisma-graphql

5
推荐指数
1
解决办法
1269
查看次数

标签 统计

graphql ×1

javascript ×1

prisma-graphql ×1