{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://mergeharbor.com/schema/context.json",
  "title": "MergeHarbor context files",
  "description": "Schema for .mergeharbor/context.yml: files always given to the reviewer as context.",
  "oneOf": [
    {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "version": {
          "const": 1
        },
        "files": {
          "type": "array",
          "maxItems": 20,
          "items": {
            "oneOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": ["path"],
                "properties": {
                  "path": {
                    "type": "string",
                    "minLength": 1
                  },
                  "reason": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "paths": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    },
                    "description": "Only when the pull request changes matching files (relative to this folder)."
                  },
                  "scope": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    },
                    "description": "Alias of paths."
                  }
                }
              }
            ]
          }
        },
        "notes": {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "string",
                "minLength": 1
              },
              {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "note": {
                    "type": "string"
                  },
                  "text": {
                    "type": "string"
                  },
                  "content": {
                    "type": "string"
                  },
                  "paths": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  },
                  "scope": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1
                    }
                  }
                }
              }
            ]
          },
          "description": "Background the reviewer should know (not rules to enforce)."
        },
        "repos": {
          "type": "array",
          "maxItems": 20,
          "items": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._-]+(/[A-Za-z0-9._-]+)+$"
          },
          "description": "Other repositories (owner/name) the reviewer may read as context."
        }
      }
    },
    {
      "type": "array",
      "maxItems": 20,
      "items": {
        "oneOf": [
          {
            "type": "string",
            "minLength": 1
          },
          {
            "type": "object",
            "additionalProperties": false,
            "required": ["path"],
            "properties": {
              "path": {
                "type": "string",
                "minLength": 1
              },
              "reason": {
                "type": "string"
              },
              "description": {
                "type": "string"
              },
              "paths": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                },
                "description": "Only when the pull request changes matching files (relative to this folder)."
              },
              "scope": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                },
                "description": "Alias of paths."
              }
            }
          }
        ]
      }
    }
  ]
}
