【发布时间】:2021-02-25 04:32:03
【问题描述】:
我有以下代码。查询是我的根模式。
如果我只有一个profile,则可以在查询中使用 resolve 方法。但是如果架构太大怎么办?
无论如何要在 Profile 对象类型中移动 resolve_profile 吗?
import graphene
class Query(graphene.ObjectType):
profile = graphene.ObjectType(Profile)
def resolve_profile(self):
return ...
class Profile(graphene.ObjectType):
firstName = graphene.String(graphene.String)
lastName = graphene.String(graphene.String)
【问题讨论】:
-
我不熟悉石墨烯,但我认为 Query 在定义架构时也被视为任何其他对象类型,因此每个字段本身都应该有自己的解析器
标签: python graphql graphene-python