contentful-labs / gqli.rb

Ruby GraphQL Client for Humans
MIT License
211 stars 18 forks source link

Problems with Github GraphQL #14

Open maogaz opened 3 years ago

maogaz commented 3 years ago

Im having problems using the gem to make queries with nodes inside. The next query doesnt work:

github_gql = GQLi::Github.create(github_access_token)
query = GQLi::DSL.query{
  organization(login: owner) {
    repository(name: name) {
      refs(last: 100, refPrefix: "refs/heads/") {
        totalCount ##-> This works
        nodes { ##-> Here doesnt work
          name
        }
      }
    }
  }
}
data = github_gql.execute(query)

But the next one works:

github_gql = GQLi::Github.create(github_access_token)
query = GQLi::DSL.query{
      organization(login: owner) {
        repository(name: name) {
          pullRequests(last: 100) {
            edges {
              node { ##-> It doesnt fall here
                headRefName
                commits(first: 100) {
                  totalCount
                  nodes{ ##-> it doesnt fall here
                    commit{
                      message
                      author{
                        user{ 
                          login
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
data = github_gql.execute(query)

With owner, name and github_access_token as parameters.

dlitvakb commented 3 years ago

What is the error?

maogaz commented 3 years ago

For example, i want to get all the branches of a repository, this is the Graphql Explorer query that works:

image ¨ And this is my query in my Ruby on Rails project:

image

and this is the error:

Inside refs,nodes or node it can't be read, and i don't know why