{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://relgap.sasskovacs.dev/schemas/registry-v1.json",
  "title": "relgap registry entry",
  "description": "One file per tool in registry/<name>.yaml. Check an entry with `relgap registry lint`.",
  "type": "object",
  "additionalProperties": false,
  "required": ["name", "repo"],
  "properties": {
    "name": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9._-]*$",
      "description": "Canonical tool name; must match the file name."
    },
    "aliases": {
      "type": "array",
      "uniqueItems": true,
      "items": { "type": "string", "minLength": 1 },
      "description": "Other names that resolve to this tool, such as tf or KUBECTL_VERSION."
    },
    "repo": {
      "type": "string",
      "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$",
      "description": "GitHub owner/repo."
    },
    "min_relgap": {
      "type": "string",
      "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$",
      "description": "Oldest relgap version that understands this entry."
    },
    "version": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "scheme": {
          "enum": ["semver", "loose", "calver", "python", "regex"],
          "description": "How tags are parsed and ordered. Default loose."
        },
        "extract": {
          "type": "string",
          "minLength": 1,
          "description": "Regular expression for scheme regex; capture groups are joined with dots."
        },
        "tag_prefix": {
          "type": ["string", "array"],
          "items": { "type": "string" },
          "minItems": 1,
          "uniqueItems": true,
          "description": "Stripped from tags before parsing; tags without it are ignored. A list names every prefix the tags have used, newest first: the longest one a tag starts with is stripped, and \"\" takes unprefixed tags."
        },
        "exclude": {
          "type": "string",
          "minLength": 1,
          "description": "Regular expression on the tag; matching tags are ignored."
        },
        "universe": {
          "enum": ["releases", "tags"],
          "description": "What defines the versions in a range. Default releases."
        },
        "line": {
          "enum": ["none", "major", "minor"],
          "description": "Default release line for the end of a range."
        }
      }
    },
    "sources": {
      "type": "array",
      "description": "Changelog sources, tried and merged in order. Empty means auto-discovery.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["kind"],
        "properties": {
          "kind": {
            "enum": ["gh-release", "changelog-file", "structured-json", "web-doc", "upgrade-guide", "upgrade-notes"]
          },
          "path_template": {
            "type": "string",
            "minLength": 1,
            "description": "File path in the repo. Placeholders: {version}, {major}, {minor} (the minor number alone) and {tag}; upgrade-guide also has {prev_minor} (such as 3.5) and {prev_major}."
          },
          "url_template": {
            "type": "string",
            "pattern": "^https://",
            "description": "https URL on a host relgap allows (go.dev, docs.python.org, api.adoptium.net); same placeholders as path_template."
          },
          "ref": {
            "type": "string",
            "minLength": 1,
            "description": "Git ref; may be a template such as v{major}.{minor}."
          },
          "heading": {
            "type": "string",
            "minLength": 1,
            "description": "Regular expression for a version's heading; {version} is replaced first."
          },
          "ignore_sections": {
            "description": "Headings, or heading paths joined with \" \u203a \", whose entries are dropped. A heading matches when it equals the item or starts with it and a space.",
            "type": "array",
            "items": { "type": "string", "minLength": 1 }
          },
          "from_heading": {
            "type": "string",
            "minLength": 1,
            "description": "Heading whose section holds the upgrade notes."
          },
          "content": {
            "type": "string",
            "minLength": 1,
            "description": "web-doc: selector (tag, #id and .class without spaces) of the element to convert. Default main, else body."
          },
          "strip": {
            "description": "web-doc: selectors of elements dropped before converting, such as a.headerlink.",
            "type": "array",
            "items": { "type": "string", "minLength": 1 }
          },
          "anchor": {
            "type": "string",
            "minLength": 1,
            "description": "web-doc: id of a version's element on the page, with the path_template placeholders, such as go{version}."
          },
          "site_url": {
            "type": "string",
            "pattern": "^https://",
            "description": "changelog-file: base URL of the project's Hugo site. Hugo ref and relref links in the file point at its pages; without it they keep their text and lose the link."
          },
          "content_dir": {
            "type": "string",
            "minLength": 1,
            "description": "changelog-file: the Hugo content directory in the repository, such as website/content/en. Default: the path up to the last content/ directory, plus a language directory after it."
          },
          "json": {
            "type": "object",
            "additionalProperties": false,
            "required": ["text"],
            "description": "structured-json: how each JSON document becomes entries.",
            "properties": {
              "items": { "type": "string", "description": "Dotted path to the array of entries; empty means the document is the array." },
              "heading": { "type": "string", "minLength": 1, "description": "Field whose value groups entries under a heading, such as type." },
              "text": { "type": "string", "minLength": 1, "description": "Entry text with {field} placeholders, such as {category}: {description}." },
              "link": { "type": "string", "minLength": 1, "description": "Field holding a URL for the entry." }
            }
          }
        },
        "dependentRequired": { "content_dir": ["site_url"] },
        "allOf": [
          {
            "if": { "properties": { "kind": { "const": "changelog-file" } } },
            "then": { "required": ["path_template"] }
          },
          {
            "if": { "required": ["site_url"] },
            "then": { "properties": { "kind": { "const": "changelog-file" } } }
          },
          {
            "if": { "properties": { "kind": { "const": "structured-json" } } },
            "then": { "required": ["json"], "anyOf": [{ "required": ["path_template"] }, { "required": ["url_template"] }] }
          },
          {
            "if": { "properties": { "kind": { "const": "web-doc" } } },
            "then": { "required": ["url_template"] }
          },
          {
            "if": { "properties": { "kind": { "const": "upgrade-guide" } } },
            "then": { "anyOf": [{ "required": ["path_template"] }, { "required": ["url_template"] }] }
          },
          {
            "if": { "properties": { "kind": { "const": "upgrade-notes" } } },
            "then": { "required": ["from_heading"] }
          }
        ]
      }
    },
    "eol": {
      "type": "object",
      "additionalProperties": false,
      "required": ["product"],
      "properties": {
        "product": { "type": "string", "minLength": 1, "description": "endoflife.date product." },
        "cycle": { "type": "string", "minLength": 1, "description": "Cycle template such as {major}.{minor}." }
      }
    },
    "osv": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["ecosystem", "name"],
        "properties": {
          "ecosystem": {
            "type": "string",
            "minLength": 1,
            "description": "OSV ecosystem such as Go, npm, PyPI or crates.io. GIT takes the repository URL as name and queries the version's tag."
          },
          "name": { "type": "string", "minLength": 1 }
        }
      }
    },
    "bin": {
      "type": "array",
      "uniqueItems": true,
      "items": { "type": "string", "pattern": "^[A-Za-z0-9._-]+$" },
      "description": "Executable names that outdated --binaries looks for. Empty means the tool name."
    },
    "breaking_markers": {
      "type": "array",
      "items": { "type": "string", "minLength": 1 },
      "description": "Regular expressions; an entry whose text matches one is breaking, such as ACTION REQUIRED."
    }
  }
}
