Alerting: Fix rendering issues in OpenAPI docs (#50630)

* Clean up status codes

* Missing consumes tag

* Regenerate

* Fix incorrect documented responses and missing UI elements

* Fix response docs

* Fix wrong response copy paste

* Regenerate

* Temporarily revert
This commit is contained in:
Alexander Weaver
2022-06-13 12:51:07 -05:00
committed by GitHub
parent 9779f684d1
commit 17e76b06ff
10 changed files with 985 additions and 229 deletions
@@ -24,11 +24,6 @@
// swagger:meta
package definitions
// swagger:model
type ValidationError struct {
Msg string `json:"msg"`
}
type Backend int
const (
@@ -12,12 +12,15 @@ import (
//
// Responses:
// 200: AlertRule
// 400: ValidationError
// 404: description: Not found.
// swagger:route POST /api/v1/provisioning/alert-rules provisioning stable RoutePostAlertRule
//
// Create a new alert rule.
//
// Consumes:
// - application/json
//
// Responses:
// 201: AlertRule
// 400: ValidationError
@@ -39,10 +42,10 @@ import (
//
// Responses:
// 204: description: The alert rule was deleted successfully.
// 400: ValidationError
// swagger:parameters RouteGetAlertRule RoutePutAlertRule RouteDeleteAlertRule
type AlertRuleUIDReference struct {
// Alert rule UID
// in:path
UID string
}
@@ -12,8 +12,7 @@ import (
// Get all the contact points.
//
// Responses:
// 200: Route
// 400: ValidationError
// 200: ContactPoints
// swagger:route POST /api/v1/provisioning/contact-points provisioning stable RoutePostContactpoints
//
@@ -23,7 +22,7 @@ import (
// - application/json
//
// Responses:
// 202: Ack
// 202: EmbeddedContactPoint
// 400: ValidationError
// swagger:route PUT /api/v1/provisioning/contact-points/{UID} provisioning stable RoutePutContactpoint
@@ -45,12 +44,11 @@ import (
// - application/json
//
// Responses:
// 202: Ack
// 400: ValidationError
// 204: description: The contact point was deleted successfully.
// swagger:parameters RoutePutContactpoint RouteDeleteContactpoints
type ContactPointUIDReference struct {
// UID should be the contact point unique identifier
// UID is the contact point unique identifier
// in:path
UID string
}
@@ -61,8 +59,12 @@ type ContactPointPayload struct {
Body EmbeddedContactPoint
}
// swagger:model
type ContactPoints []EmbeddedContactPoint
// EmbeddedContactPoint is the contact point type that is used
// by grafanas embedded alertmanager implementation.
// swagger:model
type EmbeddedContactPoint struct {
// UID is the unique identifier of the contact point. The UID can be
// set by the user.
@@ -11,7 +11,6 @@ import (
//
// Responses:
// 200: MuteTimings
// 400: ValidationError
// swagger:route GET /api/v1/provisioning/mute-timings/{name} provisioning stable RouteGetMuteTiming
//
@@ -19,7 +18,7 @@ import (
//
// Responses:
// 200: MuteTimeInterval
// 400: ValidationError
// 404: description: Not found.
// swagger:route POST /api/v1/provisioning/mute-timings provisioning stable RoutePostMuteTiming
//
@@ -48,7 +47,7 @@ import (
// Delete a mute timing.
//
// Responses:
// 204: Ack
// 204: description: The mute timing was deleted successfully.
// swagger:route
@@ -57,7 +56,7 @@ type MuteTimings []MuteTimeInterval
// swagger:parameters RouteGetTemplate RouteGetMuteTiming RoutePutMuteTiming stable RouteDeleteMuteTiming
type RouteGetMuteTimingParam struct {
// Template Name
// Mute timing name
// in:path
Name string `json:"name"`
}
@@ -6,7 +6,7 @@ package definitions
//
// Responses:
// 200: Route
// 400: ValidationError
// description: The currently active notification routing tree
// swagger:route PUT /api/v1/provisioning/policies provisioning stable RoutePutPolicyTree
//
@@ -21,6 +21,7 @@ package definitions
// swagger:parameters RoutePutPolicyTree
type Policytree struct {
// The new notification routing tree to use
// in:body
Body Route
}
@@ -9,8 +9,8 @@ import (
// Get all message templates.
//
// Responses:
// 200: MessageTemplate
// 400: ValidationError
// 200: MessageTemplates
// 404: description: Not found.
// swagger:route GET /api/v1/provisioning/templates/{name} provisioning stable RouteGetTemplate
//
@@ -18,7 +18,7 @@ import (
//
// Responses:
// 200: MessageTemplate
// 404: NotFound
// 404: description: Not found.
// swagger:route PUT /api/v1/provisioning/templates/{name} provisioning stable RoutePutTemplate
//
@@ -28,7 +28,7 @@ import (
// - application/json
//
// Responses:
// 202: Ack
// 202: MessageTemplate
// 400: ValidationError
// swagger:route DELETE /api/v1/provisioning/templates/{name} provisioning stable RouteDeleteTemplate
@@ -36,7 +36,7 @@ import (
// Delete a template.
//
// Responses:
// 204: Ack
// 204: description: The template was deleted successfully.
// swagger:parameters RouteGetTemplate RoutePutTemplate RouteDeleteTemplate
type RouteGetTemplateParam struct {
@@ -47,8 +47,8 @@ type RouteGetTemplateParam struct {
// swagger:model
type MessageTemplate struct {
Name string
Template string
Name string `json:"name"`
Template string `json:"template"`
Provenance models.Provenance `json:"provenance,omitempty"`
}
@@ -56,7 +56,7 @@ type MessageTemplate struct {
type MessageTemplates []MessageTemplate
type MessageTemplateContent struct {
Template string
Template string `json:"template"`
}
// swagger:parameters RoutePutTemplate
@@ -5,3 +5,9 @@ type NotFound struct{}
// swagger:model
type Ack struct{}
// swagger:model
type ValidationError struct {
// example: error message
Msg string `json:"msg"`
}