1

查询 Github GraphQL 时如何使用多个对象?

如果未注释第二个对象,则以下内容将中断:

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

如何让它工作?谢谢

4

1 回答 1

2

使用别名

query {
  repository(owner:"rails", name:"rails") {
    object(expression:"master") {
      ... on Commit {
        history {
          totalCount
        }
      }
    },
    second_object: object(expression: "master:README.md") {... on Blob {byteSize}}
  }
}
于 2018-03-30T23:26:55.540 回答