{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/decide-fyi/json-schema/decide-fyi-rulebook-registry-metadata-schema.json",
  "title": "RulebookRegistryMetadata",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/decide-fyi-registries-api-openapi.yml#/components/schemas/RulebookRegistryMetadata",
  "type": "object",
  "required": [
    "rulebook_registry_version",
    "schema_version",
    "rulebook_id",
    "version",
    "hash",
    "evaluator_version",
    "hash_algorithm",
    "canonicalization",
    "scope_hash",
    "registry_attestation",
    "registered_at"
  ],
  "properties": {
    "rulebook_registry_version": {
      "type": "string",
      "const": "decision_rulebook_registry_v1"
    },
    "schema_version": {
      "type": "string",
      "const": "rulebook_v1"
    },
    "rulebook_id": {
      "type": "string"
    },
    "version": {
      "type": "string"
    },
    "hash": {
      "type": "string",
      "minLength": 64,
      "maxLength": 64
    },
    "evaluator_version": {
      "type": "string"
    },
    "trusted_adapter": {
      "$ref": "#/$defs/TrustedAdapterDependency"
    },
    "hash_algorithm": {
      "type": "string",
      "const": "sha256"
    },
    "canonicalization": {
      "type": "string",
      "const": "json.sort_deep.v1"
    },
    "scope_hash": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "registry_attestation": {
      "$ref": "#/$defs/RegistryAttestation"
    },
    "registered_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "additionalProperties": false,
  "$defs": {
    "RegistryAttestation": {
      "type": "object",
      "required": [
        "registry_attestation_version",
        "status",
        "attestation_hash"
      ],
      "properties": {
        "registry_attestation_version": {
          "type": "string",
          "const": "decision_registry_attestation_v1"
        },
        "status": {
          "type": "string",
          "enum": [
            "signed",
            "unsigned"
          ]
        },
        "attestation_hash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "key_id": {
          "type": "string"
        },
        "signature_algorithm": {
          "type": "string",
          "const": "ed25519"
        },
        "signature": {
          "type": "string",
          "pattern": "^ed25519:"
        },
        "public_key": {
          "type": "string"
        },
        "public_key_fingerprint": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      },
      "additionalProperties": false
    },
    "TrustedAdapterDependency": {
      "type": "object",
      "required": [
        "manifest_version",
        "adapter_id",
        "version",
        "implementation_revision",
        "implementation_hash",
        "manifest_hash"
      ],
      "properties": {
        "manifest_version": {
          "type": "string",
          "const": "trusted_adapter_manifest_v1"
        },
        "adapter_id": {
          "type": "string"
        },
        "version": {
          "type": "string"
        },
        "implementation_revision": {
          "type": "string"
        },
        "implementation_hash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "manifest_hash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      },
      "additionalProperties": false
    }
  }
}