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

* 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>
This commit is contained in:
Sofia Papagiannaki
2022-02-08 13:38:43 +01:00
committed by GitHub
co-authored by Ying WANG Marcus Efraimsson
parent 9c2363ef08
commit 35fe58de37
61 changed files with 35314 additions and 74 deletions
+17 -3
View File
@@ -48,11 +48,25 @@ type CurrentUser struct {
type UserPermissionsMap map[string]bool
// swagger:model
type MetricRequest struct {
From string `json:"from"`
To string `json:"to"`
// From Start time in epoch timestamps in milliseconds or relative using Grafana time units.
// required: true
// example: now-1h
From string `json:"from"`
// To End time in epoch timestamps in milliseconds or relative using Grafana time units.
// required: true
// example: now
To string `json:"to"`
// queries.refId – Specifies an identifier of the query. Is optional and default to “A”.
// queries.datasourceId – Specifies the data source to be queried. Each query in the request must have an unique datasourceId.
// queries.maxDataPoints - Species maximum amount of data points that dashboard panel can render. Is optional and default to 100.
// queries.intervalMs - Specifies the time interval in milliseconds of time series. Is optional and defaults to 1000.
// required: true
// example: [ { "refId": "A", "intervalMs": 86400000, "maxDataPoints": 1092, "datasourceId": 86, "rawSql": "SELECT 1 as valueOne, 2 as valueTwo", "format": "table" } ]
Queries []*simplejson.Json `json:"queries"`
Debug bool `json:"debug"`
// required: false
Debug bool `json:"debug"`
}
func GetGravatarUrl(text string) string {