Fix broken GraphQL queries due to editing Author struct
This commit is contained in:
parent
42155c7d2d
commit
1440fd81a1
3 changed files with 8 additions and 7 deletions
|
|
@ -104,8 +104,9 @@ type Owner struct {
|
|||
}
|
||||
|
||||
type Author struct {
|
||||
ID string `json:"id,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
// adding these breaks generated GraphQL requests
|
||||
//ID string `json:"id,omitempty"`
|
||||
//Name string `json:"name,omitempty"`
|
||||
Login string `json:"login"`
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ func shortenQuery(q string) string {
|
|||
var issueComments = shortenQuery(`
|
||||
comments(first: 100) {
|
||||
nodes {
|
||||
author{login,...on User{id,name}},
|
||||
author{login},
|
||||
authorAssociation,
|
||||
body,
|
||||
createdAt,
|
||||
|
|
@ -177,11 +177,11 @@ func PullRequestGraphQL(fields []string) string {
|
|||
for _, field := range fields {
|
||||
switch field {
|
||||
case "author":
|
||||
q = append(q, `author{login,...on User{id,name}}`)
|
||||
q = append(q, `author{login}`)
|
||||
case "mergedBy":
|
||||
q = append(q, `mergedBy{login,,...on User{id,name}}`)
|
||||
q = append(q, `mergedBy{login}`)
|
||||
case "headRepositoryOwner":
|
||||
q = append(q, `headRepositoryOwner{id,login,,...on User{name}}`)
|
||||
q = append(q, `headRepositoryOwner{id,login,...on User{name}}`)
|
||||
case "headRepository":
|
||||
q = append(q, `headRepository{id,name}`)
|
||||
case "assignees":
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ func TestPullRequestGraphQL(t *testing.T) {
|
|||
{
|
||||
name: "fields with nested structures",
|
||||
fields: []string{"author", "assignees"},
|
||||
want: "author{login,...on User{id,name}},assignees(first:100){nodes{id,login,name},totalCount}",
|
||||
want: "author{login},assignees(first:100){nodes{id,login,name},totalCount}",
|
||||
},
|
||||
{
|
||||
name: "compressed query",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue