【问题标题】:Understanding the `parent` parameter in resolver methods while using Graphql python在使用 Graphql python 时理解解析器方法中的`parent`参数
【发布时间】:2020-02-11 03:45:08
【问题描述】:

我一直在尝试在 Graphql 中使用 parent。希望有人给我他们自己对它的理解以及解析器方法。我还阅读了 docs

class Person(ObjectType):

    # First_name is a field with a resolver that fetches data in our schema
    first_name = String()
    last_name = String()

    def resolve_full_name(parent, info):
        return f"{parent.first_name} {parent.last_name}"

【问题讨论】:

    标签: python graphql graphene-python


    【解决方案1】:

    所以 Parent 实际上是指解析器运行后的值对象,默认情况下它设置为 None。参考this

    【讨论】:

      猜你喜欢
      • 2019-11-06
      • 2022-01-12
      • 2015-03-04
      • 2018-10-21
      • 2018-07-01
      • 2018-10-27
      • 2019-03-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多