【问题标题】:How to set NonNull to node and edges in connection class?如何将 NonNull 设置为连接类中的节点和边?
【发布时间】:2021-08-01 09:53:42
【问题描述】:

我想将 NonNull 添加到连接的节点和边。

class TestSchema(SQLAlchemyObjectType):
    class Meta:
        model = Test
        interfaces = (relay.Node,)
    id = graphene.ID(required=True)

当我在 Graphql Playground 中查看文档资源管理器时,

在TestSchemaConnection中

edges: [TestSchemaEdge]!

在 TestSchemaEdge 中

node: TestSchema

但我想要“!”括号内不能为空,如下所示。

edges: [TestSchemaEdge!]! 

node: TestSchema!

有没有办法做到这一点?

【问题讨论】:

    标签: graphene-python graphene-sqlalchemy


    【解决方案1】:

    我认为这是不可能的,截至:https://github.com/graphql-python/graphene/issues/968

    似乎已将其作为问题解决,但未解决。

    【讨论】:

    • 正如目前所写,您的答案尚不清楚。请edit 添加其他详细信息,以帮助其他人了解这如何解决所提出的问题。你可以找到更多关于如何写好答案的信息in the help center
    猜你喜欢
    • 2022-01-26
    • 1970-01-01
    • 2021-06-13
    • 1970-01-01
    • 1970-01-01
    • 2016-03-29
    • 2017-05-21
    • 2014-09-04
    • 2014-04-08
    相关资源
    最近更新 更多