{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/trajectory/json-schema/trajectory-pipeline-run-detail-schema.json",
  "title": "PipelineRunDetail",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/trajectory-pipelines-api-openapi.yml#/components/schemas/PipelineRunDetail",
  "properties": {
    "run": {
      "$ref": "#/$defs/PipelineRunSummary"
    },
    "config": {
      "$ref": "#/$defs/PipelineConfigDetail"
    },
    "stages": {
      "items": {
        "$ref": "#/$defs/PipelineStageState"
      },
      "type": "array",
      "title": "Stages"
    }
  },
  "type": "object",
  "required": [
    "run",
    "config",
    "stages"
  ],
  "$defs": {
    "PipelineConfigDetail": {
      "properties": {
        "pipeline_name": {
          "type": "string",
          "title": "Pipeline Name"
        },
        "version_int": {
          "type": "integer",
          "title": "Version Int"
        },
        "pipeline_config_id": {
          "type": "string",
          "title": "Pipeline Config Id"
        },
        "status": {
          "type": "string",
          "title": "Status"
        },
        "created_by": {
          "type": "string",
          "title": "Created By"
        },
        "config": {
          "additionalProperties": true,
          "type": "object",
          "title": "Config"
        }
      },
      "type": "object",
      "required": [
        "pipeline_name",
        "version_int",
        "pipeline_config_id",
        "status",
        "created_by",
        "config"
      ],
      "title": "PipelineConfigDetail"
    },
    "PipelineKind": {
      "type": "string",
      "enum": [
        "generic",
        "eval",
        "train",
        "env_eval"
      ],
      "title": "PipelineKind"
    },
    "PipelineRunStatus": {
      "type": "string",
      "enum": [
        "pending",
        "running",
        "finalizing",
        "cancelling",
        "cancelled",
        "succeeded",
        "failed"
      ],
      "title": "PipelineRunStatus"
    },
    "PipelineRunSummary": {
      "properties": {
        "run_id": {
          "type": "string",
          "title": "Run Id"
        },
        "pipeline_config_id": {
          "type": "string",
          "title": "Pipeline Config Id"
        },
        "pipeline_name": {
          "type": "string",
          "title": "Pipeline Name"
        },
        "kind": {
          "$ref": "#/$defs/PipelineKind"
        },
        "status": {
          "$ref": "#/$defs/PipelineRunStatus"
        },
        "code_version": {
          "type": "string",
          "title": "Code Version"
        },
        "execution_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Execution Id"
        },
        "node_count": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Node Count"
        },
        "stages_done": {
          "type": "integer",
          "title": "Stages Done",
          "default": 0
        },
        "stages_failed": {
          "type": "integer",
          "title": "Stages Failed",
          "default": 0
        },
        "created_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Created At"
        },
        "updated_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Updated At"
        }
      },
      "type": "object",
      "required": [
        "run_id",
        "pipeline_config_id",
        "pipeline_name",
        "kind",
        "status",
        "code_version"
      ],
      "title": "PipelineRunSummary"
    },
    "PipelineStageState": {
      "properties": {
        "node_id": {
          "type": "string",
          "title": "Node Id"
        },
        "status": {
          "$ref": "#/$defs/StageStatus"
        },
        "xid": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Xid"
        },
        "attempt": {
          "type": "integer",
          "title": "Attempt"
        },
        "cache_key": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Cache Key"
        },
        "cache_hit": {
          "type": "boolean",
          "title": "Cache Hit"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Error"
        },
        "created_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Created At"
        },
        "updated_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Updated At"
        }
      },
      "type": "object",
      "required": [
        "node_id",
        "status",
        "attempt",
        "cache_hit"
      ],
      "title": "PipelineStageState"
    },
    "StageStatus": {
      "type": "string",
      "enum": [
        "pending",
        "running",
        "cached",
        "succeeded",
        "failed",
        "cancelled",
        "retrying"
      ],
      "title": "StageStatus"
    }
  }
}