【发布时间】:2019-11-18 03:27:27
【问题描述】:
我在 python 中使用石墨烯。
假设我有以下架构:
extends type Query {
a(search:String):A
}
type A {
b:B
important_info:ID
}
type B {
fieldone: String
fieldtwo: String
}
现在我想查询:
query {
a(search:"search string") {
b {
fieldone
}
}
}
但是fieldone 是基于important_info。
我的班级B 是这样的:
class B(graphene.ObjectType):
fieldone = graphene.String()
fieldtwo = graphene.String()
def resolve_fieldone(self,info):
# Here I want access to important_info, but I don't know how ...
return "something based on important_info"
如何从fieldone 的解析器中访问important info?
【问题讨论】: