GraphQL - 参数未传递到变异后端

GraphQL - Parameters not being passed to backend in mutation

我刚开始使用 GraphQL 和突变,遇到了这个问题。

当我尝试将数据传递到我的 GraphQL 服务器时,args 参数似乎没有注册我尝试传递的 args。

当我 console.log 它们时,它们显示为 undefined,但该方法正在运行并接收请求。

下面有什么不对的地方吗?我只是在思考它,所以非常感谢任何反馈。

这是我试图从 GraphiQL

运行 查询
mutation {
  addDelivery(
    carrier: "AusPost", 
    goodsDelivered:[],
    receiver: {
      first_name:"ll",
      last_name:"test",
      receiver_email: "bbb@bbb.com.au"
    },
    consignmentNumber:"AAAA000",
    poNumber:"PO0000"
  ) {
    id
    carrier {
      iD
      carrier_name
    }
  }
}

我的架构:

type ReceiverType{
    first_name: String
    last_name: String
    receiver_email: String
}

type ItemType {
    item_type: String,
    quantity: String
}

type Deliveries {
    carrier: Carrier
    consignmentNumber: String
    goodsDelivered: [String]
    id: ID
    items: [ItemType]
    poNumber: String
    receiver: ReceiverType
}

type Carrier{
    iD: ID
    carrier_name: String
}

input Item {
    item_type: String,
    quantity: String
}

type Query {
    deliveries: [Deliveries]
}

input Receiver {
    first_name: String
    last_name: String
    receiver_email: String
}

type Mutation {
    addDelivery(
        carrier: String!,
        consignmentNumber: String!,
        goodsDelivered: [Item]!,
        poNumber: String!,
        receiver: [Receiver]! 
    ) : Deliveries
}

我添加交付解析器

addDelivery: async (parent, args, context, info) => {
    const delivery = new Deliveries({
        receiver: {
            first_name: args.first_name,
            last_name: args.last_name,
            receiver_email: args.receiver_email
        },
        items: args.items,
        consignment_no: args.consignment_no,
        po_number: args.po_number,
        carrier_id: args.carrier_id,
        delivery_id: args.delivery_id
    });

    await delivery.save();
    return delivery;
}

我将签名更改为以下内容并解决了问题。

addDelivery: async ({receiver, items, consignment_no, po_number, carrier_id, delivery_id}) => {