xpt
xpt

Reputation: 23054

Github GraphQL Repository Query, using two objects

How to use more than one objects when querying Github GraphQL?

The following will break if the 2nd object is uncommented:

query {
  repository(owner:"rails", name:"rails") {
    object(expression:"master") {
      ... on Commit {
        history {
          totalCount
        }
      }
    }
    # object(expression: "master:README.md") {... on Blob {byteSize}}
  }
}

How to make it working? Thx

Upvotes: 4

Views: 338

Answers (1)

Ben
Ben

Reputation: 5139

Use alias:

query {
  repository(owner:"rails", name:"rails") {
    object(expression:"master") {
      ... on Commit {
        history {
          totalCount
        }
      }
    },
    second_object: object(expression: "master:README.md") {... on Blob {byteSize}}
  }
}

Upvotes: 6

Related Questions