-
Notifications
You must be signed in to change notification settings - Fork 43
feat: generate types from schema #255
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
Conversation
| "@types/cheerio": "^0.22.23", | ||
| "@types/json-diff": "^0.5.0", | ||
| "@types/json-schema": "^7.0.6", | ||
| "@types/lodash": "^4.14.167", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed as a fix until bcherny/json-schema-to-typescript#362 is landed.
|
can't statically import a file that's generated by a build command 🤦 |
gr2m
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think eventually I'd move the event types into a different repository, because they are only relevant to the JavaScript Octokit projects, but for now we can add it here.
|
Could you add a section to the README on how to import the types? It would be good to show how to import the type for a specific event payload. That would answer @AlCalzone's question at probot/probot#1456 |
|
@gr2m done - I'll merge this shortly, and start on my refactor of webhooks.js & co 🎉 |
|
🎉 This PR is included in version 3.35.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |

This is branched off #252 to avoid me having to do an ugly rebase - ideally that should be merged first to make this review-able
Look, it's type generation!
Also ported over the code to generate the
EventPayloadMapinterface that can be used to do dynamic mapping.I've made this a draft for now as while I think it's ready for review, it requires #252 and I think we should discuss how we're handling the build flow - I think it could benefit from a bit of a revision now that we've got a bit of a chain going.In particular, do we want to check-in theschema.d.ts? Personally I think it would make reviewing easier, but we currently don't check-in theschema.jsonwhich is required by this script.(this is currently written in TS, but can convert to JS easily if it looks like #254 isn't going to be merged for a bit)