根据Graphene文档,如果我们要在实现relay.clientIDMutation
时从用户那里获取输入,那么它需要在输入子类下面,如下所示:
class Foo(relay.clientIDMuation):
class Input:
arg1 = graphene.String()
arg2 = graphene.Sring()
# the return parameters and mutate and get payload method after this
但是,我们也可以指定InputObject类型
class Bar(graphene.InputObjectType):
arg1 = graphene.String()
arg2 = graphene.String()
如果我们要使用普通的graphene突变对象,可以在Arguments子类中使用specify输入
class NewFoo(graphene.Mutation):
class Arguments:
input = Bar()
# return arguments and mutate method after this
当Bar
一个InputObjectType
从relay.clientIDMutation
继承而来的同时仍然能够将clientMutationID作为输入参数传递时,如何将它用于NewFoo突变中的输入属性
class NewFoo(relay.clientIDMutation):
class Attribute:
input = Foo()
# the return parameters and mutate and get payload method after this
注意:我已经尝试添加一个带有上述输入属性的Arguments子类,但当类从relay.clientIDMuation
继承时,这不起作用
您不需要将
class Attribute:
与relay.clientIDMutation
类一起使用试试这个。在启动中继类之前声明该类
在你的接力班里
你的变异应该是这样的
尽管您仍然无法将输入数组传递到此字段
相关问题 更多 >
编程相关推荐