{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/mlops/main/json-schema/mlops-pipeline-schema.json",
  "title": "MLOps Pipeline",
  "description": "Schema describing an end-to-end MLOps pipeline including data engineering, training, validation, deployment, and monitoring stages.",
  "type": "object",
  "required": ["name", "stages"],
  "properties": {
    "id": { "type": "string" },
    "name": { "type": "string" },
    "description": { "type": "string" },
    "trigger": {
      "type": "string",
      "enum": ["manual", "schedule", "event", "data-change", "code-change"]
    },
    "schedule": {
      "type": "string",
      "description": "Cron expression for scheduled triggers."
    },
    "stages": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["name", "type"],
        "properties": {
          "name": { "type": "string" },
          "type": {
            "type": "string",
            "enum": ["ingest", "validate", "transform", "train", "evaluate", "register", "deploy", "monitor"]
          },
          "inputs": { "type": "array", "items": { "type": "string" } },
          "outputs": { "type": "array", "items": { "type": "string" } },
          "image": { "type": "string", "description": "Container image executing the stage." },
          "params": { "type": "object", "additionalProperties": true }
        }
      }
    },
    "owner": { "type": "string" },
    "createdAt": { "type": "string", "format": "date-time" },
    "updatedAt": { "type": "string", "format": "date-time" }
  }
}
