药剂苦艾酒in input_object

时间:2018-07-17 13:37:11

标签: elixir absinthe

为什么苦艾酒中的input_object不起作用?

喜欢

   input_object :vehicle_detail do
    field :registrationNo, :string
    field :imageUrl, :string
   end

  mutation do
    field :create_user, type: :user do
        arg :vehicle_details, :vehicle_detail

        resolve &Resolver.create_employee/2
    end
  end

我尝试过,但是它为以下有效载荷抛出了错误

mutation() {
  employee: createEmployee(vehicleDetails: {
      registrationNo: "AP03EY0096",
      imageUrl: "http://sample.example.com"
  }) {
    id
  }
}

错误

In field \"vehicleDetails\": Expected type \"VehicleDetail\", found $vehicleDetails.\nIn field \"imageUrl\": Unknown field.\nIn field \"registrationNo\": Unknown field.",

1 个答案:

答案 0 :(得分:2)

请尝试使用蛇形原子来定义输入对象:

  input_object :vehicle_detail do
    field(:registration_no, :string)
    field(:image_url, :string)
  end