{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/spack-definitions-yaml/latest.json",
  "title": "Spack definitions configuration file schema",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/spack/schemas/refs/heads/main/schemas/definitions.json",
    "sourceSha256": "d1411c1cf5f78b808f29ef804975a39dde66e73b88c3bb645b56c058abd6b72c",
    "fileMatch": [
      "**/*spack/**/definitions.yaml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "definitions": {
      "type": "array",
      "default": [],
      "description": "Named spec lists to be referred to with $name in the specs section of environments",
      "items": {
        "type": "object",
        "description": "Named definition entry containing a named spec list and optional conditional 'when' clause",
        "properties": {
          "when": {
            "type": "string",
            "description": "Python code condition evaluated as boolean. Specs are appended to the named list only if the condition is True. Available variables: platform, os, target, arch, arch_str, re, env, hostname"
          }
        },
        "additionalProperties": {
          "type": "array",
          "description": "List of specs to include in the environment, supporting both simple specs and matrix configurations",
          "default": [],
          "items": {
            "anyOf": [
              {
                "type": "object",
                "description": "Matrix configuration for generating multiple specs from combinations of constraints",
                "properties": {
                  "matrix": {
                    "type": "array",
                    "description": "List of spec constraint lists whose cross product generates multiple specs",
                    "items": {
                      "type": "array",
                      "description": "List of spec constraints for this matrix dimension",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "exclude": {
                    "type": "array",
                    "description": "List of specific spec combinations to exclude from the matrix",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "additionalProperties": false
              },
              {
                "type": "string",
                "description": "Simple spec string"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      }
    }
  },
  "additionalProperties": false
}
