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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 985 additions and 229 deletions

File diff suppressed because it is too large Load Diff

View File

@ -24,11 +24,6 @@
// swagger:meta
package definitions
// swagger:model
type ValidationError struct {
Msg string `json:"msg"`
}
type Backend int
const (

View File

@ -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
}

View File

@ -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.

View File

@ -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"`
}

View File

@ -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
}

View File

@ -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

View File

@ -5,3 +5,9 @@ type NotFound struct{}
// swagger:model
type Ack struct{}
// swagger:model
type ValidationError struct {
// example: error message
Msg string `json:"msg"`
}

View File

@ -539,6 +539,13 @@
"type": "object",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"ContactPoints": {
"items": {
"$ref": "#/definitions/EmbeddedContactPoint"
},
"type": "array",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"CreateDashboardSnapshotCommand": {
"properties": {
"Result": {
@ -1581,14 +1588,16 @@
},
"MessageTemplate": {
"properties": {
"Name": {
"type": "string"
},
"Template": {
"type": "string"
"name": {
"type": "string",
"x-go-name": "Name"
},
"provenance": {
"$ref": "#/definitions/Provenance"
},
"template": {
"type": "string",
"x-go-name": "Template"
}
},
"type": "object",
@ -1596,8 +1605,9 @@
},
"MessageTemplateContent": {
"properties": {
"Template": {
"type": "string"
"template": {
"type": "string",
"x-go-name": "Template"
}
},
"type": "object",
@ -3176,6 +3186,7 @@
"ValidationError": {
"properties": {
"msg": {
"example": "error message",
"type": "string",
"x-go-name": "Msg"
}
@ -3513,6 +3524,7 @@
"$ref": "#/definitions/Duration"
},
"gettableAlert": {
"description": "GettableAlert gettable alert",
"properties": {
"annotations": {
"$ref": "#/definitions/labelSet"
@ -3571,16 +3583,15 @@
"status",
"updatedAt"
],
"type": "object",
"x-go-name": "GettableAlert",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
"type": "object"
},
"gettableAlerts": {
"description": "GettableAlerts gettable alerts",
"items": {
"$ref": "#/definitions/gettableAlert"
},
"type": "array"
"type": "array",
"x-go-name": "GettableAlerts",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"gettableSilence": {
"properties": {
@ -3639,11 +3650,12 @@
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"gettableSilences": {
"description": "GettableSilences gettable silences",
"items": {
"$ref": "#/definitions/gettableSilence"
},
"type": "array"
"type": "array",
"x-go-name": "GettableSilences",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"labelSet": {
"additionalProperties": {
@ -3815,6 +3827,7 @@
"type": "object"
},
"receiver": {
"description": "Receiver receiver",
"properties": {
"name": {
"description": "name",
@ -3825,9 +3838,7 @@
"required": [
"name"
],
"type": "object",
"x-go-name": "Receiver",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
"type": "object"
},
"silence": {
"description": "Silence silence",
@ -5593,6 +5604,9 @@
},
"/api/v1/provisioning/alert-rules": {
"post": {
"consumes": [
"application/json"
],
"operationId": "RoutePostAlertRule",
"parameters": [
{
@ -5628,6 +5642,7 @@
"operationId": "RouteDeleteAlertRule",
"parameters": [
{
"description": "Alert rule UID",
"in": "path",
"name": "UID",
"required": true,
@ -5637,12 +5652,6 @@
"responses": {
"204": {
"description": " The alert rule was deleted successfully."
},
"400": {
"description": "ValidationError",
"schema": {
"$ref": "#/definitions/ValidationError"
}
}
},
"summary": "Delete a specific alert rule by UID.",
@ -5654,6 +5663,7 @@
"operationId": "RouteGetAlertRule",
"parameters": [
{
"description": "Alert rule UID",
"in": "path",
"name": "UID",
"required": true,
@ -5667,11 +5677,8 @@
"$ref": "#/definitions/AlertRule"
}
},
"400": {
"description": "ValidationError",
"schema": {
"$ref": "#/definitions/ValidationError"
}
"404": {
"description": " Not found."
}
},
"summary": "Get a specific alert rule by UID.",
@ -5686,6 +5693,7 @@
"operationId": "RoutePutAlertRule",
"parameters": [
{
"description": "Alert rule UID",
"in": "path",
"name": "UID",
"required": true,
@ -5724,15 +5732,9 @@
"operationId": "RouteGetContactpoints",
"responses": {
"200": {
"description": "Route",
"description": "ContactPoints",
"schema": {
"$ref": "#/definitions/Route"
}
},
"400": {
"description": "ValidationError",
"schema": {
"$ref": "#/definitions/ValidationError"
"$ref": "#/definitions/ContactPoints"
}
}
},
@ -5757,9 +5759,9 @@
],
"responses": {
"202": {
"description": "Ack",
"description": "EmbeddedContactPoint",
"schema": {
"$ref": "#/definitions/Ack"
"$ref": "#/definitions/EmbeddedContactPoint"
}
},
"400": {
@ -5791,17 +5793,8 @@
}
],
"responses": {
"202": {
"description": "Ack",
"schema": {
"$ref": "#/definitions/Ack"
}
},
"400": {
"description": "ValidationError",
"schema": {
"$ref": "#/definitions/ValidationError"
}
"204": {
"description": " The contact point was deleted successfully."
}
},
"summary": "Delete a contact point.",
@ -5906,12 +5899,6 @@
"schema": {
"$ref": "#/definitions/MuteTimings"
}
},
"400": {
"description": "ValidationError",
"schema": {
"$ref": "#/definitions/ValidationError"
}
}
},
"summary": "Get all the mute timings.",
@ -5958,7 +5945,7 @@
"operationId": "RouteDeleteMuteTiming",
"parameters": [
{
"description": "Template Name",
"description": "Mute timing name",
"in": "path",
"name": "name",
"required": true,
@ -5968,10 +5955,7 @@
],
"responses": {
"204": {
"description": "Ack",
"schema": {
"$ref": "#/definitions/Ack"
}
"description": " The mute timing was deleted successfully."
}
},
"summary": "Delete a mute timing.",
@ -5983,7 +5967,7 @@
"operationId": "RouteGetMuteTiming",
"parameters": [
{
"description": "Template Name",
"description": "Mute timing name",
"in": "path",
"name": "name",
"required": true,
@ -5998,11 +5982,8 @@
"$ref": "#/definitions/MuteTimeInterval"
}
},
"400": {
"description": "ValidationError",
"schema": {
"$ref": "#/definitions/ValidationError"
}
"404": {
"description": " Not found."
}
},
"summary": "Get a mute timing.",
@ -6017,7 +5998,7 @@
"operationId": "RoutePutMuteTiming",
"parameters": [
{
"description": "Template Name",
"description": "Mute timing name",
"in": "path",
"name": "name",
"required": true,
@ -6061,12 +6042,6 @@
"schema": {
"$ref": "#/definitions/Route"
}
},
"400": {
"description": "ValidationError",
"schema": {
"$ref": "#/definitions/ValidationError"
}
}
},
"summary": "Get the notification policy tree.",
@ -6081,6 +6056,7 @@
"operationId": "RoutePutPolicyTree",
"parameters": [
{
"description": "The new notification routing tree to use",
"in": "body",
"name": "Body",
"schema": {
@ -6113,16 +6089,13 @@
"operationId": "RouteGetTemplates",
"responses": {
"200": {
"description": "MessageTemplate",
"description": "MessageTemplates",
"schema": {
"$ref": "#/definitions/MessageTemplate"
"$ref": "#/definitions/MessageTemplates"
}
},
"400": {
"description": "ValidationError",
"schema": {
"$ref": "#/definitions/ValidationError"
}
"404": {
"description": " Not found."
}
},
"summary": "Get all message templates.",
@ -6146,10 +6119,7 @@
],
"responses": {
"204": {
"description": "Ack",
"schema": {
"$ref": "#/definitions/Ack"
}
"description": " The template was deleted successfully."
}
},
"summary": "Delete a template.",
@ -6177,10 +6147,7 @@
}
},
"404": {
"description": "NotFound",
"schema": {
"$ref": "#/definitions/NotFound"
}
"description": " Not found."
}
},
"summary": "Get a message template.",
@ -6212,9 +6179,9 @@
],
"responses": {
"202": {
"description": "Ack",
"description": "MessageTemplate",
"schema": {
"$ref": "#/definitions/Ack"
"$ref": "#/definitions/MessageTemplate"
}
},
"400": {

View File

@ -1669,6 +1669,9 @@
},
"/api/v1/provisioning/alert-rules": {
"post": {
"consumes": [
"application/json"
],
"tags": [
"provisioning",
"stable"
@ -1711,6 +1714,7 @@
"parameters": [
{
"type": "string",
"description": "Alert rule UID",
"name": "UID",
"in": "path",
"required": true
@ -1723,11 +1727,8 @@
"$ref": "#/definitions/AlertRule"
}
},
"400": {
"description": "ValidationError",
"schema": {
"$ref": "#/definitions/ValidationError"
}
"404": {
"description": " Not found."
}
}
},
@ -1744,6 +1745,7 @@
"parameters": [
{
"type": "string",
"description": "Alert rule UID",
"name": "UID",
"in": "path",
"required": true
@ -1781,6 +1783,7 @@
"parameters": [
{
"type": "string",
"description": "Alert rule UID",
"name": "UID",
"in": "path",
"required": true
@ -1789,12 +1792,6 @@
"responses": {
"204": {
"description": " The alert rule was deleted successfully."
},
"400": {
"description": "ValidationError",
"schema": {
"$ref": "#/definitions/ValidationError"
}
}
}
}
@ -1809,15 +1806,9 @@
"operationId": "RouteGetContactpoints",
"responses": {
"200": {
"description": "Route",
"description": "ContactPoints",
"schema": {
"$ref": "#/definitions/Route"
}
},
"400": {
"description": "ValidationError",
"schema": {
"$ref": "#/definitions/ValidationError"
"$ref": "#/definitions/ContactPoints"
}
}
}
@ -1843,9 +1834,9 @@
],
"responses": {
"202": {
"description": "Ack",
"description": "EmbeddedContactPoint",
"schema": {
"$ref": "#/definitions/Ack"
"$ref": "#/definitions/EmbeddedContactPoint"
}
},
"400": {
@ -1919,17 +1910,8 @@
}
],
"responses": {
"202": {
"description": "Ack",
"schema": {
"$ref": "#/definitions/Ack"
}
},
"400": {
"description": "ValidationError",
"schema": {
"$ref": "#/definitions/ValidationError"
}
"204": {
"description": " The contact point was deleted successfully."
}
}
}
@ -1996,12 +1978,6 @@
"schema": {
"$ref": "#/definitions/MuteTimings"
}
},
"400": {
"description": "ValidationError",
"schema": {
"$ref": "#/definitions/ValidationError"
}
}
}
},
@ -2052,7 +2028,7 @@
{
"type": "string",
"x-go-name": "Name",
"description": "Template Name",
"description": "Mute timing name",
"name": "name",
"in": "path",
"required": true
@ -2065,11 +2041,8 @@
"$ref": "#/definitions/MuteTimeInterval"
}
},
"400": {
"description": "ValidationError",
"schema": {
"$ref": "#/definitions/ValidationError"
}
"404": {
"description": " Not found."
}
}
},
@ -2087,7 +2060,7 @@
{
"type": "string",
"x-go-name": "Name",
"description": "Template Name",
"description": "Mute timing name",
"name": "name",
"in": "path",
"required": true
@ -2126,7 +2099,7 @@
{
"type": "string",
"x-go-name": "Name",
"description": "Template Name",
"description": "Mute timing name",
"name": "name",
"in": "path",
"required": true
@ -2134,10 +2107,7 @@
],
"responses": {
"204": {
"description": "Ack",
"schema": {
"$ref": "#/definitions/Ack"
}
"description": " The mute timing was deleted successfully."
}
}
}
@ -2156,12 +2126,6 @@
"schema": {
"$ref": "#/definitions/Route"
}
},
"400": {
"description": "ValidationError",
"schema": {
"$ref": "#/definitions/ValidationError"
}
}
}
},
@ -2177,6 +2141,7 @@
"operationId": "RoutePutPolicyTree",
"parameters": [
{
"description": "The new notification routing tree to use",
"name": "Body",
"in": "body",
"schema": {
@ -2210,16 +2175,13 @@
"operationId": "RouteGetTemplates",
"responses": {
"200": {
"description": "MessageTemplate",
"description": "MessageTemplates",
"schema": {
"$ref": "#/definitions/MessageTemplate"
"$ref": "#/definitions/MessageTemplates"
}
},
"400": {
"description": "ValidationError",
"schema": {
"$ref": "#/definitions/ValidationError"
}
"404": {
"description": " Not found."
}
}
}
@ -2250,10 +2212,7 @@
}
},
"404": {
"description": "NotFound",
"schema": {
"$ref": "#/definitions/NotFound"
}
"description": " Not found."
}
}
},
@ -2286,9 +2245,9 @@
],
"responses": {
"202": {
"description": "Ack",
"description": "MessageTemplate",
"schema": {
"$ref": "#/definitions/Ack"
"$ref": "#/definitions/MessageTemplate"
}
},
"400": {
@ -2318,10 +2277,7 @@
],
"responses": {
"204": {
"description": "Ack",
"schema": {
"$ref": "#/definitions/Ack"
}
"description": " The template was deleted successfully."
}
}
}
@ -2934,6 +2890,13 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"ContactPoints": {
"type": "array",
"items": {
"$ref": "#/definitions/EmbeddedContactPoint"
},
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"CreateDashboardSnapshotCommand": {
"type": "object",
"required": [
@ -3981,14 +3944,16 @@
"MessageTemplate": {
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"Template": {
"type": "string"
"name": {
"type": "string",
"x-go-name": "Name"
},
"provenance": {
"$ref": "#/definitions/Provenance"
},
"template": {
"type": "string",
"x-go-name": "Template"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
@ -3996,8 +3961,9 @@
"MessageTemplateContent": {
"type": "object",
"properties": {
"Template": {
"type": "string"
"template": {
"type": "string",
"x-go-name": "Template"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
@ -5577,7 +5543,8 @@
"properties": {
"msg": {
"type": "string",
"x-go-name": "Msg"
"x-go-name": "Msg",
"example": "error message"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
@ -5914,6 +5881,7 @@
"$ref": "#/definitions/Duration"
},
"gettableAlert": {
"description": "GettableAlert gettable alert",
"type": "object",
"required": [
"labels",
@ -5973,16 +5941,15 @@
"x-go-name": "UpdatedAt"
}
},
"x-go-name": "GettableAlert",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
"$ref": "#/definitions/gettableAlert"
},
"gettableAlerts": {
"description": "GettableAlerts gettable alerts",
"type": "array",
"items": {
"$ref": "#/definitions/gettableAlert"
},
"x-go-name": "GettableAlerts",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
"$ref": "#/definitions/gettableAlerts"
},
"gettableSilence": {
@ -6043,11 +6010,12 @@
"$ref": "#/definitions/gettableSilence"
},
"gettableSilences": {
"description": "GettableSilences gettable silences",
"type": "array",
"items": {
"$ref": "#/definitions/gettableSilence"
},
"x-go-name": "GettableSilences",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
"$ref": "#/definitions/gettableSilences"
},
"labelSet": {
@ -6221,6 +6189,7 @@
"$ref": "#/definitions/postableSilence"
},
"receiver": {
"description": "Receiver receiver",
"type": "object",
"required": [
"name"
@ -6232,8 +6201,6 @@
"x-go-name": "Name"
}
},
"x-go-name": "Receiver",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
"$ref": "#/definitions/receiver"
},
"silence": {