{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/redocly/main/json-schema/redocly-job-schema.json",
  "title": "Job",
  "x-generated": "2026-10-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/redocly-tasks-api-openapi.yml#/components/schemas/Job",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "ulid",
      "description": "ID of the job.",
      "readOnly": true
    },
    "status": {
      "readOnly": true,
      "type": "string",
      "enum": [
        "PENDING",
        "PROCESSING",
        "COMPLETED",
        "FAILED"
      ],
      "description": "Job status."
    },
    "type": {
      "type": "string",
      "enum": [
        "PROCESS_GIT_REPO",
        "UPDATE_STATUS"
      ],
      "description": "Type of job."
    },
    "organizationId": {
      "description": "Organization ID.",
      "type": "string",
      "readOnly": true
    },
    "projectId": {
      "description": "Project ID.",
      "type": "string",
      "readOnly": true
    },
    "providerId": {
      "description": "Git provider identifier (appId for GitHub).",
      "type": "string"
    },
    "providerType": {
      "type": "string",
      "enum": [
        "GITHUB_CLOUD",
        "GITHUB_SERVER",
        "GITLAB_CLOUD",
        "GITLAB_SELF_MANAGED",
        "BITBUCKET_CLOUD",
        "BITBUCKET_DATACENTER",
        "AZURE"
      ],
      "description": "Git provider type."
    },
    "namespaceId": {
      "type": "string",
      "description": "Git repo namespace id (organization login for GitHub)."
    },
    "repositoryId": {
      "type": "string",
      "description": "Git repo id."
    },
    "branch": {
      "type": "string",
      "description": "Git branch name."
    },
    "commitSha": {
      "type": "string",
      "description": "Git commit SHA."
    },
    "isMainBranch": {
      "type": "boolean",
      "default": false,
      "description": "True if branch is main."
    },
    "prId": {
      "type": "string",
      "description": "Git pull request ID."
    },
    "attempts": {
      "type": "integer",
      "description": "Number of attempts to process the job.",
      "readOnly": true
    },
    "parentJobId": {
      "type": "string",
      "description": "ID of the parent job, if any.",
      "format": "ulid"
    },
    "checks": {
      "type": "array",
      "description": "Commit status checks.",
      "items": {
        "$ref": "#/$defs/GitCommitCheck"
      }
    },
    "metadata": {
      "$ref": "#/$defs/JobMetadata"
    },
    "startedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Job start date.",
      "readOnly": true
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "Job creation date.",
      "readOnly": true
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Job last update date.",
      "readOnly": true
    }
  },
  "required": [
    "id",
    "status",
    "type",
    "providerType",
    "namespaceId",
    "repositoryId",
    "branch",
    "commitSha",
    "attempts",
    "createdAt",
    "updatedAt"
  ],
  "$defs": {
    "GitCommitCheck": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Check name."
        },
        "status": {
          "type": "string",
          "enum": [
            "IN_PROGRESS",
            "SUCCESS",
            "FAILED"
          ],
          "description": "Git commit status."
        },
        "description": {
          "type": "string",
          "description": "Git commit status description."
        },
        "targetUrl": {
          "type": "string",
          "description": "Git commit status target URL."
        }
      },
      "required": [
        "name",
        "status"
      ]
    },
    "JobMetadata": {
      "type": "object",
      "description": "Additional information about job.",
      "properties": {
        "scoutVersion": {
          "type": "string",
          "description": "Scout version.",
          "readOnly": true
        },
        "errorMessage": {
          "type": "string",
          "description": "Error message, if any."
        },
        "errorStack": {
          "type": "string",
          "description": "Error stack trace, if any."
        }
      }
    }
  }
}