{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/spack-view-yaml/latest.json",
  "title": "Spack view configuration file schema",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/spack/schemas/refs/heads/main/schemas/view.json",
    "sourceSha256": "3257cd1770ad0f640081c2c28784a990ca874f78cd84dadd79140209bf7e9e5f",
    "fileMatch": [
      "**/*spack/**/view.yaml"
    ],
    "parsers": [
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "view": {
      "description": "Environment filesystem view configuration for creating a directory with traditional structure where all files of installed packages are linked",
      "anyOf": [
        {
          "type": "boolean",
          "description": "Enable or disable default views. If 'true', the view is generated under .spack-env/view"
        },
        {
          "type": "string",
          "description": "Path where the default view should be created"
        },
        {
          "type": "object",
          "description": "Advanced view configuration with one or more named view descriptors",
          "additionalProperties": {
            "description": "Named view descriptor (use 'default' for the view activated with environment)",
            "required": [
              "root"
            ],
            "properties": {
              "root": {
                "type": "string",
                "description": "Root directory path where the view will be created"
              },
              "link": {
                "enum": [
                  "roots",
                  "all",
                  "run"
                ],
                "description": "Which specs to include: 'all' (environment roots with transitive run+link deps), 'run' (environment roots with transitive run deps), 'roots' (environment roots only)"
              },
              "link_type": {
                "type": "string",
                "enum": [
                  "symlink",
                  "hardlink",
                  "copy"
                ],
                "description": "How files are linked in the view: 'symlink' (default), 'hardlink', or 'copy'"
              },
              "select": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "List of specs to include in the view (default: select everything)"
              },
              "exclude": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "List of specs to exclude from the view (default: exclude nothing)"
              },
              "projections": {
                "type": "object",
                "description": "Customize directory structure and naming schemes by mapping specs to format strings.",
                "properties": {
                  "all": {
                    "type": "string",
                    "description": "Default projection format string used as fallback for all specs that do not match other entries. Uses spec format syntax like \"{name}/{version}/{hash:16}\"."
                  }
                },
                "additionalKeysAreSpecs": true,
                "additionalProperties": {
                  "type": "string",
                  "description": "Projection format string for specs matching this key. Uses spec format syntax supporting tokens like {name}, {version}, {compiler.name}, {^dependency.name}, etc."
                }
              }
            },
            "additionalProperties": false,
            "type": "object"
          }
        }
      ]
    }
  },
  "additionalProperties": false
}
