-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"issues.labeled" event lacks "payload.label" property type #94
Comments
@btorresgil @gr2m Do you mind if I draft a PR for this once we finish the development here? |
The original problem was likely resolved via octokit/webhooks#85, could you verify @btorresgil @dominguezcelada? I still agree that parsing the payload would be better than the examples. Ideally we would do both in order to find inconsistencies in the documentation, too. Because docs tend to get out of date, while the example payloads are recently recorded. |
Yes, now the payload received when Lines 3087 to 3095 in 0f5c95e
@gr2m Do you want me to create an issue for this (tagging all the related ones) and from there we discuss how to tackle it? |
Sounds good, thanks for your help! |
Thanks for confirming! I'll close the issue as the original problem has been addressed |
This issue depends on octokit/webhooks#43. It is related to #30 .
In the generated webhook schema there is only
name
,actions
, andexamples
for each webhook. So this library generates the TypeScript types using @gimenete/type-writer from theexamples
in the schema.This means that critical payload values that exist in the webhook but are not in the examples are not accessible in TypeScript without some terrible escape hatches.
For example, in an IssuesEvent, a developer trying to access the
label
payload property would not get prompted that it exists:And entering it anyway results in a compiler error, even though the property exists in the webhook:
The only workaround I've found is to override the types to add the missing properties when they are needed, or escape hatch with
any
:Since using
any
removes any type checking, it kinda defeats the purpose of having a schema. So it would be great if the schema could be complete enough to include all the payload parameters in the documentation, and this library could leverage those parameters to build the types.Thanks!
The text was updated successfully, but these errors were encountered: