From bc617a54c1e2e846346d23c71924ef9a1a7a50c9 Mon Sep 17 00:00:00 2001 From: ysyneu Date: Mon, 24 Aug 2026 20:32:59 -0700 Subject: [PATCH] docs(openapi): give alert pipeline examples a real `if` shape MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The three alert-pipeline examples all used `"if": null` or an empty `rules` array, so nothing in them exercised the filter field. Generated clients validate their model layer by decoding these canonical examples, and a null decodes into any shape — which is why the `if` field could carry the wrong type without any example failing. Give the examples the shapes the endpoints actually return: - `pipeline/info` and `pipeline/upsert`: a `title_reset` rule with an `if` condition and a `[TPL]` title template, alongside the existing unconditional `severity_reset`. - `pipeline/list`: an `alert_inhibit` rule, so `settings.source_filters` is covered too. Both fields now decode from a real payload rather than from `null`. --- api-reference/on-call.openapi.en.json | 59 ++++++++++++++++++++++++++- api-reference/on-call.openapi.zh.json | 59 ++++++++++++++++++++++++++- api-reference/openapi.en.json | 59 ++++++++++++++++++++++++++- api-reference/openapi.zh.json | 59 ++++++++++++++++++++++++++- 4 files changed, 232 insertions(+), 4 deletions(-) diff --git a/api-reference/on-call.openapi.en.json b/api-reference/on-call.openapi.en.json index 981d5f1..47fd4c3 100644 --- a/api-reference/on-call.openapi.en.json +++ b/api-reference/on-call.openapi.en.json @@ -1037,6 +1037,21 @@ "example": { "integration_id": 10001, "rules": [ + { + "kind": "title_reset", + "if": [ + { + "key": "labels.env", + "oper": "IN", + "vals": [ + "prod" + ] + } + ], + "settings": { + "title": "[TPL]{{.Labels.service}} / {{.Labels.check}}" + } + }, { "kind": "severity_reset", "if": null, @@ -3940,6 +3955,21 @@ "data": { "integration_id": 10001, "rules": [ + { + "kind": "title_reset", + "if": [ + { + "key": "labels.env", + "oper": "IN", + "vals": [ + "prod" + ] + } + ], + "settings": { + "title": "[TPL]{{.Labels.service}} / {{.Labels.check}}" + } + }, { "kind": "severity_reset", "if": null, @@ -7212,7 +7242,34 @@ "items": [ { "integration_id": 10001, - "rules": [], + "rules": [ + { + "kind": "alert_inhibit", + "if": [ + { + "key": "labels.cluster", + "oper": "IN", + "vals": [ + "prod-cn" + ] + } + ], + "settings": { + "equals": [ + "service" + ], + "source_filters": [ + { + "key": "alert_severity", + "oper": "IN", + "vals": [ + "Critical" + ] + } + ] + } + } + ], "status": "enabled", "creator_id": 80011, "updated_by": 80011, diff --git a/api-reference/on-call.openapi.zh.json b/api-reference/on-call.openapi.zh.json index 4ff1aad..d85c198 100644 --- a/api-reference/on-call.openapi.zh.json +++ b/api-reference/on-call.openapi.zh.json @@ -1037,6 +1037,21 @@ "example": { "integration_id": 10001, "rules": [ + { + "kind": "title_reset", + "if": [ + { + "key": "labels.env", + "oper": "IN", + "vals": [ + "prod" + ] + } + ], + "settings": { + "title": "[TPL]{{.Labels.service}} / {{.Labels.check}}" + } + }, { "kind": "severity_reset", "if": null, @@ -3940,6 +3955,21 @@ "data": { "integration_id": 10001, "rules": [ + { + "kind": "title_reset", + "if": [ + { + "key": "labels.env", + "oper": "IN", + "vals": [ + "prod" + ] + } + ], + "settings": { + "title": "[TPL]{{.Labels.service}} / {{.Labels.check}}" + } + }, { "kind": "severity_reset", "if": null, @@ -7212,7 +7242,34 @@ "items": [ { "integration_id": 10001, - "rules": [], + "rules": [ + { + "kind": "alert_inhibit", + "if": [ + { + "key": "labels.cluster", + "oper": "IN", + "vals": [ + "prod-cn" + ] + } + ], + "settings": { + "equals": [ + "service" + ], + "source_filters": [ + { + "key": "alert_severity", + "oper": "IN", + "vals": [ + "Critical" + ] + } + ] + } + } + ], "status": "enabled", "creator_id": 80011, "updated_by": 80011, diff --git a/api-reference/openapi.en.json b/api-reference/openapi.en.json index bdd4e50..4edc9eb 100644 --- a/api-reference/openapi.en.json +++ b/api-reference/openapi.en.json @@ -6362,6 +6362,21 @@ "data": { "integration_id": 10001, "rules": [ + { + "kind": "title_reset", + "if": [ + { + "key": "labels.env", + "oper": "IN", + "vals": [ + "prod" + ] + } + ], + "settings": { + "title": "[TPL]{{.Labels.service}} / {{.Labels.check}}" + } + }, { "kind": "severity_reset", "if": null, @@ -6449,7 +6464,34 @@ "items": [ { "integration_id": 10001, - "rules": [], + "rules": [ + { + "kind": "alert_inhibit", + "if": [ + { + "key": "labels.cluster", + "oper": "IN", + "vals": [ + "prod-cn" + ] + } + ], + "settings": { + "equals": [ + "service" + ], + "source_filters": [ + { + "key": "alert_severity", + "oper": "IN", + "vals": [ + "Critical" + ] + } + ] + } + } + ], "status": "enabled", "creator_id": 80011, "updated_by": 80011, @@ -6558,6 +6600,21 @@ "example": { "integration_id": 10001, "rules": [ + { + "kind": "title_reset", + "if": [ + { + "key": "labels.env", + "oper": "IN", + "vals": [ + "prod" + ] + } + ], + "settings": { + "title": "[TPL]{{.Labels.service}} / {{.Labels.check}}" + } + }, { "kind": "severity_reset", "if": null, diff --git a/api-reference/openapi.zh.json b/api-reference/openapi.zh.json index 0379834..3948a5e 100644 --- a/api-reference/openapi.zh.json +++ b/api-reference/openapi.zh.json @@ -6362,6 +6362,21 @@ "data": { "integration_id": 10001, "rules": [ + { + "kind": "title_reset", + "if": [ + { + "key": "labels.env", + "oper": "IN", + "vals": [ + "prod" + ] + } + ], + "settings": { + "title": "[TPL]{{.Labels.service}} / {{.Labels.check}}" + } + }, { "kind": "severity_reset", "if": null, @@ -6449,7 +6464,34 @@ "items": [ { "integration_id": 10001, - "rules": [], + "rules": [ + { + "kind": "alert_inhibit", + "if": [ + { + "key": "labels.cluster", + "oper": "IN", + "vals": [ + "prod-cn" + ] + } + ], + "settings": { + "equals": [ + "service" + ], + "source_filters": [ + { + "key": "alert_severity", + "oper": "IN", + "vals": [ + "Critical" + ] + } + ] + } + } + ], "status": "enabled", "creator_id": 80011, "updated_by": 80011, @@ -6558,6 +6600,21 @@ "example": { "integration_id": 10001, "rules": [ + { + "kind": "title_reset", + "if": [ + { + "key": "labels.env", + "oper": "IN", + "vals": [ + "prod" + ] + } + ], + "settings": { + "title": "[TPL]{{.Labels.service}} / {{.Labels.check}}" + } + }, { "kind": "severity_reset", "if": null,