我是 Graphql 的新手,我想知道是否有办法在关系中返回空数组而不是 null 。让我们选择 User 和 Post 的经典示例
type User {
id: ID!
posts: [Post]
}
Type Post {
id: ID!
comment: String!
}
Run Code Online (Sandbox Code Playgroud)
当我对没有任何帖子的用户进行查询时,我希望在 posts 属性上有一个空数组,但现在我得到了null,我该怎么做?提前致谢。
graphql ×1