Skip to main content

CONNECTOR_EVENT_SCHEMAS_SOURCE

Constant CONNECTOR_EVENT_SCHEMAS_SOURCE 

Source
pub const CONNECTOR_EVENT_SCHEMAS_SOURCE: &str = "// Canonical normalized connector event schemas, authored as Harn types.\n//\n// This module is the SOURCE OF TRUTH for the normalized-event shapes that\n// `.harn` connectors emit and the Rust runtime deserializes. The Rust structs\n// in `crates/harn-vm/src/triggers/event/schemas_generated.rs` are GENERATED\n// from these declarations by `harn connector-schema-codegen`, so a connector\'s\n// JSON output matches the Rust struct by construction.\n//\n// Regenerate the Rust structs with:  make gen-connector-schemas\n// Verify they are not stale with:     make check-connector-schemas\n//\n// Type mapping applied by the generator:\n//   string      -> String\n//   int         -> i64\n//   bool        -> bool\n//   any         -> serde_json::Value      (untyped JSON subtree)\n//   T?          -> Option<T>              (+ serde default + skip_serializing_if)\n//   list<T>     -> Vec<T>                 (+ serde default)\n//   dict<K, V>  -> BTreeMap<K, V>         (+ serde default)\n//   { ... }     -> a `#[serde(flatten)]` field named `common` when the field is\n//                  spelled `common: <Record>`; otherwise a nested struct.\n//\n// GITHUB. This PR proves the pipeline end-to-end for GitHub only; Slack,\n// Linear, Notion, and the stream providers follow in later PRs. Keep these\n// records a faithful mirror of the `GitHubEventPayload` family in\n// `crates/harn-vm/src/triggers/event/payloads.rs`.\n/**\n * Stable common block shared by every GitHub normalized event. The generator\n * recognizes a field named `common` whose type is a record and emits it as a\n * `#[serde(flatten)]` field, matching the hand-written `GitHubEventCommon`.\n */\ntype GitHubEventCommon = {\n  event: string,\n  action?: string,\n  delivery_id?: string,\n  installation_id?: int,\n  topic?: string,\n  repository?: any,\n  repo?: any,\n  raw: any,\n}\n\ntype GitHubIssuesEventPayload = {common: GitHubEventCommon, issue: any}\n\ntype GitHubPullRequestEventPayload = {common: GitHubEventCommon, pull_request: any}\n\ntype GitHubIssueCommentEventPayload = {common: GitHubEventCommon, issue: any, comment: any}\n\ntype GitHubPullRequestReviewEventPayload = {\n  common: GitHubEventCommon,\n  pull_request: any,\n  review: any,\n}\n\ntype GitHubPushEventPayload = {common: GitHubEventCommon, commits: list<any>, distinct_size?: int}\n\ntype GitHubWorkflowRunEventPayload = {common: GitHubEventCommon, workflow_run: any}\n\ntype GitHubDeploymentStatusEventPayload = {\n  common: GitHubEventCommon,\n  deployment_status: any,\n  deployment: any,\n}\n\ntype GitHubCheckRunEventPayload = {common: GitHubEventCommon, check_run: any}\n\ntype GitHubCheckSuiteEventPayload = {\n  common: GitHubEventCommon,\n  check_suite: any,\n  check_suite_id?: int,\n  pull_request_number?: int,\n  head_sha?: string,\n  head_ref?: string,\n  base_ref?: string,\n  status?: string,\n  conclusion?: string,\n}\n\ntype GitHubStatusEventPayload = {\n  common: GitHubEventCommon,\n  commit_status?: any,\n  status_id?: int,\n  head_sha?: string,\n  head_ref?: string,\n  base_ref?: string,\n  state?: string,\n  context?: string,\n  target_url?: string,\n}\n\ntype GitHubMergeGroupEventPayload = {\n  common: GitHubEventCommon,\n  merge_group: any,\n  merge_group_id?: any,\n  head_sha?: string,\n  head_ref?: string,\n  base_sha?: string,\n  base_ref?: string,\n  pull_requests: list<any>,\n  pull_request_numbers: list<int>,\n}\n\ntype GitHubInstallationEventPayload = {\n  common: GitHubEventCommon,\n  installation?: any,\n  account?: any,\n  installation_state?: string,\n  suspended?: bool,\n  revoked?: bool,\n  repositories: list<any>,\n}\n\ntype GitHubInstallationRepositoriesEventPayload = {\n  common: GitHubEventCommon,\n  installation?: any,\n  account?: any,\n  installation_state?: string,\n  suspended?: bool,\n  revoked?: bool,\n  repository_selection?: string,\n  repositories_added: list<any>,\n  repositories_removed: list<any>,\n}\n\n/**\n * The dispatched GitHub event union, mirroring the hand-written\n * `GitHubEventPayload` enum (an untagged-on-the-wire, `event`-dispatched enum).\n *\n * The generator emits one Rust enum variant per union member; the trailing\n * `GitHubEventCommon` member is the catch-all `Other` variant the manual\n * `Deserialize` falls back to when the `event` discriminator is unrecognized.\n * Referencing every payload record here also keeps this schema module free of\n * `unused-type` lint noise.\n */\ntype GitHubEventPayload = GitHubIssuesEventPayload | GitHubPullRequestEventPayload | GitHubIssueCommentEventPayload | GitHubPullRequestReviewEventPayload | GitHubPushEventPayload | GitHubWorkflowRunEventPayload | GitHubDeploymentStatusEventPayload | GitHubCheckRunEventPayload | GitHubCheckSuiteEventPayload | GitHubStatusEventPayload | GitHubMergeGroupEventPayload | GitHubInstallationEventPayload | GitHubInstallationRepositoriesEventPayload | GitHubEventCommon\n";
Expand description

Canonical normalized connector event schemas, authored as Harn type declarations. This is the SOURCE OF TRUTH for the Rust event-payload structs in crates/harn-vm/src/triggers/event/schemas_generated.rs, which are generated from these declarations by harn connector-schema-codegen.

It is intentionally NOT registered in STDLIB_SOURCES: it is a codegen input (like spec/openapi.yaml), not a module loaded into every program. Exposing it as an embedded string keeps the generator independent of the current working directory.