Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 2

[Bug] Graphql V4 languages missing size

Solved! Go to Solution.

Following query gives me the total size in all the languages, which is not really useful.

query {
  repository(owner:"facebook" name:"react") {
    languages(first:50) {
      totalSize #The total size in bytes of files written in that language.
      nodes {
        name
        color
      }
    }
  }
}

But what I'm looking for is something like 

 

query {
  repository(owner:"facebook" name:"react") {
    languages(first:50) {
      nodes {
        totalSize
        name
        color
      }
    }
  }
}

Expecting something similar to quering
https://api.github.com/repos/facebook/react/languages

Is this is a bug or am I missing something here?

 

1 Reply
Highlighted
Solution
GitHub Staff
Message 2 of 2

Re: [Bug] Graphql V4 languages missing size

Hey @chmelevskij!

 

I believe that it is possible to do what you want! Looking at the schema, it looks like the connection between Repositories and Languages does have an "edge type" that includes the number of bytes written in that language in the particular repository. Here's the query that I'm using for Facebook's React Repository:

 

 

{
  repository(owner: "facebook", name: "react") {
    languages(first: 50, orderBy: {field: SIZE, direction: DESC}) {
      edges {
        size
        node {
          name
        }
      }
    }
  }
}

 

 

This gives me the same results as I can see in the REST API, sorted by the number of bytes in each language in descending order. 

 

Let me know if I've misread, and have a great day!