使用graphene-django 3.1.2时GraphQLResolveInfo无field_asts属性问题咨询
问题解答:graphene-django 3.1.2中ResolveInfo导入与
field_asts属性缺失问题 - 你用
GraphQLResolveInfo替代ResolveInfo的做法是正确的。graphene-django 3.x版本依赖的graphql-core 3.x系列中,原ResolveInfo类已被重命名为GraphQLResolveInfo,所以这个导入替换逻辑没问题。 - 出现
'GraphQLResolveInfo' object has no attribute 'field_asts'错误的核心原因:graphql-core 3.x对内部API做了重构,移除了field_asts属性,改用field_nodes作为替代属性。 - 解决方法:将代码中所有访问
info.field_asts的地方替换为info.field_nodes,导入语句保持from graphql import GraphQLResolveInfo as ResolveInfo即可。
内容的提问来源于stack exchange,提问作者Jolly
相关产品推荐
相关产品推荐

