Skip to content

Commit 1440fd8

Browse files
committed
Fix broken GraphQL queries due to editing Author struct
1 parent 42155c7 commit 1440fd8

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

api/queries_issue.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,9 @@ type Owner struct {
104104
}
105105

106106
type Author struct {
107-
ID string `json:"id,omitempty"`
108-
Name string `json:"name,omitempty"`
107+
// adding these breaks generated GraphQL requests
108+
//ID string `json:"id,omitempty"`
109+
//Name string `json:"name,omitempty"`
109110
Login string `json:"login"`
110111
}
111112

api/query_builder.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func shortenQuery(q string) string {
2121
var issueComments = shortenQuery(`
2222
comments(first: 100) {
2323
nodes {
24-
author{login,...on User{id,name}},
24+
author{login},
2525
authorAssociation,
2626
body,
2727
createdAt,
@@ -177,11 +177,11 @@ func PullRequestGraphQL(fields []string) string {
177177
for _, field := range fields {
178178
switch field {
179179
case "author":
180-
q = append(q, `author{login,...on User{id,name}}`)
180+
q = append(q, `author{login}`)
181181
case "mergedBy":
182-
q = append(q, `mergedBy{login,,...on User{id,name}}`)
182+
q = append(q, `mergedBy{login}`)
183183
case "headRepositoryOwner":
184-
q = append(q, `headRepositoryOwner{id,login,,...on User{name}}`)
184+
q = append(q, `headRepositoryOwner{id,login,...on User{name}}`)
185185
case "headRepository":
186186
q = append(q, `headRepository{id,name}`)
187187
case "assignees":

api/query_builder_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func TestPullRequestGraphQL(t *testing.T) {
2121
{
2222
name: "fields with nested structures",
2323
fields: []string{"author", "assignees"},
24-
want: "author{login,...on User{id,name}},assignees(first:100){nodes{id,login,name},totalCount}",
24+
want: "author{login},assignees(first:100){nodes{id,login,name},totalCount}",
2525
},
2626
{
2727
name: "compressed query",

0 commit comments

Comments
 (0)