Community contributed webhook payload schemas in JSON schema format
> 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.
``js
// 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 withtsAdditionalProperties
the custom keyword .
Here is an example of how you can set this up:
`ts
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
``
- octokit/graphql-schema – GitHub’s
GraphQL Schema with validation
- octokit/openapi – GitHub REST API route
specifications
- octokit/app-permissions – GitHub
App permission specifications