【发布时间】:2018-12-25 05:46:50
【问题描述】:
为什么 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.",
【问题讨论】:
-
intput_object中有错字,是故意的吗? -
得到错误的原因。 intput_object - :vehicle_detail 具有驼峰式字段名称。换成蛇皮后,它起作用了。
-
@JonasDellinger 感谢更新了问题,这只是一个错字,但实际代码没有错字。