{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://unpkg.com/context-room@latest/schemas/shared-projects.schema.json",
  "title": "Context Room shared projects catalog",
  "type": "object",
  "additionalProperties": false,
  "required": ["version", "projects"],
  "properties": {
    "$schema": { "type": "string" },
    "version": { "const": 1 },
    "projects": {
      "type": "array",
      "items": { "$ref": "#/$defs/project" }
    }
  },
  "$defs": {
    "project": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id"],
      "properties": {
        "id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]{0,62}$" },
        "title": { "type": "string", "minLength": 1 },
        "source": {
          "type": "object",
          "additionalProperties": false,
          "required": ["remotes", "subpath"],
          "properties": {
            "remotes": {
              "type": "array",
              "minItems": 1,
              "uniqueItems": true,
              "items": { "type": "string", "minLength": 1 }
            },
            "subpath": {
              "anyOf": [
                { "const": "." },
                {
                  "type": "string",
                  "minLength": 1,
                  "not": { "pattern": "(^/|(^|/)\\.\\.?(/|$)|\\u0000)" }
                }
              ]
            }
          }
        }
      }
    }
  }
}
