shurcooL / githubv4

Package githubv4 is a client library for accessing GitHub GraphQL API v4 (https://docs.github.com/en/graphql).
MIT License
1.1k stars 89 forks source link

Field 'bypassPullRequestActorIds' doesn't exist on type 'BranchProtectionRule' #98

Closed jtyr closed 2 years ago

jtyr commented 2 years ago

I'm getting an error:

{
 "errors": [
  {
   "path": [
    "query",
    "node",
    "... on BranchProtectionRule",
    "bypassPullRequestActorIds"
   ],
   "extensions": {
    "code": "undefinedField",
    "typeName": "BranchProtectionRule",
    "fieldName": "bypassPullRequestActorIds"
   },
   "locations": [
    {
     "line": 1,
     "column": 635
    }
   ],
   "message": "Field 'bypassPullRequestActorIds' doesn't exist on type 'BranchProtectionRule'"
  }
 ]
}

when trying to use updated API from your last commit requested via issue #97. I think that they have updated the API again and now there is bypassPullRequestAllowances instead of the bypassPullRequestActorIds as documented here.

Please could you re-generate your code again?

dmitshur commented 2 years ago

The generated code includes enums in enum.go, and convenience input structs in input.go. The field bypassForcePushActorIds was added to CreateBranchProtectionRuleInput and UpdateBranchProtectionRuleInput as mentioned in https://docs.github.com/en/graphql/overview/changelog#schema-changes-for-2022-01-04, which are included in commit 0707a5a905430565886a6e4994b0f6b926874b0e.

The error you show means the query is doing something wrong, and it's not related to the generated code.

jtyr commented 2 years ago

The query seems to be this:

{
  "query": "query($id:ID!){node(id: $id){... on BranchProtectionRule{repository{id,name},pushAllowances(first: 100){nodes{actor{... on App{id,name},... on Team{id,name},... on User{id,name}}}},reviewDismissalAllowances(first: 100){nodes{actor{... on Team{id,name},... on User{id,name}}}},allowsDeletions,allowsForcePushes,dismissesStaleReviews,id,isAdminEnforced,pattern,requiredApprovingReviewCount,requiredStatusCheckContexts,requiresApprovingReviews,requiresCodeOwnerReviews,requiresCommitSignatures,requiresLinearHistory,requiresConversationResolution,requiresStatusChecks,requiresStrictStatusChecks,restrictsPushes,restrictsReviewDismissals,bypassPullRequestActorIds}}}",
  "variables": {
    "id": "BPR_kwDoGMmQuc3BZ8ZT"
  }
}

I don't understand GraphQL so I cannot say what's wrong there ;o( I just thought that the bypassPullRequestActorIds should be listed here and it isn't.

jtyr commented 2 years ago

Problem solved after giving me hint in my feature branch! :heart: