API: Extract OpenAPI specification from source code using go-swagger (#40528) (#45061)

* API: Using go-swagger for extracting OpenAPI specification from source code

* Merge Grafana Alerting spec

* Include enterprise endpoints (if enabled)

* Serve SwaggerUI under feature flag

* Fix building dev docker images

* Configure swaggerUI

* Add missing json tags

Co-authored-by: Ying WANG <ying.wang@grafana.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
(cherry picked from commit 35fe58de37)
This commit is contained in:
Grot (@grafanabot)
2022-02-08 13:52:05 +01:00
committed by GitHub
parent c6a58003d1
commit 08ad99c36e
61 changed files with 35314 additions and 74 deletions
+112 -2
View File
@@ -1360,6 +1360,108 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"CreateDashboardSnapshotCommand": {
"type": "object",
"required": [
"dashboard"
],
"properties": {
"Result": {
"$ref": "#/definitions/DashboardSnapshot"
},
"dashboard": {
"$ref": "#/definitions/Json"
},
"deleteKey": {
"description": "Unique key used to delete the snapshot. It is different from the `key` so that only the creator can delete the snapshot. Required if `external` is `true`.",
"type": "string",
"x-go-name": "DeleteKey"
},
"expires": {
"description": "When the snapshot should expire in seconds in seconds. Default is never to expire.",
"type": "integer",
"format": "int64",
"default": 0,
"x-go-name": "Expires"
},
"external": {
"description": "these are passed when storing an external snapshot ref\nSave the snapshot on an external server rather than locally.",
"type": "boolean",
"default": false,
"x-go-name": "External"
},
"key": {
"description": "Define the unique key. Required if `external` is `true`.",
"type": "string",
"x-go-name": "Key"
},
"name": {
"description": "Snapshot name",
"type": "string",
"x-go-name": "Name"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/models"
},
"DashboardSnapshot": {
"description": "DashboardSnapshot model",
"type": "object",
"properties": {
"Created": {
"type": "string",
"format": "date-time"
},
"Dashboard": {
"$ref": "#/definitions/Json"
},
"DashboardEncrypted": {
"type": "array",
"items": {
"type": "integer",
"format": "uint8"
}
},
"DeleteKey": {
"type": "string"
},
"Expires": {
"type": "string",
"format": "date-time"
},
"External": {
"type": "boolean"
},
"ExternalDeleteUrl": {
"type": "string"
},
"ExternalUrl": {
"type": "string"
},
"Id": {
"type": "integer",
"format": "int64"
},
"Key": {
"type": "string"
},
"Name": {
"type": "string"
},
"OrgId": {
"type": "integer",
"format": "int64"
},
"Updated": {
"type": "string",
"format": "date-time"
},
"UserId": {
"type": "integer",
"format": "int64"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/models"
},
"DateTime": {
"description": "DateTime is a time but it serializes to ISO8601 format with millis\nIt knows how to read 3 different variations of a RFC3339 date time.\nMost APIs we encounter want either millisecond or second precision times.\nThis just tries to make it worry-free.",
"type": "string",
@@ -1401,6 +1503,12 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"DsPermissionType": {
"description": "Datasource permission\nDescription:\n`0` - No Access\n`1` - Query\nEnum: 0,1",
"type": "integer",
"format": "int64",
"x-go-package": "github.com/grafana/grafana/pkg/models"
},
"Duration": {
"type": "integer",
"format": "int64",
@@ -3931,7 +4039,6 @@
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"alertGroup": {
"description": "AlertGroup alert group",
"type": "object",
"required": [
"alerts",
@@ -3954,6 +4061,8 @@
"$ref": "#/definitions/receiver"
}
},
"x-go-name": "AlertGroup",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
"$ref": "#/definitions/alertGroup"
},
"alertGroups": {
@@ -4211,11 +4320,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": {