{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/vcpkg-manifest-file/_shared/latest--vcpkg-schema-definitions.schema.json",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-schema-definitions.schema.json",
    "sourceSha256": "562dd2def5768b6eb7c57bc4a8937a1ed31e7ad4b52188fc46f41f5c9f1ebeca"
  },
  "$defs": {
    "artifact-references": {
      "description": "A key/value pair of artifact name to selected artifact version.",
      "type": "object",
      "patternProperties": {
        "": {
          "type": "string"
        }
      }
    },
    "artifact-registry": {
      "description": "An artifact registry backed by a git repository.",
      "type": "object",
      "if": {
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "artifact"
            ]
          }
        },
        "required": [
          "kind"
        ],
        "type": "object"
      },
      "then": {
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "artifact"
            ]
          },
          "name": {
            "$ref": "#/$defs/identifier"
          },
          "location": {
            "type": "string",
            "format": "uri",
            "description": "A URI to the location of the artifact registry; typically a git URI."
          }
        },
        "required": [
          "kind",
          "name",
          "location"
        ],
        "additionalProperties": false,
        "patternProperties": {
          "^\\$": {}
        },
        "type": "object"
      },
      "else": false
    },
    "builtin-registry": {
      "type": "object",
      "if": {
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "builtin"
            ]
          }
        },
        "required": [
          "kind"
        ],
        "type": "object"
      },
      "then": {
        "properties": {
          "baseline": {
            "$ref": "#/$defs/sha1",
            "description": "The SHA that will be checked out to find default versions for ports from this registry."
          },
          "kind": {
            "type": "string",
            "enum": [
              "builtin"
            ]
          },
          "packages": true
        },
        "required": [
          "baseline",
          "kind"
        ],
        "additionalProperties": false,
        "patternProperties": {
          "^\\$": {}
        },
        "type": "object"
      },
      "else": false
    },
    "contact": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string"
        },
        "role": {
          "$ref": "#/$defs/string-or-strings"
        }
      },
      "required": [
        "role"
      ],
      "additionalProperties": false,
      "patternProperties": {
        "^\\$": {}
      }
    },
    "contacts": {
      "type": "object",
      "patternProperties": {
        "": {
          "$ref": "#/$defs/contact"
        }
      }
    },
    "default-registry": {
      "type": "object",
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "builtin",
                "git",
                "filesystem"
              ]
            },
            "packages": false
          }
        },
        {
          "oneOf": [
            {
              "$ref": "#/$defs/builtin-registry"
            },
            {
              "$ref": "#/$defs/git-registry"
            },
            {
              "$ref": "#/$defs/filesystem-registry"
            }
          ]
        }
      ]
    },
    "demands": {
      "description": "A set of filters to conditionally apply artifact pieces. Typically contains other 'requires' or similar elements. The keys are platform expressions with identifiers assumed to refer to the host.",
      "type": "object",
      "patternProperties": {
        "": {
          "type": "object",
          "properties": {
            "error": {
              "type": "string",
              "description": "An error message to print if this entry is evaluated."
            },
            "warning": {
              "type": "string",
              "description": "A warning message to print if this entry is evaluated."
            },
            "message": {
              "type": "string",
              "description": "A message to print if this entry is evaluated."
            },
            "exports": {
              "$ref": "#/$defs/exports"
            },
            "requires": {
              "description": "Artifacts that are required for this package to function.",
              "$ref": "#/$defs/artifact-references"
            },
            "install": {
              "$ref": "#/$defs/install"
            }
          },
          "additionalProperties": false,
          "patternProperties": {
            "^\\$": {}
          }
        }
      }
    },
    "dependency": {
      "description": "A port dependency fetchable by vcpkg.",
      "oneOf": [
        {
          "$ref": "#/$defs/identifier"
        },
        {
          "$ref": "#/$defs/dependency-object"
        }
      ]
    },
    "dependency-object": {
      "description": "Expanded form of a dependency with explicit features and platform.",
      "type": "object",
      "properties": {
        "name": {
          "$ref": "#/$defs/identifier"
        },
        "features": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/dependency-feature"
          }
        },
        "host": {
          "type": "boolean",
          "default": false
        },
        "default-features": {
          "type": "boolean",
          "default": true
        },
        "platform": {
          "$ref": "#/$defs/platform-expression"
        },
        "version>=": {
          "description": "Minimum required version",
          "type": "string",
          "pattern": "^[^#]+(#\\d+)?$"
        }
      },
      "required": [
        "name"
      ],
      "additionalProperties": false,
      "patternProperties": {
        "^\\$": {}
      }
    },
    "dependency-feature-object": {
      "description": "Expanded form of a dependency feature with platform expression.",
      "type": "object",
      "properties": {
        "name": {
          "$ref": "#/$defs/identifier"
        },
        "platform": {
          "$ref": "#/$defs/platform-expression"
        }
      },
      "required": [
        "name"
      ],
      "additionalProperties": false
    },
    "dependency-feature": {
      "description": "A feature",
      "oneOf": [
        {
          "$ref": "#/$defs/identifier"
        },
        {
          "$ref": "#/$defs/dependency-feature-object"
        }
      ]
    },
    "description-field": {
      "description": "A string or array of strings containing the description of a package or feature.",
      "$ref": "#/$defs/string-or-strings"
    },
    "exports": {
      "type": "object",
      "properties": {
        "aliases": {
          "$ref": "#/$defs/string-map"
        },
        "defines": {
          "$ref": "#/$defs/string-map"
        },
        "environment": {
          "$ref": "#/$defs/strings-map"
        },
        "locations": {
          "$ref": "#/$defs/string-map"
        },
        "msbuild-properties": {
          "description": "Properties written verbatim when generating msbuild props for an activation, with $root$ replaced with the ultimate extraction root for this artifact. $root$ never contains a trailing backslash.",
          "type": "object",
          "patternProperties": {
            "": {
              "type": "string"
            }
          }
        },
        "paths": {
          "$ref": "#/$defs/strings-map"
        },
        "properties": {
          "$ref": "#/$defs/strings-map"
        },
        "tools": {
          "$ref": "#/$defs/string-map"
        }
      },
      "additionalProperties": false
    },
    "feature": {
      "description": "A package feature that can be selected by consumers.",
      "type": "object",
      "properties": {
        "description": {
          "$ref": "#/$defs/description-field"
        },
        "dependencies": {
          "description": "Dependencies used by this feature.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/dependency"
          }
        },
        "supports": {
          "$ref": "#/$defs/platform-expression"
        },
        "license": {
          "$ref": "#/$defs/license"
        }
      },
      "required": [
        "description"
      ],
      "additionalProperties": false,
      "patternProperties": {
        "^\\$": {}
      }
    },
    "filesystem-registry": {
      "description": "A port registry backed by a filesystem layout.",
      "type": "object",
      "if": {
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "filesystem"
            ]
          }
        },
        "required": [
          "kind"
        ],
        "type": "object"
      },
      "then": {
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "filesystem"
            ]
          },
          "path": {
            "type": "string",
            "description": "The location on the filesystem where the registry is rooted."
          },
          "baseline": {
            "description": "The key in the JSON document of baseline.json which will be used for version selection",
            "type": "string",
            "default": "default"
          },
          "packages": true
        },
        "required": [
          "kind",
          "path"
        ],
        "additionalProperties": false,
        "patternProperties": {
          "^\\$": {}
        },
        "type": "object"
      },
      "else": false
    },
    "info-block": {
      "type": "object",
      "properties": {
        "version": {
          "$ref": "#/$defs/semantic-version"
        },
        "id": {
          "$ref": "#/$defs/slash-identifier"
        },
        "summary": {
          "description": "A shorter description of the artifact.",
          "type": "string"
        },
        "priority": {
          "type": "integer",
          "minimum": 0,
          "default": 0
        },
        "description": {
          "type": "string"
        },
        "options": {
          "$ref": "#/$defs/string-array",
          "default": []
        }
      },
      "required": [
        "version",
        "id"
      ],
      "additionalProperties": false,
      "patternProperties": {
        "^\\$": {}
      }
    },
    "install": {
      "if": {
        "type": "object"
      },
      "then": {
        "$ref": "#/$defs/install-instance"
      },
      "else": {
        "type": "array",
        "items": {
          "$ref": "#/$defs/install-instance"
        }
      }
    },
    "install-instance": {
      "type": "object",
      "properties": {
        "unzip": {
          "$ref": "#/$defs/uri-or-uris"
        },
        "untar": {
          "$ref": "#/$defs/uri-or-uris"
        },
        "nupkg": {
          "type": "string",
          "format": "uri"
        },
        "git": {
          "type": "string",
          "description": "The http or ssh remote from which a git repo will be fetched."
        }
      },
      "oneOf": [
        {
          "required": [
            "unzip"
          ]
        },
        {
          "required": [
            "untar"
          ]
        },
        {
          "required": [
            "nupkg"
          ]
        },
        {
          "required": [
            "git"
          ]
        }
      ],
      "dependentSchemas": {
        "unzip": {
          "properties": {
            "unzip": {},
            "sha256": {
              "$ref": "#/$defs/sha256"
            },
            "sha512": {
              "$ref": "#/$defs/sha512"
            },
            "strip": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "transform": {
              "type": "string",
              "description": "An SED expression to run on the file names before extracting them."
            },
            "lang": {
              "type": "string",
              "description": "The locale under which this install should be applied."
            },
            "nametag": {
              "type": "string",
              "description": "A string to add to the name of the artifact when extracted on disk."
            }
          },
          "required": [
            "unzip"
          ],
          "additionalProperties": false,
          "patternProperties": {
            "^\\$": {}
          },
          "type": "object"
        },
        "untar": {
          "properties": {
            "untar": {},
            "sha256": {
              "$ref": "#/$defs/sha256"
            },
            "sha512": {
              "$ref": "#/$defs/sha512"
            },
            "strip": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "transform": {
              "type": "string",
              "description": "An SED expression to run on the file names before extracting them."
            }
          },
          "required": [
            "untar"
          ],
          "additionalProperties": false,
          "patternProperties": {
            "^\\$": {}
          },
          "type": "object"
        },
        "nupkg": {
          "properties": {
            "nupkg": {},
            "sha256": {
              "$ref": "#/$defs/sha256"
            },
            "sha512": {
              "$ref": "#/$defs/sha512"
            },
            "strip": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "transform": {
              "type": "string",
              "description": "An SED expression to run on the file names before extracting them."
            },
            "lang": {
              "type": "string",
              "description": "The locale under which this install should be applied."
            },
            "nametag": {
              "type": "string",
              "description": "A string to add to the name of the artifact when extracted on disk."
            }
          },
          "required": [
            "nupkg"
          ],
          "additionalProperties": false,
          "patternProperties": {
            "^\\$": {}
          },
          "type": "object"
        },
        "git": {
          "properties": {
            "git": {},
            "commit": {
              "type": "string",
              "description": "The commit SHA or ref that will be checked out."
            },
            "options": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "full",
                  "recurse"
                ]
              }
            },
            "subdirectory": {
              "type": "string",
              "default": ""
            }
          },
          "required": [
            "git"
          ],
          "additionalProperties": false,
          "patternProperties": {
            "^\\$": {}
          },
          "type": "object"
        }
      }
    },
    "git-registry": {
      "type": "object",
      "description": "A port registry backed by a git repo.",
      "if": {
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "git"
            ]
          }
        },
        "required": [
          "kind"
        ],
        "type": "object"
      },
      "then": {
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "git"
            ]
          },
          "repository": {
            "type": "string",
            "description": "The URI or SSH entry to clone from. (as if by `git clone`)"
          },
          "baseline": {
            "description": "The SHA that will be checked out to find default versions for ports from this registry.",
            "$ref": "#/$defs/sha1"
          },
          "reference": {
            "type": "string",
            "description": "The ref to fetch when cloning this git registry."
          },
          "packages": true
        },
        "required": [
          "kind",
          "repository",
          "baseline"
        ],
        "additionalProperties": false,
        "patternProperties": {
          "^\\$": {}
        },
        "type": "object"
      },
      "else": false
    },
    "has-one-version": {
      "type": "object",
      "oneOf": [
        {
          "required": [
            "version-string"
          ]
        },
        {
          "required": [
            "version"
          ]
        },
        {
          "required": [
            "version-semver"
          ]
        },
        {
          "required": [
            "version-date"
          ]
        }
      ]
    },
    "has-zero-or-one-version": {
      "type": "object",
      "oneOf": [
        {
          "required": [
            "version-string"
          ]
        },
        {
          "required": [
            "version"
          ]
        },
        {
          "required": [
            "version-semver"
          ]
        },
        {
          "required": [
            "version-date"
          ]
        },
        {
          "not": {
            "anyOf": [
              {
                "required": [
                  "version-string"
                ]
              },
              {
                "required": [
                  "version"
                ]
              },
              {
                "required": [
                  "version-semver"
                ]
              },
              {
                "required": [
                  "version-date"
                ]
              }
            ]
          }
        }
      ]
    },
    "identifier": {
      "type": "string",
      "description": "Identifiers used for port and feature names.",
      "allOf": [
        {
          "description": "Identifier are lowercase with digits and dashes.",
          "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
        },
        {
          "not": {
            "$ref": "#/$defs/reserved-name"
          }
        }
      ]
    },
    "license": {
      "description": "An SPDX license expression at version 3.9.",
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "maintainers": {
      "description": "An array of strings which contain the maintainers of a package",
      "$ref": "#/$defs/string-or-strings"
    },
    "override": {
      "description": "A version override.",
      "allOf": [
        {
          "type": "object",
          "$comment": "The regexes below have (#\\d+)? added to the end as overrides allow putting the port-version inline",
          "properties": {
            "name": {
              "$ref": "#/$defs/identifier"
            },
            "version-string": {
              "description": "Deprecated in favor of 'version' in overrides. Text used to identify an arbitrary version",
              "type": "string",
              "pattern": "^[^#]+(#\\d+)?$"
            },
            "version": {
              "description": "Text used to identify the overridden version.",
              "type": "string",
              "pattern": "^[^#]+(#\\d+)?$"
            },
            "version-date": {
              "description": "Deprecated in favor of 'version' in overrides. A date version string (e.g. 2020-01-20).",
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}-\\d{2}(\\.\\d+)*(#\\d+)?$"
            },
            "version-semver": {
              "description": "Deprecated in favor of 'version' in overrides. A semantic version string. See <https://semver.org/>",
              "type": "string",
              "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?(#\\d+)?$"
            },
            "port-version": {
              "description": "Deprecated in favor of being a part of 'version' in overrides. Specifies the port-version portion of the version. Overrides the value in one of the other version fields.",
              "$ref": "#/$defs/port-version"
            }
          },
          "required": [
            "name"
          ],
          "additionalProperties": false,
          "patternProperties": {
            "^\\$": {}
          }
        },
        {
          "$ref": "#/$defs/has-one-version"
        }
      ]
    },
    "package-pattern": {
      "type": "string",
      "description": "A pattern to match package name.",
      "allOf": [
        {
          "$comment": "https://learn.microsoft.com/en-us/vcpkg/reference/vcpkg-configuration-json#registry-packages",
          "description": "Package pattern may contain only lowercase letters, digits, and -, with an optional trailing *",
          "pattern": "^([a-z0-9]+-)*([a-z0-9]+[*]?|[*])$"
        },
        {
          "not": {
            "$ref": "#/$defs/reserved-name"
          }
        }
      ]
    },
    "platform-expression": {
      "description": "A specification of a set of platforms. See <https://learn.microsoft.com/vcpkg/reference/vcpkg-json#platform-expression>.",
      "type": "string"
    },
    "port-version": {
      "description": "A non-negative integer indicating the port revision. If this field doesn't exist, it's assumed to be `0`.",
      "type": "integer",
      "minimum": 0,
      "default": 0
    },
    "registry-array": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/registry-item"
      }
    },
    "registry-item": {
      "type": "object",
      "allOf": [
        {
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "builtin",
                "git",
                "filesystem",
                "artifact"
              ]
            }
          }
        },
        {
          "oneOf": [
            {
              "$ref": "#/$defs/artifact-registry"
            },
            {
              "allOf": [
                {
                  "properties": {
                    "packages": {
                      "type": "array",
                      "items": {
                        "$ref": "#/$defs/package-pattern"
                      }
                    }
                  },
                  "required": [
                    "packages"
                  ],
                  "type": "object"
                },
                {
                  "anyOf": [
                    {
                      "$ref": "#/$defs/builtin-registry"
                    },
                    {
                      "$ref": "#/$defs/git-registry"
                    },
                    {
                      "$ref": "#/$defs/filesystem-registry"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    },
    "reserved-name": {
      "description": "Vcpkg reserved identifier names for lowercase.",
      "type": "string",
      "anyOf": [
        {
          "description": "Vcpkg reserved names.",
          "pattern": "^(core|default)$"
        },
        {
          "$comment": "https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions",
          "description": "A relaxed pattern of Win32 filesystem reserved names.",
          "pattern": "^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\\.[^.]+)*$"
        }
      ]
    },
    "semantic-version": {
      "description": "A semantic version string. See <https://semver.org/>",
      "type": "string",
      "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
    },
    "sha1": {
      "type": "string",
      "pattern": "^[0-9a-fA-F]{40}$"
    },
    "sha256": {
      "type": "string",
      "pattern": "^[0-9a-fA-F]{64}$"
    },
    "sha512": {
      "type": "string",
      "pattern": "^[0-9a-fA-F]{128}$"
    },
    "slash-identifier": {
      "type": "string",
      "description": "Slash identifiers are used for artifact names.",
      "allOf": [
        {
          "description": "Slash identifiers are lowercase with digits, dashes, and forward slashes.",
          "pattern": "^[a-z0-9]+([/-][a-z0-9]+)*$"
        },
        {
          "not": {
            "description": "Identifiers and parts delimited by slashes must not be a Windows filesystem or vcpkg reserved name.",
            "pattern": "(^|/)(prn|aux|nul|con|lpt[0-9]|com[0-9]|core|default)(/|$)"
          }
        }
      ]
    },
    "string-or-strings": {
      "if": {
        "type": "string"
      },
      "then": true,
      "else": {
        "type": "array",
        "items": {
          "type": "string"
        }
      }
    },
    "string-array": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "string-map": {
      "type": "object",
      "patternProperties": {
        "": {
          "type": "string"
        }
      }
    },
    "strings-map": {
      "type": "object",
      "patternProperties": {
        "": {
          "$ref": "#/$defs/string-or-strings"
        }
      }
    },
    "uri-or-uris": {
      "if": {
        "type": "string"
      },
      "then": {
        "type": "string",
        "format": "uri"
      },
      "else": {
        "type": "array",
        "items": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  }
}
