From 851ba8cf764498b8baa2cbdb8dd9a609b175eaa3 Mon Sep 17 00:00:00 2001 From: ysyneu <9045284+ysyneu@users.noreply.github.com> Date: Fri, 9 Oct 2026 07:22:44 +0000 Subject: [PATCH] chore: sync OpenAPI spec from flashduty-docs + regenerate --- models_gen.go | 18 ++++++--- openapi/openapi.en.json | 37 ++++++++++++++--- openapi/openapi.zh.json | 89 +++++++++++++++++++++++++++-------------- 3 files changed, 103 insertions(+), 41 deletions(-) diff --git a/models_gen.go b/models_gen.go index 1d36a16..3692ce9 100644 --- a/models_gen.go +++ b/models_gen.go @@ -2966,6 +2966,14 @@ type DashboardIDRequest struct { DashboardID string `json:"dashboard_id" toon:"dashboard_id"` } +// DashboardIncidentListViz is generated from the Flashduty OpenAPI schema. +type DashboardIncidentListViz struct { + // Visualization kind discriminator; always `incident_list`. + Kind string `json:"kind" toon:"kind"` + // Open options object for the chosen visualization kind; the only part of the definition that round-trips losslessly. Missing or null normalizes to `{}`. + Options map[string]any `json:"options" toon:"options"` +} + // DashboardInvestigationTarget is generated from the Flashduty OpenAPI schema. type DashboardInvestigationTarget struct { // Target dashboard ID; must be a canonical UUIDv7. @@ -3164,7 +3172,7 @@ type DashboardOutlineVariable struct { // DashboardOutlineVizConfig is generated from the Flashduty OpenAPI schema. type DashboardOutlineVizConfig struct { - // Visualization kind: `time_series` = time series; `table` = table; `stat` = single value; `bar` = bar chart; `gauge` = gauge; `logs` = log stream; `text` = Markdown text. + // Visualization kind: `time_series` = time series; `table` = table; `stat` = single value; `bar` = bar chart; `gauge` = gauge; `logs` = log stream; `text` = Markdown text; `incident_list` = incident list. Kind string `json:"kind" toon:"kind"` } @@ -3176,7 +3184,7 @@ type DashboardPanel struct { Grid DashboardGridPosition `json:"grid" toon:"grid"` // Canonical UUIDv7 identifying the panel; unique across the definition. ID string `json:"id" toon:"id"` - // Queries in the panel. `time_series` accepts 1–26, `text` accepts none, every other kind accepts exactly one. + // Queries in the panel. `time_series` accepts 1–26, `text` and `incident_list` accept none, every other kind accepts exactly one. Queries []DashboardPanelQuery `json:"queries" toon:"queries"` // Panel title. Title string `json:"title" toon:"title"` @@ -3771,7 +3779,7 @@ type DashboardVizConfig struct { Decimals *int64 `json:"decimals,omitempty" toon:"decimals,omitempty"` // Log fields rendered for each row. DisplayFields []string `json:"display_fields,omitempty" toon:"display_fields,omitempty"` - // Visualization kind discriminator; always `text`. + // Visualization kind discriminator; always `incident_list`. Kind string `json:"kind" toon:"kind"` // Drill-down links rendered as table columns. Together with per-column links a table allows at most 5. LinkColumns []DashboardDataLink `json:"link_columns,omitempty" toon:"link_columns,omitempty"` @@ -5160,8 +5168,8 @@ type IncidentFeedItem struct { CreatedAt TimestampMilli `json:"created_at" toon:"created_at"` // User ID of the actor. `0` means system-generated. CreatorID int64 `json:"creator_id" toon:"creator_id"` - // Soft-delete timestamp (ms). Zero if not deleted. - DeletedAt Timestamp `json:"deleted_at" toon:"deleted_at"` + // Soft-delete timestamp in milliseconds. Zero if not deleted. + DeletedAt TimestampMilli `json:"deleted_at" toon:"deleted_at"` // Type-specific payload. The concrete shape is determined by `type`; `null` when the entry has no structured detail. Detail any `json:"detail" toon:"detail"` // ObjectID of the source alert or incident this entry references. diff --git a/openapi/openapi.en.json b/openapi/openapi.en.json index d7d57a3..d4c919c 100644 --- a/openapi/openapi.en.json +++ b/openapi/openapi.en.json @@ -11387,7 +11387,7 @@ "type": "integer" }, "deleted_at": { - "description": "Soft-delete timestamp (ms). Zero if not deleted.", + "description": "Soft-delete timestamp in milliseconds. Zero if not deleted.", "format": "int64", "type": "integer" }, @@ -29665,7 +29665,7 @@ "$ref": "#/components/schemas/DashboardPanelQuery" }, "maxItems": 26, - "description": "Queries in the panel. `time_series` accepts 1–26, `text` accepts none, every other kind accepts exactly one." + "description": "Queries in the panel. `time_series` accepts 1–26, `text` and `incident_list` accept none, every other kind accepts exactly one." }, "viz_config": { "$ref": "#/components/schemas/DashboardVizConfig" @@ -30190,6 +30190,9 @@ }, { "$ref": "#/components/schemas/DashboardTextViz" + }, + { + "$ref": "#/components/schemas/DashboardIncidentListViz" } ], "discriminator": { @@ -30201,7 +30204,8 @@ "bar": "#/components/schemas/DashboardBarViz", "gauge": "#/components/schemas/DashboardGaugeViz", "logs": "#/components/schemas/DashboardLogsViz", - "text": "#/components/schemas/DashboardTextViz" + "text": "#/components/schemas/DashboardTextViz", + "incident_list": "#/components/schemas/DashboardIncidentListViz" } } }, @@ -30573,6 +30577,28 @@ "markdown" ] }, + "DashboardIncidentListViz": { + "type": "object", + "description": "Incident-list panel. The rows are filled by the client from the Flashduty incident API, so the panel runs no queries and needs no datasource.", + "properties": { + "kind": { + "type": "string", + "enum": [ + "incident_list" + ], + "description": "Visualization kind discriminator; always `incident_list`." + }, + "options": { + "type": "object", + "additionalProperties": true, + "description": "Open options object for the chosen visualization kind; the only part of the definition that round-trips losslessly. Missing or null normalizes to `{}`." + } + }, + "required": [ + "kind", + "options" + ] + }, "DashboardThreshold": { "type": "object", "description": "Colour threshold for a numeric value. At least one of `warning`/`critical` is required, and with both set the pair must be ordered according to `mode`.", @@ -31396,9 +31422,10 @@ "bar", "gauge", "logs", - "text" + "text", + "incident_list" ], - "description": "Visualization kind: `time_series` = time series; `table` = table; `stat` = single value; `bar` = bar chart; `gauge` = gauge; `logs` = log stream; `text` = Markdown text." + "description": "Visualization kind: `time_series` = time series; `table` = table; `stat` = single value; `bar` = bar chart; `gauge` = gauge; `logs` = log stream; `text` = Markdown text; `incident_list` = incident list." } }, "required": [ diff --git a/openapi/openapi.zh.json b/openapi/openapi.zh.json index 171481a..75f58d1 100644 --- a/openapi/openapi.zh.json +++ b/openapi/openapi.zh.json @@ -18385,7 +18385,7 @@ "type": "object" }, "ResponseEnvelope": { - "description": "Standard response envelope used by every Flashduty public API. On success `data` contains the endpoint-specific payload and `error` is absent. On failure `error` is present and `data` is absent. `request_id` is always present and is also mirrored in the `Flashcat-Request-Id` response header.", + "description": "所有 Flashduty 公开 API 共用的标准响应结构。成功时 `data` 为接口专属载荷且不含 `error`;失败时 `error` 存在而 `data` 缺失。`request_id` 始终存在,并会同步写入 `Flashcat-Request-Id` 响应头。", "properties": { "data": { "description": "端点专属数据负载,具体结构见各操作 200 响应中的 schema。" @@ -29665,7 +29665,7 @@ "$ref": "#/components/schemas/DashboardPanelQuery" }, "maxItems": 26, - "description": "面板内的查询。`time_series` 允许 1~26 条,`text` 不允许查询,其余类型必须恰好 1 条。" + "description": "面板内的查询。`time_series` 允许 1~26 条,`text`、`incident_list` 不允许查询,其余类型必须恰好 1 条。" }, "viz_config": { "$ref": "#/components/schemas/DashboardVizConfig" @@ -30190,6 +30190,9 @@ }, { "$ref": "#/components/schemas/DashboardTextViz" + }, + { + "$ref": "#/components/schemas/DashboardIncidentListViz" } ], "discriminator": { @@ -30201,7 +30204,8 @@ "bar": "#/components/schemas/DashboardBarViz", "gauge": "#/components/schemas/DashboardGaugeViz", "logs": "#/components/schemas/DashboardLogsViz", - "text": "#/components/schemas/DashboardTextViz" + "text": "#/components/schemas/DashboardTextViz", + "incident_list": "#/components/schemas/DashboardIncidentListViz" } } }, @@ -30573,6 +30577,28 @@ "markdown" ] }, + "DashboardIncidentListViz": { + "type": "object", + "description": "故障列表面板。数据由前端从 Flashduty 故障接口获取,因此面板不运行查询、也不需要数据源。", + "properties": { + "kind": { + "type": "string", + "enum": [ + "incident_list" + ], + "description": "可视化类型判别字段,固定为 `incident_list`。" + }, + "options": { + "type": "object", + "additionalProperties": true, + "description": "所选可视化类型的开放配置对象;也是定义中唯一无损 round-trip 的部分。缺失或 null 时规范化为 `{}`。" + } + }, + "required": [ + "kind", + "options" + ] + }, "DashboardThreshold": { "type": "object", "description": "数值的颜色阈值。`warning`/`critical` 至少设置一个;两者都设置时需按 `mode` 满足大小关系。", @@ -31396,9 +31422,10 @@ "bar", "gauge", "logs", - "text" + "text", + "incident_list" ], - "description": "可视化类型:`time_series` = 时序图;`table` = 表格;`stat` = 单值;`bar` = 柱状图;`gauge` = 仪表盘;`logs` = 日志流;`text` = Markdown 文本。" + "description": "可视化类型:`time_series` = 时序图;`table` = 表格;`stat` = 单值;`bar` = 柱状图;`gauge` = 仪表盘;`logs` = 日志流;`text` = Markdown 文本;`incident_list` = 故障列表。" } }, "required": [ @@ -42088,7 +42115,7 @@ "operationId": "incidentPostMortemInfo", "parameters": [ { - "description": "Post-mortem ID. Deterministic hash derived from account ID and the set of linked incident IDs.", + "description": "故障复盘 ID。由账户 ID 与关联故障 ID 集合推导出的确定性哈希值。", "in": "query", "name": "post_mortem_id", "required": true, @@ -52383,7 +52410,7 @@ "text/csv": { "example": "Issue ID,Error type,Error message,Status,Error count,Affected sessions,Last seen (Asia/Shanghai)\nNHEacQHi2DhXqobr9qPQz9,Error,Script error.,for_review,752,381,2026-04-12 10:43:59\nH8kZSmxiE7EgdyD4fCyyNa,Error,\"API ERROR: We encountered an internal error | POST /api/access/logout\",for_review,3,1,2026-04-03 12:41:24", "schema": { - "description": "CSV file content. The header row matches the exported columns in order; values are sanitized against spreadsheet formula injection.", + "description": "CSV 文件内容。表头行按导出列的先后顺序排列;单元格取值已做电子表格公式注入防护。", "type": "string" } } @@ -52391,14 +52418,14 @@ "description": "成功。CSV 附件,非 JSON 信封。", "headers": { "X-Export-Total": { - "description": "Total number of issues matching the filters, before the row cap.", + "description": "符合筛选条件的异常总数,未受行数上限截断前。", "schema": { "format": "int64", "type": "integer" } }, "X-Export-Truncated": { - "description": "`true` when more issues matched than the 100-row cap and the file was truncated.", + "description": "当匹配的异常超过 100 行上限、文件被截断时为 `true`。", "schema": { "type": "boolean" } @@ -53851,7 +53878,7 @@ }, "application/x-ndjson": { "schema": { - "description": "Newline-delimited JSON (NDJSON). Each line is one decompressed replay segment record (rrweb-format events), streamed directly and not wrapped in the standard envelope.", + "description": "按行分隔的 JSON(NDJSON)。每一行是一条解压后的回放分片记录(rrweb 格式事件),直接流式返回,不使用标准响应结构包裹。", "type": "string" } } @@ -54013,7 +54040,7 @@ { "properties": { "data": { - "description": "Always null on success.", + "description": "成功时恒为 null。", "type": "null" } }, @@ -54092,7 +54119,7 @@ { "properties": { "data": { - "description": "Always null on success.", + "description": "成功时恒为 null。", "type": "null" } }, @@ -54171,7 +54198,7 @@ { "properties": { "data": { - "description": "Always null on success.", + "description": "成功时恒为 null。", "type": "null" } }, @@ -54458,7 +54485,7 @@ { "properties": { "data": { - "description": "Always null on success.", + "description": "成功时恒为 null。", "type": "null" } }, @@ -54537,7 +54564,7 @@ { "properties": { "data": { - "description": "Always null on success.", + "description": "成功时恒为 null。", "type": "null" } }, @@ -55080,7 +55107,7 @@ { "properties": { "data": { - "description": "Always null on success.", + "description": "成功时恒为 null。", "type": "null" } }, @@ -60758,7 +60785,7 @@ "operationId": "statusPageChangeInfo", "parameters": [ { - "description": "Status page ID.", + "description": "状态页 ID。", "in": "query", "name": "page_id", "required": true, @@ -60768,7 +60795,7 @@ } }, { - "description": "Event (change) ID.", + "description": "事件(变更)ID。", "in": "query", "name": "change_id", "required": true, @@ -60885,7 +60912,7 @@ "operationId": "statusPageChangeList", "parameters": [ { - "description": "Status page ID.", + "description": "状态页 ID。", "in": "query", "name": "page_id", "required": true, @@ -60895,7 +60922,7 @@ } }, { - "description": "Lower bound of the event activity window: only events still open at, or closed at or after, this Unix timestamp (seconds) are returned.", + "description": "事件活动时间窗的下界:仅返回在该 Unix 时间戳(秒)时仍未结束、或在该时刻之后结束的事件。", "in": "query", "name": "start_at_seconds", "required": false, @@ -60905,7 +60932,7 @@ } }, { - "description": "Upper bound of the event activity window: only events started at or before this Unix timestamp (seconds) are returned.", + "description": "事件活动时间窗的上界:仅返回在该 Unix 时间戳(秒)或之前开始的事件。", "in": "query", "name": "end_at_seconds", "required": false, @@ -60915,7 +60942,7 @@ } }, { - "description": "Event type filter. Required.", + "description": "事件类型筛选条件。必填。", "in": "query", "name": "type", "required": true, @@ -60928,7 +60955,7 @@ } }, { - "description": "Event status filter. Required. Must be a status valid for the given `type` (`investigating`/`identified`/`monitoring`/`resolved` for `incident`; `scheduled`/`ongoing`/`completed` for `maintenance`).", + "description": "事件状态筛选条件。必填。必须是与所给 `type` 匹配的合法状态(`incident` 为 `investigating`/`identified`/`monitoring`/`resolved`;`maintenance` 为 `scheduled`/`ongoing`/`completed`)。", "in": "query", "name": "status", "required": true, @@ -61746,7 +61773,7 @@ "operationId": "statusPageInfo", "parameters": [ { - "description": "Status page ID.", + "description": "状态页 ID。", "in": "query", "name": "page_id", "required": true, @@ -62179,7 +62206,7 @@ "operationId": "statusPageMigrationStatus", "parameters": [ { - "description": "Migration job ID returned by `migrate-structure` or `migrate-email-subscribers`.", + "description": "由 `migrate-structure` 或 `migrate-email-subscribers` 返回的迁移任务 ID。", "in": "query", "name": "job_id", "required": true, @@ -62562,7 +62589,7 @@ "operationId": "statusPageSubscriberList", "parameters": [ { - "description": "Status page ID.", + "description": "状态页 ID。", "in": "query", "name": "page_id", "required": true, @@ -62572,7 +62599,7 @@ } }, { - "description": "Comma-separated component IDs to filter subscribers by.", + "description": "用于筛选订阅者的组件 ID,多个以英文逗号分隔。", "in": "query", "name": "component_ids", "required": false, @@ -62581,7 +62608,7 @@ } }, { - "description": "Page number (1-based).", + "description": "页码(从 1 开始)。", "in": "query", "name": "p", "required": false, @@ -62593,7 +62620,7 @@ } }, { - "description": "Page size (1-100).", + "description": "每页条数(1-100)。", "in": "query", "name": "limit", "required": false, @@ -62756,7 +62783,7 @@ "operationId": "statusPageTemplateList", "parameters": [ { - "description": "Status page ID.", + "description": "状态页 ID。", "in": "query", "name": "page_id", "required": true, @@ -62766,7 +62793,7 @@ } }, { - "description": "Template category. `pre_defined` returns predefined event templates; `message` returns message notification templates.", + "description": "模板类别。`pre_defined` 返回预定义事件模板;`message` 返回消息通知模板。", "in": "query", "name": "type", "required": true,