Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 951
Naramsim Avatar asked Sep 17 '16 20:09

Naramsim


People also ask

How do I order links alphabetically in the GraphQL API?

For example, you can order the list of Links alphabetically by their urlor description. For the Hacker News API, you’ll leave it up to the client to decide how exactly it should be sorted and thus include all the ordering options from the Prisma API in the API of your GraphQL server.

What is a GraphQL query?

The query type defines GraphQL operations that retrieve data from the server. For more information, see " About queries ." Note: For user-to-server GitHub App requests, you should use separate queries for issues and pull requests. For example, use the is:issue or is:pull-request filters and their equivalents.

Which is better GraphQL or rest?

where & orderBy Skip Edit on Github GraphQL Fundamentals Introduction GraphQL is the better REST Core Concepts Big Picture (Architecture) Clients

What is the difference between GitHub GraphQL API and REST API?

To create integrations, retrieve data, and automate your workflows, use the GitHub GraphQL API. The GitHub GraphQL API offers more precise and flexible queries than the GitHub REST API.


1 Answers

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         }       }     }   } } 
like image 142
Alexandr Viniychuk Avatar answered Oct 06 '22 12:10

Alexandr Viniychuk