Alerting: Fix invalid swagger specification (#51907)

* Alerting: Fix invalid swagger specification

* Add make targets for validating the generated swagger spec
This commit is contained in:
Sofia Papagiannaki
2022-07-13 12:34:54 +03:00
committed by GitHub
parent b3992df988
commit 21632817c5
11 changed files with 720 additions and 145 deletions
+151 -8
View File
@@ -1821,6 +1821,149 @@
"Provenance": {
"type": "string"
},
"ProvisionedAlertRule": {
"properties": {
"annotations": {
"additionalProperties": {
"type": "string"
},
"example": {
"runbook_url": "https://supercoolrunbook.com/page/13"
},
"type": "object"
},
"condition": {
"example": "A",
"type": "string"
},
"data": {
"example": [
{
"datasourceUid": "-100",
"model": {
"conditions": [
{
"evaluator": {
"params": [
0,
0
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"params": []
},
"reducer": {
"params": [],
"type": "avg"
},
"type": "query"
}
],
"datasource": {
"type": "__expr__",
"uid": "__expr__"
},
"expression": "1 == 1",
"hide": false,
"intervalMs": 1000,
"maxDataPoints": 43200,
"refId": "A",
"type": "math"
},
"queryType": "",
"refId": "A",
"relativeTimeRange": {
"from": 0,
"to": 0
}
}
],
"items": {
"$ref": "#/definitions/AlertQuery"
},
"type": "array"
},
"execErrState": {
"enum": [
"Alerting",
"Error",
"OK"
],
"type": "string"
},
"folderUID": {
"example": "project_x",
"type": "string"
},
"for": {
"$ref": "#/definitions/Duration"
},
"id": {
"format": "int64",
"type": "integer"
},
"labels": {
"additionalProperties": {
"type": "string"
},
"example": {
"team": "sre-team-1"
},
"type": "object"
},
"noDataState": {
"enum": [
"Alerting",
"NoData",
"OK"
],
"type": "string"
},
"orgID": {
"format": "int64",
"type": "integer"
},
"provenance": {
"$ref": "#/definitions/Provenance"
},
"ruleGroup": {
"example": "eval_group_1",
"maxLength": 190,
"minLength": 1,
"type": "string"
},
"title": {
"example": "Always firing",
"maxLength": 190,
"minLength": 1,
"type": "string"
},
"uid": {
"type": "string"
},
"updated": {
"format": "date-time",
"readOnly": true,
"type": "string"
}
},
"required": [
"orgID",
"folderUID",
"ruleGroup",
"title",
"condition",
"data",
"noDataState",
"execErrState",
"for"
],
"type": "object"
},
"PushoverConfig": {
"properties": {
"expire": {
@@ -3269,15 +3412,15 @@
"in": "body",
"name": "Body",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
}
],
"responses": {
"201": {
"description": "AlertRule",
"description": "ProvisionedAlertRule",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
},
"400": {
@@ -3328,9 +3471,9 @@
],
"responses": {
"200": {
"description": "AlertRule",
"description": "ProvisionedAlertRule",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
},
"404": {
@@ -3359,15 +3502,15 @@
"in": "body",
"name": "Body",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
}
],
"responses": {
"200": {
"description": "AlertRule",
"description": "ProvisionedAlertRule",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
},
"400": {