使用flaskgraphhq返回结果字段列表

2024-04-27 03:31:58 发布

您现在位置:Python中文网/ 问答频道 /正文

假设我在查询中使用Graphene.Field定义了一个字段project。现在,根据传入的查询,结果可能是单个项目对象或项目对象列表:

class Query(graphene.ObjectType):

   project = graphene.Field(Project,..) # Project is a class defined  elsewhere

   def resolve_project(self, args, info):
     # Implementation

如何从Flask-graphql应用程序返回项目列表作为响应?在


Tags: 项目对象projectfield列表定义isquery