githubgraphqlgithub-graphql

Github graphQL OrderBy


I have a GraphQL query. I cannot understand why it is not working.

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

Link


Solution

  • You've got an error

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

    You forget to specify direction which is marked as mandatory. This will work:

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