{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://unpkg.com/dsh-bio-workflows@0.12.0/schema/wdl-draft-revision.schema.json",
  "title": "WDL Draft Revision v1",
  "$comment": "The runtime contract is authoritative for well-formed Unicode, exact UTF-8 byte budgets (1 MiB per file and 4 MiB aggregate), the required main.wdl workflow role, unique paths, and canonical contentDigest semantics; these cross-field and byte-level invariants are not fully expressible in portable JSON Schema.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "draftId", "revision", "contentDigest", "files"],
  "properties": {
    "schemaVersion": { "const": "1" },
    "draftId": { "$ref": "#/$defs/draftId" },
    "revision": { "type": "integer", "minimum": 1, "maximum": 256 },
    "contentDigest": { "$ref": "#/$defs/digest" },
    "files": {
      "type": "array",
      "minItems": 1,
      "maxItems": 128,
      "x-maxAggregateUtf8Bytes": 4194304,
      "items": { "$ref": "#/$defs/file" }
    }
  },
  "$defs": {
    "draftId": {
      "type": "string",
      "pattern": "^draft-[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
    },
    "digest": {
      "type": "string",
      "pattern": "^sha256:[a-f0-9]{64}$"
    },
    "file": {
      "type": "object",
      "additionalProperties": false,
      "required": ["path", "role", "content"],
      "properties": {
        "path": {
          "type": "string",
          "minLength": 1,
          "maxLength": 240,
          "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.?(?:/|$))(?!.*\\\\)(?!.*\\u0000)[^/]+(?:/[^/]+)*$"
        },
        "role": {
          "enum": ["workflow", "task", "example", "documentation", "license"]
        },
        "content": {
          "type": "string",
          "maxLength": 1048576,
          "x-maxUtf8Bytes": 1048576
        }
      }
    }
  }
}
