Github graphQL OrderBy

Github graphQL OrderBy

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

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

Link

你有一个错误

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
        }
      }
    }
  }
}