{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://glass.spboucher.ai/registry/schema/component.schema.json",
  "title": "SP Glass Registry component manifest (manifest.json)",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "id",
    "name",
    "version",
    "description",
    "kind",
    "platforms",
    "minimumOS",
    "dependencies",
    "frameworks",
    "files",
    "sha256",
    "license",
    "symbols",
    "examples",
    "accessibility",
    "changelog"
  ],
  "properties": {
    "schemaVersion": {
      "const": 1
    },
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
      "maxLength": 64
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 80
    },
    "version": {
      "type": "string",
      "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-[0-9A-Za-z]+(\\.[0-9A-Za-z]+)*)?$",
      "maxLength": 64
    },
    "description": {
      "type": "string",
      "maxLength": 600
    },
    "kind": {
      "enum": [
        "native-wrapper",
        "custom-glass",
        "content-component",
        "primitive"
      ]
    },
    "category": {
      "type": "string"
    },
    "platforms": {
      "type": "array",
      "items": {
        "enum": [
          "iOS",
          "iPadOS",
          "macOS"
        ]
      }
    },
    "minimumOS": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "dependencies": {
      "type": "array",
      "maxItems": 32,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "version"
        ],
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
            "maxLength": 64
          },
          "version": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-[0-9A-Za-z]+(\\.[0-9A-Za-z]+)*)?$",
            "maxLength": 64
          }
        }
      }
    },
    "frameworks": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "files": {
      "type": "array",
      "minItems": 1,
      "maxItems": 96,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "path",
          "sha256",
          "bytes"
        ],
        "properties": {
          "path": {
            "type": "string",
            "minLength": 1,
            "maxLength": 240,
            "pattern": "^(?!/)(?!~)(?!.*(^|/)\\.)(?!.*//)[A-Za-z0-9+_. /-]+$",
            "description": "Relative path with forward slashes. No component may be empty, start with a dot, or be '.' or '..'."
          },
          "sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "bytes": {
            "type": "integer",
            "minimum": 0,
            "maximum": 1048576
          }
        }
      }
    },
    "sha256": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$",
      "description": "SHA-256 over the lines 'path<TAB>sha256<LF>' of the files sorted by path."
    },
    "license": {
      "enum": [
        "MIT"
      ]
    },
    "symbols": {
      "type": "array",
      "maxItems": 256,
      "items": {
        "type": "string"
      }
    },
    "examples": {
      "type": "array",
      "maxItems": 16,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "title",
          "code"
        ],
        "properties": {
          "title": {
            "type": "string"
          },
          "code": {
            "type": "string"
          }
        }
      }
    },
    "accessibility": {
      "type": "array",
      "maxItems": 32,
      "items": {
        "type": "string"
      }
    },
    "changelog": {
      "type": "array",
      "maxItems": 256,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "version",
          "date",
          "changes"
        ],
        "properties": {
          "version": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-[0-9A-Za-z]+(\\.[0-9A-Za-z]+)*)?$",
            "maxLength": 64
          },
          "date": {
            "type": "string",
            "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
          },
          "changes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
