Open iphydf opened 7 years ago
Fixed by PR #303 if it lands.
This should probably be closed and point to https://github.com/onrock-eng/github-webhooks
No, probably not, because that package is very incomplete.
Compare: https://github.com/onrock-eng/github-webhooks/blob/master/src/GitHub/Data/Webhooks/Events.hs#L852 with: https://github.com/TokTok/github-tools/blob/master/src/GitHub/Types/Events/PullRequestEvent.hs#L15
The latter is complete. As you can see, many fields are missing from the former.
The discussion in the linked PR suggests events are out of scope of this package. That was my point which I intended more as a question. So: should this ticket be closed as out of scope / won't fix with a pointer to other interesting packages or should we work to merge events into this package?
A solution might be to file a completeness bug against the onrock-eng repo, keep this ticket open and hope for a PR, just use TokTok's repo, or something else.
I was unaware github-webhooks was incomplete. The fields are sourced from the documentation/sample payloads provided from GitHub [1].
Some information is nested multiple levels deep in the data which is structured to match the JSON, so if they perform flattening that might explain the inconsistency you see.
[1] https://github.com/onrock-eng/github-webhooks/blob/master/fixtures/pull-request-event.json
If not, feel free to file a bug against github-webhooks and we’ll take a look before 1.0.0
It doesn't seem to have any way to test for completeness. Our github event types are tested for completeness every day by ensuring that serialising the haskell data structure results in the same json object as the input.
I'm not sure what you mean by flattening, but toktok's github data structures are pretty much a dumb translation of whatever github feeds us, updated whenever that changes.
Randomly looking at one of the data structures in github-webhooks (the pull request event), I see HookPullRequest with assignee, but not assignees, which is something github added about a year ago so you can have multiple. It also doesn't have requested_reviewers or requested_teams or maintainer_can_modify
or author_association
(besides the things it has commented out).
I'm exposing a github webhook in a web service I'm working on. I'm using the github-webhook-handler, which uses github-types package, which is incomplete (it has 1 field implemented per event) and broken ("push" for example expects a "size" field, but the JSON payload doesn't have one).
This now effectively means one of three things:
I don't have time for 2. and 3. I'm not sufficiently motivated to do 1. So I'll wait. I'm happy to provide sample inputs for each of the possible payloads.