Python 3.x 我如何接受字典/对象作为石墨烯(GraphQL)突变的输入?

Python 3.x 我如何接受字典/对象作为石墨烯(GraphQL)突变的输入?,python-3.x,graphql,graphene-python,graphene-django,Python 3.x,Graphql,Graphene Python,Graphene Django,你可以这样做- [ {username: "bob", "amount": 80}, {username: "job", "amount": 100} ] 并在你的变异中使用InputType,如下所示 class PaymentInputType(graphene.InputObjectType): username = graphene.String() amount = graphene.Int() 可能重复的 class PaymentInputType(gr

你可以这样做-

[ {username: "bob", "amount": 80}, {username: "job", "amount": 100} ]
并在你的变异中使用InputType,如下所示

class PaymentInputType(graphene.InputObjectType):
      username = graphene.String()
      amount = graphene.Int()
可能重复的
class PaymentInputType(graphene.InputObjectType):
      username = graphene.String()
      amount = graphene.Int()
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)