{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://paulkov.github.io/dpone/schemas/gitops/plan.schema.json",
  "title": "dpone GitOps plan contract",
  "type": "object",
  "required": [
    "kind",
    "manifest",
    "workload_root",
    "runner",
    "command",
    "sparse_paths"
  ],
  "properties": {
    "kind": {
      "const": "gitops.plan"
    },
    "manifest": {
      "type": "string"
    },
    "workload_root": {
      "type": "string"
    },
    "runner": {
      "type": "object",
      "additionalProperties": true,
      "required": [
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string"
        },
        "requires_sparse_checkout": {
          "type": "boolean"
        }
      }
    },
    "command": {
      "type": "object",
      "additionalProperties": true,
      "required": [
        "text"
      ],
      "properties": {
        "text": {
          "type": "string"
        }
      }
    },
    "sparse_paths": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "path",
          "kind",
          "source",
          "required",
          "exists",
          "is_dir",
          "reason"
        ],
        "properties": {
          "path": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "required": {
            "type": "boolean"
          },
          "exists": {
            "type": "boolean"
          },
          "is_dir": {
            "type": "boolean"
          },
          "reason": {
            "type": "string"
          }
        }
      }
    },
    "warnings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/issue"
      }
    },
    "blockers": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/issue"
      }
    },
    "provenance": {
      "type": "object",
      "additionalProperties": true
    },
    "lock": {
      "type": "object",
      "additionalProperties": true
    }
  },
  "$defs": {
    "issue": {
      "type": "object",
      "additionalProperties": true,
      "required": [
        "code",
        "message",
        "path",
        "source"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "path": {
          "type": "string"
        },
        "source": {
          "type": "string"
        }
      }
    }
  },
  "additionalProperties": true
}
