From 8ceb869ceded659700f8c7c82fe756da8c1b4ce8 Mon Sep 17 00:00:00 2001 From: ysyneu Date: Mon, 24 Aug 2026 20:27:36 -0700 Subject: [PATCH] fix(openapi): alert pipeline `if` and `alert_inhibit.source_filters` are AND-lists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The server models both fields as a single AND group — a flat list of conditions — but the spec pointed them at OrFilterGroup, whose shape is an OR-of-AND nesting. Generated clients therefore fail to decode any alert pipeline that carries an `if` condition: json: cannot unmarshal object into Go struct field AlertPipeline.rules.if of type []FilterCondition Point both at a flat array of FilterCondition, matching how EnrichRule.if and RouteCase.if already describe the same server type. OrFilterGroup itself is unchanged: the silence / inhibit / drop / escalation rules that reference it through FilterGroup really are OR-of-AND, and those decode correctly today. --- api-reference/on-call.openapi.en.json | 14 ++++++++++---- api-reference/on-call.openapi.zh.json | 14 ++++++++++---- api-reference/openapi.en.json | 14 ++++++++++---- api-reference/openapi.zh.json | 14 ++++++++++---- 4 files changed, 40 insertions(+), 16 deletions(-) diff --git a/api-reference/on-call.openapi.en.json b/api-reference/on-call.openapi.en.json index 4cd686c..981d5f1 100644 --- a/api-reference/on-call.openapi.en.json +++ b/api-reference/on-call.openapi.en.json @@ -18490,8 +18490,11 @@ "description": "Rule type. Rules run in array order; when the `if` condition matches, the event is processed according to `kind`.\n| Value | Meaning |\n|---|---|\n| `title_reset` | Rewrites the event title from the `settings.title` template. |\n| `description_reset` | Rewrites the event description from the `settings.description` template. |\n| `severity_reset` | Resets the event severity and status to `settings.severity` (`Critical`/`Warning`/`Info`). |\n| `alert_drop` | Discards the matching event outright; no alert is created. |\n| `alert_inhibit` | Discards the event (inhibition) when an active source alert matching `settings.source_filters` and correlated via `settings.equals` exists. |" }, "if": { - "$ref": "#/components/schemas/OrFilterGroup", - "description": "Optional OR-of-AND filter. When omitted, the rule applies to all alerts." + "type": "array", + "items": { + "$ref": "#/components/schemas/FilterCondition" + }, + "description": "Optional AND-filter list — the rule applies only when every condition matches. Omit to apply the rule to all alerts." }, "settings": { "type": "object", @@ -18642,8 +18645,11 @@ "description": "Label keys whose values must be equal between the source and current alert for inhibition to apply." }, "source_filters": { - "$ref": "#/components/schemas/OrFilterGroup", - "description": "Filter that identifies the source alerts to inhibit." + "type": "array", + "items": { + "$ref": "#/components/schemas/FilterCondition" + }, + "description": "AND-filter list identifying the source alerts to inhibit — every condition must match." } } }, diff --git a/api-reference/on-call.openapi.zh.json b/api-reference/on-call.openapi.zh.json index 3491b2a..4ff1aad 100644 --- a/api-reference/on-call.openapi.zh.json +++ b/api-reference/on-call.openapi.zh.json @@ -18482,8 +18482,11 @@ "description": "规则类型。规则按数组顺序依次执行,`if` 条件命中后按 `kind` 处理事件。\n| 值 | 含义 |\n|---|---|\n| `title_reset` | 按 `settings.title` 模板重写事件标题。 |\n| `description_reset` | 按 `settings.description` 模板重写事件描述。 |\n| `severity_reset` | 将事件严重程度与状态重置为 `settings.severity`(`Critical`/`Warning`/`Info`)。 |\n| `alert_drop` | 直接丢弃匹配的事件,不生成告警。 |\n| `alert_inhibit` | 当存在匹配 `settings.source_filters` 且按 `settings.equals` 关联的活跃源告警时,丢弃该事件(抑制)。 |" }, "if": { - "$ref": "#/components/schemas/OrFilterGroup", - "description": "可选的过滤条件,省略时对所有告警生效。" + "type": "array", + "items": { + "$ref": "#/components/schemas/FilterCondition" + }, + "description": "可选 AND 过滤条件列表,全部条件匹配时规则才生效;省略时对所有告警生效。" }, "settings": { "type": "object", @@ -18634,8 +18637,11 @@ "description": "需要在来源告警与当前告警之间值相等的标签键列表。" }, "source_filters": { - "$ref": "#/components/schemas/OrFilterGroup", - "description": "用于匹配待抑制来源告警的过滤条件。" + "type": "array", + "items": { + "$ref": "#/components/schemas/FilterCondition" + }, + "description": "用于匹配待抑制来源告警的 AND 过滤条件列表,需全部条件匹配。" } } }, diff --git a/api-reference/openapi.en.json b/api-reference/openapi.en.json index 5536d93..bdd4e50 100644 --- a/api-reference/openapi.en.json +++ b/api-reference/openapi.en.json @@ -37578,8 +37578,11 @@ "description": "Rule type. Rules run in array order; when the `if` condition matches, the event is processed according to `kind`.\n| Value | Meaning |\n|---|---|\n| `title_reset` | Rewrites the event title from the `settings.title` template. |\n| `description_reset` | Rewrites the event description from the `settings.description` template. |\n| `severity_reset` | Resets the event severity and status to `settings.severity` (`Critical`/`Warning`/`Info`). |\n| `alert_drop` | Discards the matching event outright; no alert is created. |\n| `alert_inhibit` | Discards the event (inhibition) when an active source alert matching `settings.source_filters` and correlated via `settings.equals` exists. |" }, "if": { - "$ref": "#/components/schemas/OrFilterGroup", - "description": "Optional OR-of-AND filter. When omitted, the rule applies to all alerts." + "type": "array", + "items": { + "$ref": "#/components/schemas/FilterCondition" + }, + "description": "Optional AND-filter list — the rule applies only when every condition matches. Omit to apply the rule to all alerts." }, "settings": { "type": "object", @@ -37854,8 +37857,11 @@ "description": "Label keys whose values must be equal between the source and current alert for inhibition to apply." }, "source_filters": { - "$ref": "#/components/schemas/OrFilterGroup", - "description": "Filter that identifies the source alerts to inhibit." + "type": "array", + "items": { + "$ref": "#/components/schemas/FilterCondition" + }, + "description": "AND-filter list identifying the source alerts to inhibit — every condition must match." } } }, diff --git a/api-reference/openapi.zh.json b/api-reference/openapi.zh.json index 8c68fbf..0379834 100644 --- a/api-reference/openapi.zh.json +++ b/api-reference/openapi.zh.json @@ -37569,8 +37569,11 @@ "description": "规则类型。规则按数组顺序依次执行,`if` 条件命中后按 `kind` 处理事件。\n| 值 | 含义 |\n|---|---|\n| `title_reset` | 按 `settings.title` 模板重写事件标题。 |\n| `description_reset` | 按 `settings.description` 模板重写事件描述。 |\n| `severity_reset` | 将事件严重程度与状态重置为 `settings.severity`(`Critical`/`Warning`/`Info`)。 |\n| `alert_drop` | 直接丢弃匹配的事件,不生成告警。 |\n| `alert_inhibit` | 当存在匹配 `settings.source_filters` 且按 `settings.equals` 关联的活跃源告警时,丢弃该事件(抑制)。 |" }, "if": { - "$ref": "#/components/schemas/OrFilterGroup", - "description": "可选的过滤条件,省略时对所有告警生效。" + "type": "array", + "items": { + "$ref": "#/components/schemas/FilterCondition" + }, + "description": "可选 AND 过滤条件列表,全部条件匹配时规则才生效;省略时对所有告警生效。" }, "settings": { "type": "object", @@ -37845,8 +37848,11 @@ "description": "需要在来源告警与当前告警之间值相等的标签键列表。" }, "source_filters": { - "$ref": "#/components/schemas/OrFilterGroup", - "description": "用于匹配待抑制来源告警的过滤条件。" + "type": "array", + "items": { + "$ref": "#/components/schemas/FilterCondition" + }, + "description": "用于匹配待抑制来源告警的 AND 过滤条件列表,需全部条件匹配。" } } },