{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://hushspec.org/schemas/hushspec-framework-registry.v1.schema.json",
  "title": "HushSpec Framework Registry v1",
  "description": "Schema for spec/registries/frameworks.yaml, the registry of compliance frameworks that metadata.controls[].framework may name.",
  "type": "object",
  "required": [
    "registry_version",
    "frameworks"
  ],
  "additionalProperties": false,
  "properties": {
    "registry_version": {
      "type": "string",
      "pattern": "^0\\.\\d+\\.\\d+$",
      "description": "Registry format version."
    },
    "frameworks": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/Framework"
      },
      "description": "Registered frameworks, ordered by id."
    }
  },
  "$defs": {
    "Framework": {
      "type": "object",
      "required": [
        "id",
        "name",
        "version",
        "url",
        "control_id_pattern"
      ],
      "additionalProperties": false,
      "description": "One registered compliance framework.",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9][a-z0-9.-]*$",
          "description": "Framework identifier used by metadata.controls[].framework."
        },
        "name": {
          "type": "string",
          "minLength": 1,
          "description": "Human-readable framework name."
        },
        "version": {
          "type": "string",
          "minLength": 1,
          "description": "Edition, revision, or publication year the ids in this registry entry refer to."
        },
        "url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://",
          "description": "Canonical location of the framework text."
        },
        "control_id_pattern": {
          "type": "string",
          "minLength": 1,
          "description": "Anchored regular expression (HushSpec regex profile) that every control_id for this framework must match."
        }
      }
    }
  }
}
