shurcooL / githubv4

Package githubv4 is a client library for accessing GitHub GraphQL API v4 (https://docs.github.com/en/graphql).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nodes missing from results

brejoc opened this issue · comments

I'm trying to query issues together with their labels and columns. In order to do that, I've created this query structure:

	var query struct {
		Repository struct {
			Issues struct {
				TotalCount int
				PageInfo   struct {
					StartCursor githubv4.String
					EndCursor   githubv4.String
					HasNextPage bool
				}
				Nodes []struct {
					CreatedAt    githubv4.DateTime
					ClosedAt     githubv4.DateTime
					Title        githubv4.String
					Url          githubv4.URI
					ProjectCards struct {
						Nodes []struct {
							id     githubv4.ID
							Column struct {
								name githubv4.String
							} `graphql:"column"`
						} `graphql:"nodes"`
					} `graphql:"projectCards"`
					Labels struct {
						Nodes []struct {
							Name githubv4.String
						}
					} `graphql:"labels(first: 100)"`
				}
			} `graphql:"issues(first: 100)"`
		} `graphql:"repository(owner: \"brejoc\", name: \"test\")"`
	}

This repository should return four issues, but githubv4 only returns two of them. While digging through the code I noticed the do() function and printed the query from in.Query. The generated query (when executed in GraphiQL) actually returns the expected four issues. So something seems to happen afterwards.

Here is the query that gets generated:

{repository(owner: "brejoc", name: "test"){issues(first: 100){totalCount,pageInfo{startCursor,endCursor,hasNextPage},nodes{createdAt,closedAt,title,url,projectCards{nodes{id,column{name}}},labels(first: 100){nodes{name}}}}}}

Any hints on where to continue to debug this are very welcome! Thx!

Oh, I forgot to mention that the results back to four again when removing the Labels ProjectCards struct from the query.

Sorry, my fault. If I'd actually show error messages, I'd see that githubv4 complains about name and id. Should of course not be lowercase.