{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://paulkov.github.io/dpone/schemas/gitops/affected.schema.json",
  "title": "dpone GitOps affected contract",
  "type": "object",
  "required": [
    "kind",
    "changed_files",
    "impacted_manifests"
  ],
  "properties": {
    "kind": {
      "const": "gitops.affected"
    },
    "changed_files": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "impacted_manifests": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "manifest",
          "workload_root",
          "reasons",
          "suggested_commands"
        ],
        "properties": {
          "manifest": {
            "type": "string"
          },
          "workload_root": {
            "type": "string"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "suggested_commands": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "emitted_plan": {
            "type": "string"
          }
        }
      }
    },
    "warnings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/issue"
      }
    },
    "blockers": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/issue"
      }
    }
  },
  "$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
}
