machine-readable, always up-to-date GitHub Webhooks specifications
Download the latest specification at unpkg.com/@octokit/webhooks-schemas/schema.json
To get the JSON schema for webhook payloads, require the @octokit/webhooks-schemas
package.
// Use Node.js require:
const SCHEMA = require("@octokit/webhooks-schemas");
// Or ESM/TypeScript import:
import SCHEMA from "@octokit/webhooks-schemas";
When running in strict
mode, ajv
will throw an "unknown keyword" error if it
encounters any keywords that have not been defined.
This schema currently uses custom keywords provided by ajv-formats
, along with
the custom keyword tsAdditionalProperties
.
Here is an example of how you can set this up:
import type { WebhookEvent } from "@octokit/webhooks-types";
import * as githubWebhookSchema from "@octokit/webhooks-schemas";
import Ajv from "ajv";
import addFormats from "ajv-formats";
const ajv = new Ajv({ strict: true });
addFormats(ajv);
ajv.addKeyword("tsAdditionalProperties");
const validate = ajv.compile<WebhookEvent>(githubWebhookSchema);
- octokit/graphql-schema – GitHub’s GraphQL Schema with validation
- octokit/openapi – GitHub REST API route specifications
- octokit/app-permissions – GitHub App permission specifications