{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://paulkov.github.io/dpone/schemas/gitops/release-set.schema.json",
  "title": "dpone GitOps release-set",
  "type": "object",
  "required": [
    "schema",
    "release_id",
    "artifacts"
  ],
  "additionalProperties": true,
  "properties": {
    "schema": {
      "const": "dpone.release-set.v1"
    },
    "release_id": {
      "$ref": "#/$defs/identity"
    },
    "selection_fingerprint": {
      "$ref": "#/$defs/identity"
    },
    "artifacts": {
      "type": "object",
      "required": [
        "dag_specs",
        "workload_packs",
        "canonical_schemas"
      ],
      "additionalProperties": false,
      "properties": {
        "dag_specs": {
          "$ref": "#/$defs/artifacts"
        },
        "workload_packs": {
          "$ref": "#/$defs/artifacts"
        },
        "canonical_schemas": {
          "$ref": "#/$defs/artifacts"
        }
      }
    },
    "provenance": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "source_commit": {
          "type": "string"
        },
        "build_id": {
          "type": "string"
        },
        "built_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    }
  },
  "$defs": {
    "identity": {
      "type": "string",
      "pattern": "^sha256:[0-9a-f]{64}$"
    },
    "sha256": {
      "type": "string",
      "pattern": "^sha256:[A-Fa-f0-9]{64}$"
    },
    "artifact": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "id",
            "sha256",
            "path"
          ],
          "additionalProperties": true,
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1
            },
            "path": {
              "type": "string",
              "pattern": "^(?!/)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u0020\\u007f\\\\:])[^\\s\\\\:]+$"
            },
            "artifact_ref": {
              "type": "string",
              "pattern": "^(?!/)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u0020\\u007f\\\\:])[^\\s\\\\:]+$"
            },
            "sha256": {
              "$ref": "#/$defs/sha256"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "id",
            "sha256",
            "artifact_ref"
          ],
          "additionalProperties": true,
          "properties": {
            "id": {
              "type": "string",
              "minLength": 1
            },
            "path": {
              "type": "string",
              "pattern": "^(?!/)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u0020\\u007f\\\\:])[^\\s\\\\:]+$"
            },
            "artifact_ref": {
              "type": "string",
              "pattern": "^(?!/)(?!.*//)(?!.*(?:^|/)\\.{1,2}(?:/|$))(?!.*[\\u0000-\\u0020\\u007f\\\\:])[^\\s\\\\:]+$"
            },
            "sha256": {
              "$ref": "#/$defs/sha256"
            }
          }
        }
      ]
    },
    "artifacts": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/artifact"
      }
    }
  }
}
