{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/spack-include-yaml/latest.json",
  "title": "Spack include configuration file schema",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/spack/schemas/refs/heads/main/schemas/include.json",
    "sourceSha256": "1e897a9d40074bce3b435f9d4df2dfb01d298af7c23df696104abcea5437b3c9",
    "fileMatch": [
      "**/*spack/**/include.yaml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "include": {
      "type": "array",
      "default": [],
      "items": {
        "anyOf": [
          {
            "type": "string",
            "description": "Simple include entry specifying path to required configuration file/directory"
          },
          {
            "type": "object",
            "description": "Advanced include entry with optional conditions and remote file support",
            "properties": {
              "when": {
                "type": "string",
                "description": "Include this config only when the condition (as Python code) evaluates to true"
              },
              "name": {
                "type": "string"
              },
              "path_override_env_var": {
                "type": "string"
              },
              "path": {
                "type": "string",
                "description": "Path to configuration file/directory (absolute, relative, or URL). URLs must be raw file content (GitHub/GitLab raw form). Supports file, ftp, http, https schemes and Spack/environment variables"
              },
              "sha256": {
                "type": "string",
                "description": "Required SHA256 hash for remote URLs to verify file integrity"
              },
              "optional": {
                "type": "boolean",
                "description": "If true, include only if path exists; if false (default), path is required and missing files cause errors"
              },
              "prefer_modify": {
                "type": "boolean"
              }
            },
            "required": [
              "path"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "description": "Include configuration files from a git repository with conditional and optional support",
            "properties": {
              "git": {
                "type": "string",
                "description": "URL of the git repository to clone (e.g., <https://github.com/spack/spack-configs)>"
              },
              "branch": {
                "type": "string",
                "description": "Branch to check out from the repository"
              },
              "commit": {
                "type": "string",
                "description": "Specific commit SHA to check out from the repository"
              },
              "tag": {
                "type": "string",
                "description": "Tag to check out from the repository"
              },
              "paths": {
                "type": "array",
                "items": {
                  "type": "string",
                  "description": "Relative path within the repository to a configuration file to include"
                },
                "description": "List of relative paths within the repository where configuration files are located"
              },
              "when": {
                "type": "string",
                "description": "Include this config only when the condition (as Python code) evaluates to true"
              },
              "optional": {
                "type": "boolean",
                "description": "If true, include only if repository is accessible; if false (default), inaccessible repository causes errors"
              }
            },
            "required": [
              "git",
              "paths"
            ],
            "additionalProperties": false
          }
        ]
      },
      "description": "Include external configuration files to pull in configuration from other files/URLs for modular and reusable configurations",
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
