Github graphQL OrderBy

Naramsim picture Naramsim · Sep 17, 2016 · Viewed 22.9k times · Source

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

Answer

Alexandr Viniychuk picture Alexandr Viniychuk · Sep 17, 2016

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