servant-github-webhook icon indicating copy to clipboard operation
servant-github-webhook copied to clipboard

Missing `Reflect` instances for new event types

Open evanrelf opened this issue 5 years ago • 0 comments

I noticed the Reflect typeclass is missing instances for the new event types from the github library.

Missing instances
diff --git a/src/Servant/GitHub/Webhook.hs b/src/Servant/GitHub/Webhook.hs
index d3c862a..f7bd93e 100644
--- a/src/Servant/GitHub/Webhook.hs
+++ b/src/Servant/GitHub/Webhook.hs
@@ -411,21 +411,42 @@ instance Reflect 'WebhookCheckRunEvent where
 instance Reflect 'WebhookCommitCommentEvent where
   reflect _ = WebhookCommitCommentEvent
 
+instance Reflect 'WebhookContentReferenceEvent where
+  reflect _ = WebhookContentReferenceEvent
+
 instance Reflect 'WebhookCreateEvent where
   reflect _ = WebhookCreateEvent
 
 instance Reflect 'WebhookDeleteEvent where
   reflect _ = WebhookDeleteEvent
 
+instance Reflect 'WebhookDeployKeyEvent where
+  reflect _ = WebhookDeployKeyEvent
+
 instance Reflect 'WebhookDeploymentEvent where
   reflect _ = WebhookDeploymentEvent
 
 instance Reflect 'WebhookDeploymentStatusEvent where
   reflect _ = WebhookDeploymentStatusEvent
 
+instance Reflect 'WebhookDownloadEvent where
+  reflect _ = WebhookDownloadEvent
+
+instance Reflect 'WebhookFollowEvent where
+  reflect _ = WebhookFollowEvent
+
 instance Reflect 'WebhookForkEvent where
   reflect _ = WebhookForkEvent
 
+instance Reflect 'WebhookForkApplyEvent where
+  reflect _ = WebhookForkApplyEvent
+
+instance Reflect 'WebhookGitHubAppAuthorizationEvent where
+  reflect _ = WebhookGitHubAppAuthorizationEvent
+
+instance Reflect 'WebhookGistEvent where
+  reflect _ = WebhookGistEvent
+
 instance Reflect 'WebhookGollumEvent where
   reflect _ = WebhookGollumEvent
 
@@ -444,15 +465,45 @@ instance Reflect 'WebhookIssueCommentEvent where
 instance Reflect 'WebhookIssuesEvent where
   reflect _ = WebhookIssuesEvent
 
+instance Reflect 'WebhookLabelEvent where
+  reflect _ = WebhookLabelEvent
+
+instance Reflect 'WebhookMarketplacePurchaseEvent where
+  reflect _ = WebhookMarketplacePurchaseEvent
+
 instance Reflect 'WebhookMemberEvent where
   reflect _ = WebhookMemberEvent
 
+instance Reflect 'WebhookMembershipEvent where
+  reflect _ = WebhookMembershipEvent
+
+instance Reflect 'WebhookMetaEvent where
+  reflect _ = WebhookMetaEvent
+
+instance Reflect 'WebhookMilestoneEvent where
+  reflect _ = WebhookMilestoneEvent
+
+instance Reflect 'WebhookOrganizationEvent where
+  reflect _ = WebhookOrganizationEvent
+
+instance Reflect 'WebhookOrgBlockEvent where
+  reflect _ = WebhookOrgBlockEvent
+
 instance Reflect 'WebhookPageBuildEvent where
   reflect _ = WebhookPageBuildEvent
 
 instance Reflect 'WebhookPingEvent where
   reflect _ = WebhookPingEvent
 
+instance Reflect 'WebhookProjectCardEvent where
+  reflect _ = WebhookProjectCardEvent
+
+instance Reflect 'WebhookProjectColumnEvent where
+  reflect _ = WebhookProjectColumnEvent
+
+instance Reflect 'WebhookProjectEvent where
+  reflect _ = WebhookProjectEvent
+
 instance Reflect 'WebhookPublicEvent where
   reflect _ = WebhookPublicEvent
 
@@ -462,15 +513,36 @@ instance Reflect 'WebhookPullRequestReviewCommentEvent where
 instance Reflect 'WebhookPullRequestEvent where
   reflect _ = WebhookPullRequestEvent
 
+instance Reflect 'WebhookPullRequestReviewEvent where
+  reflect _ = WebhookPullRequestReviewEvent
+
 instance Reflect 'WebhookPushEvent where
   reflect _ = WebhookPushEvent
 
+instance Reflect 'WebhookRegistryPackageEvent where
+  reflect _ = WebhookRegistryPackageEvent
+
 instance Reflect 'WebhookReleaseEvent where
   reflect _ = WebhookReleaseEvent
 
+instance Reflect 'WebhookRepositoryImportEvent where
+  reflect _ = WebhookRepositoryImportEvent
+
+instance Reflect 'WebhookRepositoryVulnerabilityAlertEvent where
+  reflect _ = WebhookRepositoryVulnerabilityAlertEvent
+
+instance Reflect 'WebhookSecurityAdvisoryEvent where
+  reflect _ = WebhookSecurityAdvisoryEvent
+
+instance Reflect 'WebhookStarEvent where
+  reflect _ = WebhookStarEvent
+
 instance Reflect 'WebhookStatusEvent where
   reflect _ = WebhookStatusEvent
 
+instance Reflect 'WebhookTeamEvent where
+  reflect _ = WebhookTeamEvent
+
 instance Reflect 'WebhookTeamAddEvent where
   reflect _ = WebhookTeamAddEvent

I'm assuming this is because servant-github-webhook aims to support github >= 0.15. Would it be possible to support these new event types? I imagine this could be done in a couple ways:

  1. Bump the min bound on github to 0.22 (I believe that's the latest version that adds new event types)

  2. Use -XCPP to conditionally include the instances, e.g.

    #if MIN_VERSION_github(0,22)
    instance Reflect 'WebhookTeamEvent where
      reflect _ = WebhookTeamEvent
    #endif
    

For the moment I'm using a patched version of servant-github-webhook in my project to include these instances.

evanrelf avatar May 09 '20 18:05 evanrelf