{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/anomalyarmor-ai/json-schema/anomalyarmor-ai-app-domains-feature-alerts-api-v1-alert-rules-update-alert-rule-request-schema.json",
  "title": "UpdateAlertRuleRequest",
  "description": "Request schema for updating an alert rule.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/anomalyarmor-ai-alert-rules-api-openapi.yml#/components/schemas/app__domains__feature__alerts__api__v1__alert_rules__UpdateAlertRuleRequest",
  "properties": {
    "name": {
      "anyOf": [
        {
          "type": "string",
          "maxLength": 255,
          "minLength": 1
        },
        {
          "type": "null"
        }
      ],
      "title": "Name"
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Description"
    },
    "is_active": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Is Active"
    },
    "cooldown_minutes": {
      "anyOf": [
        {
          "type": "integer",
          "maximum": 10080.0,
          "minimum": 1.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Cooldown Minutes"
    },
    "max_alerts_per_day": {
      "anyOf": [
        {
          "type": "integer",
          "maximum": 1000.0,
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Max Alerts Per Day"
    },
    "event_types": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Event Types"
    },
    "severities": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Severities"
    },
    "asset_ids": {
      "anyOf": [
        {
          "items": {
            "type": "string",
            "format": "uuid"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Asset Ids"
    },
    "grouping": {
      "anyOf": [
        {
          "$ref": "#/$defs/GroupingConfig"
        },
        {
          "type": "null"
        }
      ]
    },
    "is_notify_code_authors": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Is Notify Code Authors"
    },
    "code_author_min_confidence": {
      "anyOf": [
        {
          "type": "number",
          "maximum": 1.0,
          "minimum": 0.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Code Author Min Confidence"
    },
    "operating_schedule_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Operating Schedule Id"
    },
    "schema_change_config": {
      "anyOf": [
        {
          "$ref": "#/$defs/SchemaChangeConfig"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "type": "object",
  "$defs": {
    "GroupingConfig": {
      "properties": {
        "enabled": {
          "type": "boolean",
          "title": "Enabled",
          "description": "Whether to enable alert grouping for this rule",
          "default": false
        },
        "window_minutes": {
          "type": "integer",
          "maximum": 1440.0,
          "minimum": 5.0,
          "title": "Window Minutes",
          "description": "Time window for collecting alerts to group (5-1440 minutes)",
          "default": 60
        },
        "min_alerts_to_group": {
          "type": "integer",
          "maximum": 100.0,
          "minimum": 2.0,
          "title": "Min Alerts To Group",
          "description": "Minimum alerts before grouping kicks in (2-100)",
          "default": 2
        }
      },
      "type": "object",
      "title": "GroupingConfig",
      "description": "Configuration for alert grouping/digest behavior.\n\nWhen enabled, alerts are grouped into digest notifications to prevent alert fatigue.\nThe first alert always sends immediately; subsequent alerts within the window are grouped.\n\nExample:\n    {\n        \"enabled\": true,\n        \"window_minutes\": 60,\n        \"min_alerts_to_group\": 2\n    }"
    },
    "SchemaChangeConfig": {
      "properties": {
        "trigger_on": {
          "type": "string",
          "enum": [
            "any",
            "breaking",
            "non_breaking",
            "specific_types"
          ],
          "title": "Trigger On"
        },
        "change_types": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Change Types"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "trigger_on"
      ],
      "title": "SchemaChangeConfig",
      "description": "Per-rule trigger configuration for schema_change event-type rules.\n\nScopes which kinds of detected schema change should fire the rule.\nNormalization rules enforced by validators:\n\n- `trigger_on=\"any\"` with no `change_types` is the default-equivalent state.\n  Callers should normally send `null` for that case; the API accepts either.\n- `trigger_on=\"specific_types\"` requires a non-empty `change_types` list\n  whose values all appear in the backend `ChangeType` enum.\n- Any other value of `trigger_on` must not carry `change_types`.\n\nThe evaluation service reads this alongside the schema alert service's\n`change_types_present` context projection (TECH-963)."
    }
  }
}