[Schema Inaccuracy] `X-GitHub-Hook-Installation-Target-Type` and `X-GitHub-Hook-Installation-Target-Id` are insufficiently documented (and incorrect)

Open
#7,210 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
openapi
Domain
api

Research direction

Start with the two webhook header schema entries included in this issue and compare them with the linked delivery-headers documentation and previous reports. Verify the valid Target-Type values and the Target-Id mapping for each, then update the schema types and descriptions so the documented values and identifiers are accurate.

Written by the indexing model from the issue text.

Description

feature

Schema Inaccuracy

The schema for these two webhook headers only specifies:

          {
            "name": "X-Github-Hook-Installation-Target-Id",
            "in": "header",
            "example": 123123,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Github-Hook-Installation-Target-Type",
            "in": "header",
            "example": "repository",
            "schema": {
              "type": "string"
            }
          },

the webhooks documentation is not significantly more helpful:

X-GitHub-Hook-Installation-Target-Type: The type of resource where the webhook was created.
X-GitHub-Hook-Installation-Target-ID: The unique identifier of the resource where the webhook was created.

Issue

While some hooks can be distinguished by probing the payload for optional entries like installation or organization entries, not only is this pretty ugly some events don't have such entries because e.g. they're not attached to installations in the case of github apps hooks (ping, github_app_authorization.revoked).

Currently every developer who needs this information has to reverse-engineer the values and hope they didn't miss special cases.

Expected

  • enumerate the valid values for Target-Type (as far as I can tell there's repository for repository hooks and integration for app hooks, I have never tested org hooks so I've no idea what that uses
  • specify what Target-Id maps to for each type, as far as I can tell for repository it's the repository id and for integration it's the app id
  • also the Target-Id is currently typed as a string, but all of them are numbers (/ integers)

Previous reports

Dominant language
No language data
Stars
1.6k
Forks
342
Avg merge
3h 33m
Merged PRs (30d)
51

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/rest-api-description

All issues in github/rest-api-description

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.