Implementation:Mage ai Mage ai GitHub PR Commits Schema
| Knowledge Sources | |
|---|---|
| Domains | Data_Integration, GitHub, Schema |
| Last Updated | 2026-02-09 00:00 GMT |
Overview
JSON Schema definition for GitHub pull request commit records used by the Singer-based GitHub source connector.
Description
This schema defines the structure and types for pull request commit data extracted from the GitHub Pull Request Commits API. It is loaded by the GitHub source connector during stream discovery to validate and type-check extracted records. The schema follows the JSON Schema specification and includes top-level properties such as _sdc_repository, sha (the git commit hash), node_id, url, parents (an array of parent commit objects with sha, url, and html_url), files (an array of file change objects with filename, additions, and deletions), html_url, comments_url, commit (nested commit metadata), committer, pr_number, pr_id, id, author, and stats.
Usage
This schema is automatically loaded by the GitHub source connector during the discovery phase. It defines the available columns and their types for the pr_commits stream.
Code Reference
Source Location
- Repository: mage-ai
- File: mage_integrations/mage_integrations/sources/github/tap_github/schemas/pr_commits.json
- Lines: 1-323
Signature
{
"type": ["null", "object"],
"properties": {
"_sdc_repository": { "type": ["string"] },
"sha": { "type": ["null", "string"], "description": "The git commit hash" },
"node_id": { "type": ["null", "string"] },
"url": { "type": ["null", "string"] },
"parents": { "type": ["null", "array"], "items": { "type": ["null", "object"], "properties": { "sha": {}, "url": {}, "html_url": {} } } },
"files": { "type": ["null", "array"], "items": { "type": ["null", "object"], "properties": { "filename": {}, "additions": {}, "deletions": {} } } },
"pr_number": { "type": ["null", "integer"] },
"pr_id": { "type": ["null", "string"] },
"id": { "type": ["null", "string"] },
"author": { "..." : "..." },
"stats": { "..." : "..." }
}
}
Import
# Loaded automatically by Source.load_schemas_from_folder()
# Path: mage_integrations/mage_integrations/sources/github/tap_github/schemas/pr_commits.json
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| (none) | JSON file | Yes | Loaded from disk by schema loader |
Outputs
| Name | Type | Description |
|---|---|---|
| schema | dict | JSON Schema object with properties, types, and format constraints |
Usage Examples
import json
import os
schema_path = os.path.join(
"mage_integrations/mage_integrations/sources/github/tap_github/schemas",
"pr_commits.json"
)
with open(schema_path) as f:
schema = json.load(f)
print(list(schema["properties"].keys()))