mutation{
createPayment(p_obj={"bob": 80, "job": 100}){
<fields here>
}
}
我可以找到的是接受对象列表作为输入,例如:
[ {username: "bob", "amount": 80}, {username: "job", "amount": 100} ]
答案 0 :(得分:3)
您可以执行以下操作-
class PaymentInputType(graphene.InputObjectType):
username = graphene.String()
amount = graphene.Int()
并按如下所示在您的突变中使用InputType。
class CreatePayment(graphene.Mutation):
class Arguments:
input = PaymentInputType(required=True)
ok = graphene.Boolean()
@staticmethod
def mutate(root, info, input):
# save the changes here
return CreatePayment(ok=True)