【问题标题】:Github graphQL OrderByGithub graphQL OrderBy
【发布时间】:2017-01-25 20:29:25
【问题描述】:

我有一个 GraphQL 查询。 我不明白为什么它不起作用。

{
  repositoryOwner(login: "Naramsim") {
    login
    repositories(first: 3, isFork: true, orderBy: {field: CREATED_AT}) {
      edges {
        node {
          description
        }
      }
    }
  }
}

Link

【问题讨论】:

    标签: github graphql github-graphql


    【解决方案1】:

    你有一个错误

    Argument 'orderBy' on Field 'repositories' has an invalid value.
    Expected type 'RepositoryOrder'.
    

    您忘记指定标记为强制的方向。这将起作用:

    {
      repositoryOwner(login: "Naramsim") {
        login
        repositories(first: 3, isFork: true,  orderBy: {field: CREATED_AT, direction: ASC}) {
          edges {
            node {
              description
            }
          }
        }
      }
    }
    

    【讨论】:

    • 我可以在不分页的情况下获取所有存储库吗?
    • @DaviWesley 我认为最好在一个单独的问题中提出,如果它还没有被问过(它可能已经问过)
    • 嗨,Alex,如果我想用下拉菜单更改 created_at 字段怎么办?像名字等。我需要动态的东西。
    猜你喜欢
    • 2019-06-30
    • 2021-09-08
    • 2018-09-02
    • 2021-02-25
    • 2018-04-11
    • 2018-01-12
    • 2018-11-14
    • 2020-01-12
    • 2018-08-27
    相关资源
    最近更新 更多