githubv4
githubv4 copied to clipboard
PullRequest lacks IsDraft field
The IsDraft field appears to exist for PullRequests in the graphql v4 docs:

However, when querying for it I am given this response: GHE GraphQL query error: Field 'isDraft' doesn't exist on type 'PullRequest'
I'm running GHE 2.20.7 and the April 13th, 2020 commit/release of this repo. This information is available via the v3 API.
Googling around a little showed that some folks were having to use a preview header to get this data via v4. But that information was a little dated.
Any suggestions on how we could add support for this here?
I'm running GHE 2.20.7
You should use the Versions dropdown to select documentation for that version:

It'll take you to:
https://developer.github.com/enterprise/2.20/v4/object/pullrequest/#isdraft
It's documented for that version that it's currently in preview and requires an Accept header for "Draft Pull Requests Preview" to provided:
https://developer.github.com/enterprise/2.20/v4/previews/#draft-pull-requests-preview
The tracking issue for schema support preview is #34, but there hasn't been recent progress there. You should be able to use a custom http.RoundTripper
wrapper to insert that header as an interim solution.
Adding a RoundTripper with that header definitely did the trick, btw.