{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://thruput.se/agents/schemas/review/change-set.schema.json",
  "title": "Change set",
  "description": "The lines a [[Change]] in a pull request adds or removes, resolved once at its head commit by the reviewing context and handed to every probe. Added lines are numbered in the file at the head commit, where their text is read; removed lines are numbered in the file at the base and carry their text, which no file at the head commit holds",
  "type": "object",
  "required": [
    "headCommit",
    "files"
  ],
  "properties": {
    "headCommit": {
      "$ref": "#/$defs/Commit"
    },
    "files": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ChangedFile"
      }
    }
  },
  "$defs": {
    "Commit": {
      "description": "A commit, named by its full SHA-1",
      "type": "string",
      "pattern": "^[0-9a-f]{40}$"
    },
    "Path": {
      "description": "A file, by its path relative to the repository root, with no leading separator",
      "type": "string",
      "pattern": "^[^/]"
    },
    "ChangedFile": {
      "description": "One file the pull request touches: the ranges it adds, numbered at the head commit, and the lines it removes, numbered at the base, with their text. A new file has no removed lines, a deleted file no added ranges",
      "type": "object",
      "required": [
        "path",
        "added",
        "removed"
      ],
      "properties": {
        "path": {
          "$ref": "#/$defs/Path"
        },
        "added": {
          "type": "array",
          "items": {
            "$ref": "lines.schema.json#/$defs/LineRange"
          }
        },
        "removed": {
          "type": "array",
          "items": {
            "$ref": "lines.schema.json#/$defs/RemovedLines"
          }
        }
      }
    }
  },
  "examples": [
    {
      "headCommit": "e2bde7afe2f2b1ffc23cdb6f0dc00601b4868eb7",
      "files": [
        {
          "path": "scripts/verify.sh",
          "added": [
            {
              "start": 21,
              "end": 21
            }
          ],
          "removed": [
            {
              "start": 21,
              "end": 21,
              "content": "lychee --offline \"$site\""
            }
          ]
        }
      ]
    }
  ]
}
