Alerting: Add support for documenting which alerting APIs are stable (#49018)

* Support for documenting stable vs unstable alerting routes

* empty commit, restart drone

* Touch-up references in root makefile and drop trailing escape newline

* Rebase and regenerate

* Extend README with docs for this change
This commit is contained in:
Alexander Weaver
2022-05-23 14:08:27 -05:00
committed by GitHub
parent 7cd034f33a
commit ac8951f689
8 changed files with 3811 additions and 34 deletions
@@ -63,6 +63,39 @@ func main() {
}
}
paths, ok := data["paths"].(map[string]interface{})
if !ok {
log.Fatal("no paths")
}
for _, path := range paths {
path, ok := path.(map[string]interface{})
if !ok {
log.Fatal("invalid path")
}
for _, op := range path {
op, ok := op.(map[string]interface{})
if !ok {
continue
}
tags, ok := op["tags"].([]interface{})
if !ok {
log.Println("invalid op, skipping")
continue
}
// Remove "stable" tag. Multiple tags cause routes to render strangely in the final docs.
for i, tag := range tags {
if tag == "stable" {
log.Println("removing stable tag")
op["tags"] = append(tags[:i], tags[i+1:]...)
}
}
}
}
out, err := json.MarshalIndent(data, "", " ")
if err != nil {
log.Fatal(err)