Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion alert_rules.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added gen
Binary file not shown.
2 changes: 1 addition & 1 deletion incidents.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion internal/cmd/gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,14 @@ func (g *Gen) emitStruct(name string, s map[string]any) string {
b.WriteString("\t// " + l + "\n")
}
}
fmt.Fprintf(&b, "\t%s %s `json:%q`\n", field, gt, k+",omitempty")
// Mirror the json wire-name into a `toon` tag. toon-go reads ONLY the
// `toon` struct tag (internal/codec/structmeta.go) and falls back to the
// Go field NAME (PascalCase) when it is absent — it does NOT read `json`.
// So without this, `--output-format toon` renders PascalCase keys
// (AccountID) while `--json` and the spec-derived help use snake_case
// (account_id); an agent that reads field names off a toon dump and pipes
// them into `--json | jq '.account_id'` hits all-null. Keep both tags.
fmt.Fprintf(&b, "\t%s %s `json:%q toon:%q`\n", field, gt, k+",omitempty", k+",omitempty")
}
b.WriteString("}\n\n")
return b.String()
Expand Down
5,448 changes: 2,727 additions & 2,721 deletions models_gen.go

Large diffs are not rendered by default.

54 changes: 49 additions & 5 deletions openapi/openapi.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2349,7 +2349,7 @@
"get": {
"operationId": "incidentPostMortemInfo",
"summary": "Get post-mortem",
"description": "Retrieve the post-mortem report for a specific incident.",
"description": "Retrieve a post-mortem report by its `post_mortem_id`. List reports via `/incident/post-mortem/list` first — each row carries the incident it covers — then fetch the full report here by that id.",
"tags": [
"On-call/Incidents"
],
Expand Down Expand Up @@ -14510,7 +14510,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RuleIDRequest"
"$ref": "#/components/schemas/AuditRecordIDRequest"
},
"example": {
"id": 9001
Expand Down Expand Up @@ -23121,7 +23121,7 @@
},
"progress": {
"type": "string",
"description": "Incident progress (e.g. `Processing`, `Resolved`)."
"description": "Incident progress — one of `Triggered`, `Processing`, `Closed`."
}
}
},
Expand Down Expand Up @@ -32427,7 +32427,38 @@
"export_fields": {
"type": "array",
"items": {
"type": "string"
"type": "string",
"enum": [
"incident_id",
"title",
"severity",
"progress",
"channel_id",
"channel_name",
"team_id",
"team_name",
"created_at",
"seconds_to_ack",
"seconds_to_close",
"closed_by",
"engaged_seconds",
"hours",
"notifications",
"interruptions",
"acknowledgements",
"assignments",
"reassignments",
"escalations",
"manual_escalations",
"timeout_escalations",
"assigned_to",
"responders",
"description",
"labels",
"fields",
"creator_id",
"creator_name"
]
},
"description": "Subset of CSV column keys to include in the export. At most 50 entries. Only used by the export endpoints."
},
Expand Down Expand Up @@ -32790,7 +32821,7 @@
},
"progress": {
"type": "string",
"description": "Incident progress state (e.g. `Triggered`, `Acknowledged`, `Closed`)."
"description": "Incident progress state — one of `Triggered`, `Processing`, `Closed`."
},
"severity": {
"type": "string",
Expand Down Expand Up @@ -34490,6 +34521,19 @@
}
}
},
"AuditRecordIDRequest": {
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"type": "integer",
"format": "uint64",
"description": "Audit record ID — the `id` of an audit row returned by `POST /monit/rule/audits`, NOT the rule ID. Passing a rule ID returns HTTP 400."
}
}
},
"RuleIDsRequest": {
"type": "object",
"required": [
Expand Down
54 changes: 49 additions & 5 deletions openapi/openapi.zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -2349,7 +2349,7 @@
"get": {
"operationId": "incidentPostMortemInfo",
"summary": "获取复盘报告",
"description": "获取指定故障的复盘报告。",
"description": "通过 `post_mortem_id` 获取复盘报告。先用 `/incident/post-mortem/list` 列出报告(每行标明所属故障),再用其 id 在此获取完整报告。",
"tags": [
"On-call/故障管理"
],
Expand Down Expand Up @@ -14502,7 +14502,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RuleIDRequest"
"$ref": "#/components/schemas/AuditRecordIDRequest"
},
"example": {
"id": 9001
Expand Down Expand Up @@ -23113,7 +23113,7 @@
},
"progress": {
"type": "string",
"description": "故障处理进度(如 `Processing`、`Resolved`)。"
"description": "故障处理进度——`Triggered`、`Processing`、`Closed` 之一。"
}
}
},
Expand Down Expand Up @@ -32418,7 +32418,38 @@
"export_fields": {
"type": "array",
"items": {
"type": "string"
"type": "string",
"enum": [
"incident_id",
"title",
"severity",
"progress",
"channel_id",
"channel_name",
"team_id",
"team_name",
"created_at",
"seconds_to_ack",
"seconds_to_close",
"closed_by",
"engaged_seconds",
"hours",
"notifications",
"interruptions",
"acknowledgements",
"assignments",
"reassignments",
"escalations",
"manual_escalations",
"timeout_escalations",
"assigned_to",
"responders",
"description",
"labels",
"fields",
"creator_id",
"creator_name"
]
},
"description": "导出 CSV 时要包含的列键子集,至多 50 项。仅导出接口会读取。"
},
Expand Down Expand Up @@ -32781,7 +32812,7 @@
},
"progress": {
"type": "string",
"description": "故障进度状态(如 `Triggered`、`Acknowledged`、`Closed`。"
"description": "故障处理进度——`Triggered`、`Processing`、`Closed` 之一。"
},
"severity": {
"type": "string",
Expand Down Expand Up @@ -34481,6 +34512,19 @@
}
}
},
"AuditRecordIDRequest": {
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"type": "integer",
"format": "uint64",
"description": "审计记录 ID——来自 `POST /monit/rule/audits` 返回行的 `id`,不是规则 ID。传规则 ID 会返回 HTTP 400。"
}
}
},
"RuleIDsRequest": {
"type": "object",
"required": [
Expand Down
Loading