Skip to content

Adapt the types to the OpenAPI spec types #840

@wolfy1339

Description

@wolfy1339

The types will need to be adapted to make use of the OpenAPI spec.

We can make use of my package @wolfy1339/openapi-webhooks-types to help with the transition.


Some points which I see as potential issues:

The types format is not the same, the webhooks are not on their own interface like they are currently in @octokit/webhooks-types.
In the OpanAPI spec types, the way to get a webhook resembles like so:

import { webhooks } from `@wolfy1339/openapi-webhooks-types`;

type TEventIdentifier = "check-suite-completed";
type CheckSuiteCompletedEvent = webhooks[TEventIdentifier]["post"]["requestBody"]["content"]["application/json"];

Each webhook definition's name is made like so in reference to the names we accept in the event handlers

const webhookIdentifier = "check_suite.completed".replaceAll(/_|\./g, "-");
// webhookIdentifier: check-suite-completed

The name is seperated by - and dots are replaced by -



There are currently no types for events and all their possible actions, eg: check_suite.

I'm not sure how we can get around this easily without having to resort to a lookup table. If you have any ideas, please comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions