{
  "$id": "https://law.arxo.io/schema/feature-registry.schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "Registry of language versions and feature gates (work package WP-32). Normative source for every implementation: the compiler must require the EXACT `language … version` and reject a program that uses a semantically active feature it does not know. The registry is data, not code: adding a feature means editing this file plus a migration note.",
  "$comment": "SPEC §26; SPEC §266.1–§266.3",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "schemaVersion": {
      "const": "law.core.features/0.1"
    },
    "languageName": {
      "description": "Canonical language name in the file header: `language \"<languageName>\" version \"<version>\";`. Exactly one spelling — otherwise the \"exact version\" requirement has no meaning.",
      "$comment": "SPEC §22; SPEC §266.1",
      "type": "string",
      "minLength": 1
    },
    "languageVersions": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["version", "status", "semanticsId"],
        "properties": {
          "version": {
            "description": "Version string in the file header (major.minor[.patch]).",
            "$comment": "SPEC §266.1",
            "pattern": "^(?:[0-9]+\\.[0-9]+(?:\\.[0-9]+)?|0\\.2-draft)$",
            "type": "string"
          },
          "status": {
            "description": "`supported` — the compiler accepts it; `deprecated` — accepted with a warning and a migration note; `withdrawn` — rejected.",
            "enum": ["supported", "deprecated", "withdrawn"]
          },
          "semanticsId": {
            "description": "Semantics identifier for the lockfile (`languageSemantics`) and the case model (`semantics`).",
            "type": "string",
            "minLength": 1
          },
          "migrationNote": {
            "description": "What changed relative to the previous version — the text of the migration report.",
            "$comment": "SPEC §266.1",
            "type": "string"
          }
        }
      }
    },
    "features": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "status", "semantic", "since", "summary"],
        "properties": {
          "id": {
            "description": "Feature-gate identifier used in `@requires_feature(\"…\")`.",
            "$comment": "SPEC §26",
            "pattern": "^[a-z][a-z0-9_.]*/[0-9]+\\.[0-9]+$",
            "type": "string"
          },
          "status": {
            "description": "`active` — implemented and available; `reserved` — declared but not implemented (a semantically active reserved feature must be rejected); `deprecated` — available with a warning.",
            "$comment": "SPEC §26",
            "enum": ["active", "reserved", "deprecated"]
          },
          "semantic": {
            "description": "Whether the feature is semantically active. `true` — its absence changes the program's meaning, so the compiler MUST reject it. `false` — informational: being unknown produces a warning, not a rejection.",
            "$comment": "SPEC §26",
            "type": "boolean"
          },
          "since": {
            "description": "The language version in which the feature appeared.",
            "pattern": "^[0-9]+\\.[0-9]+(\\.[0-9]+)?$",
            "type": "string"
          },
          "summary": {
            "type": "string",
            "minLength": 1
          },
          "reference": {
            "description": "Normative reference: a specification section, a decision record, or a correction note.",
            "type": "string"
          }
        }
      }
    }
  },
  "required": ["schemaVersion", "languageName", "languageVersions", "features"]
}
