This document describes the JSON data files used by the language service packages and how they are maintained.
The language service uses several JSON files containing schema definitions, webhook payloads, and other metadata. To reduce bundle size, these files are:
- Optimized at generation time — unused events are dropped, unused fields are stripped, shared objects are deduplicated, property names are interned
- Compacted using a space-efficient format — params use type-based dispatch arrays instead of objects
- Minified at build time — whitespace is removed to produce
.min.jsonfiles
The source .json files are human-readable and checked into the repository. The .min.json files are generated during build and gitignored.
| File | Description |
|---|---|
src/context-providers/events/webhooks.json |
Webhook event payload schemas for autocompletion |
src/context-providers/events/webhooks.objects.json |
Deduplicated shared object definitions referenced by webhooks |
src/context-providers/events/webhooks.strings.json |
Interned property names shared by webhooks and objects |
src/context-providers/events/schedule.json |
Schedule event context data |
src/context-providers/events/workflow_call.json |
Reusable workflow call context data |
src/context-providers/descriptions.json |
Context variable descriptions for hover |
| File | Description |
|---|---|
src/workflow-v1.0.json |
Workflow YAML schema definition |
The webhooks.json, webhooks.objects.json, and webhooks.strings.json files are generated from the GitHub REST API description:
cd languageservice
npm run update-webhooksThis script:
- Fetches webhook schemas from the GitHub API description
- Validates all events are categorized (fails if new events are found)
- Drops events that aren't valid workflow triggers (see Dropped Events)
- Compacts params into a space-efficient array format, keeping only
name,description, andchildParamsGroups(see Compact Format) - Deduplicates shared object definitions into
webhooks.objects.json - Interns duplicate property names into
webhooks.strings.json(see String Interning) - Writes the optimized, pretty-printed JSON files
When GitHub adds a new webhook event, the script will fail with an error like:
ERROR: New webhook event(s) detected!
The following events are not categorized:
- new_event_name
Action required:
1. Check if the event is a valid workflow trigger
2. Add the event to DROPPED_EVENTS or KEPT_EVENTS
To resolve:
-
Edit
languageservice/src/context-providers/events/event-filters.json:- Add to
keptarray if it's a valid workflow trigger - Add to
droppedarray if it's GitHub App or API-only
- Add to
-
Run
npm run update-webhooksand commit the changes
To see all available fields and events before optimization:
npm run update-webhooks -- --allThis generates webhooks.all.json and objects.all.json (gitignored) containing the complete unprocessed data from the GitHub API.
The other JSON files (schedule.json, workflow_call.json, descriptions.json, workflow-v1.0.json) are manually maintained.
At build time, all JSON files are minified (whitespace removed) to produce .min.json versions:
npm run minify-jsonThis runs automatically via prebuild and pretest hooks, so you don't need to run it manually.
The code imports the minified versions:
import webhooks from "./events/webhooks.min.json"
import objects from "./events/webhooks.objects.min.json"
import strings from "./events/webhooks.strings.min.json"CI verifies that generated source files are up-to-date:
- Runs
npm run update-webhooksto regenerate webhooks.json, webhooks.objects.json, and webhooks.strings.json - Checks for uncommitted changes with
git diff --exit-code
The .min.json files are generated at build time and are not committed to the repository.
If the build fails, run cd languageservice && npm run update-webhooks locally and commit the changes.
Webhook events that aren't valid workflow on: triggers are dropped (e.g., installation, ping, member, etc.). These are GitHub App or API-only events.
See dropped array in src/context-providers/events/event-filters.json for the full list.
Params are converted from verbose objects into compact arrays, keeping only the fields needed for autocompletion and hover docs (name, description, childParamsGroups). Unused fields like type, in, isRequired, enum, and default are discarded.
| Format | Meaning |
|---|---|
"name" |
Name only (no description, no children) |
[name, desc] |
Name + description (arr[1] is a string) |
[name, children] |
Name + children (arr[1] is an array) |
[name, desc, children] |
Name + description + children |
The reader uses typeof arr[1] to determine the format: if it's a string, it's a description; if it's an array, it's children.
Example:
// Before (object format)
{
"name": "issue",
"description": "The issue itself.",
"childParamsGroups": [
{ "name": "id" },
{ "name": "title", "description": "Issue title" }
]
}
// After (compact format)
["issue", "The issue itself.", [
"id",
["title", "Issue title"]
]]Property names that appear 2+ times are "interned" into a shared string table (webhooks.strings.json). In the compact arrays, these names are replaced with non-negative numeric indices:
// webhooks.strings.json
["url", "id", "name", ...] // Index 0 = "url", 1 = "id", 2 = "name"
// webhooks.json - uses indices instead of strings
{
"push": {
"default": {
"p": [
[0, "The URL..."], // 0 = "url" from string table
[1, "Unique ID"], // 1 = "id"
2 // 2 = "name" (name-only, no description)
]
}
}
}How to distinguish indices from other values:
- Negative numbers → Object indices:
-1= object 0,-2= object 1, etc. (formula:-(index + 1)) - Non-negative numbers → String indices (references into
webhooks.strings.json) - Literal strings → Singletons (names appearing only once, not interned)
Singletons are kept as literal strings for readability and to avoid the overhead of adding rarely-used names to the string table.
Shared object definitions are extracted into webhooks.objects.json and referenced by negative index:
// webhooks.objects.json
[
["url", "The URL"], // Index 0 (referenced as -1)
["id", "Unique identifier"], // Index 1 (referenced as -2)
[...]
]
// webhooks.json - negative numbers reference objects
{
"push": {
"default": {
"p": [-1, -2, ["ref", "The git ref"]] // -1 = object 0, -2 = object 1
}
}
}This reduces duplication when the same object structure appears in multiple events (e.g., repository, sender, organization).
The optimizations achieve approximately 99% file size reduction:
| Stage | Minified | Gzip |
|---|---|---|
| Original (webhooks.full.json) | 15.8 MB | 968 KB |
| After optimization (combined) | 152 KB | 15.6 KB |
| Reduction | 99% | 98% |