我正在使用graphene-django==2.2.0
。我如何将石墨烯反序列化一个突变输入?
最终目标是,当我开始使用id
方法中的mutate_and_get_payload
字段时,id
字段将已经被DO_X
函数解析< / p>
class Mutation(relay.ClientIDMutation):
class Input:
id = graphene.ID(required=True)
foo = graphene.List(of_type=Bar)
@classmethod
def mutate_and_get_payload(cls, root, info, **input):
input['foo']['id'] - should be formatted already DO_X
class CustomID(graphene.Scalar):
# serialize = str
# parse_value = str
@staticmethod
def serialize(ast):
return DO_X(ast)
@staticmethod
def parse_value(ast):
return DO_X(ast)
@staticmethod
def parse_literal(ast):
return DO_X(ast)
class Bar(graphene.ObjectType):
id = CustomID()
other_field = graphene.String()