{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://paulkov.github.io/dpone/schemas/gitops/workloads.schema.json",
  "title": "dpone GitOps workloads contract",
  "type": "object",
  "required": [
    "kind",
    "schema_version",
    "producer",
    "workload_set",
    "env",
    "workloads"
  ],
  "properties": {
    "kind": {
      "const": "gitops.workloads"
    },
    "schema_version": {
      "type": "string"
    },
    "producer": {
      "type": "string"
    },
    "workload_set": {
      "type": "string"
    },
    "env": {
      "type": "string"
    },
    "workloads": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "workload_id",
          "manifest",
          "catalog_path",
          "effective_config",
          "provenance"
        ],
        "properties": {
          "workload_id": {
            "type": "string"
          },
          "manifest": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "catalog_path": {
            "type": "string"
          },
          "effective_config": {
            "type": "object",
            "additionalProperties": true
          },
          "provenance": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    },
    "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
}
