小编Lel*_*ong的帖子

GraphQL-将枚举值直接传递给突变作为参数吗?

给定以下GraphQL类型定义:

const typeDefs = `
  enum Action {
    update
    delete
  }    

  type Mutation {
    doSomething(action: Action)
  }
`;
Run Code Online (Sandbox Code Playgroud)

该查询有效:

const query = `
  mutation($action: Action) {
    doSomething(action: $action)
  }
`
const variables = { action: "update" }
Run Code Online (Sandbox Code Playgroud)

但这不是:

const query = `
  mutation {
    doSomething(action: "update")
  }
`
Run Code Online (Sandbox Code Playgroud)

GraphQL不支持直接将枚举值作为参数传递吗?

enums types graphql

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

标签 统计

enums ×1

graphql ×1

types ×1