{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/red-hat/main/json-schema/red-hat-rule-schema.json",
  "title": "Rule",
  "description": "An Advisor rule that defines detection logic for a specific system issue, along with resolution steps and remediation guidance.",
  "x-generated": "2026-10-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/red-hat-rules-api-openapi.yml#/components/schemas/Rule",
  "type": "object",
  "properties": {
    "rule_id": {
      "type": "string",
      "description": "The unique identifier of the rule."
    },
    "description": {
      "type": "string",
      "description": "A description of what the rule detects."
    },
    "active": {
      "type": "boolean",
      "description": "Whether the rule is currently active."
    },
    "category": {
      "type": "object",
      "description": "The category the rule belongs to.",
      "properties": {
        "id": {
          "type": "integer",
          "description": "The category identifier."
        },
        "name": {
          "type": "string",
          "description": "The category name.",
          "enum": [
            "Availability",
            "Security",
            "Stability",
            "Performance"
          ]
        }
      }
    },
    "impact": {
      "type": "object",
      "description": "The impact level of the rule.",
      "properties": {
        "name": {
          "type": "string"
        },
        "value": {
          "type": "integer"
        }
      }
    },
    "likelihood": {
      "type": "integer",
      "description": "The likelihood value (1-4)."
    },
    "total_risk": {
      "type": "integer",
      "description": "The calculated total risk score."
    },
    "risk_of_change": {
      "type": "integer",
      "description": "The risk associated with applying the remediation."
    },
    "has_playbook": {
      "type": "boolean",
      "description": "Whether an Ansible remediation playbook is available."
    },
    "publish_date": {
      "type": "string",
      "format": "date-time",
      "description": "When the rule was published."
    },
    "systems_affected": {
      "type": "integer",
      "description": "The number of systems currently affected by this rule."
    },
    "resolution_set": {
      "type": "array",
      "description": "Available resolution options for the rule.",
      "items": {
        "type": "object",
        "properties": {
          "system_type": {
            "type": "integer",
            "description": "The system type identifier."
          },
          "resolution": {
            "type": "string",
            "description": "The resolution description in markdown format."
          },
          "has_playbook": {
            "type": "boolean",
            "description": "Whether this resolution has a playbook."
          }
        }
      }
    }
  }
}