elixir - 长生不老药苦艾酒 input_object
问题描述
为什么 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.",
解决方案
请尝试在蛇形案例中使用原子来定义输入对象:
input_object :vehicle_detail do
field(:registration_no, :string)
field(:image_url, :string)
end
推荐阅读
- python - 熊猫在两个数字之间填充 nan
- google-cloud-platform - 如果我将 Python 脚本用于 Google Product Search API,如何指定 max_results 参数?
- perl - Perl 递归解释
- python - 无法识别事件消息
- javascript - 如何禁用和启用标签点击
- kubernetes - Kubernetes RBAC - 允许端口转发,但禁止手动创建 Pod
- ruby-on-rails - Rails Github Action 无法填写动作文本
- c# - 如何使用 JBDC/ODBC 从 c# 代码连接到 Databricks 表?
- apache - apache 2.4 中 mod_lua 中的 TCP 超时设置
- json - 大家好, 如何在回收站视图中添加微调器