mirror of
https://github.com/grafana/grafana.git
synced 2025-02-20 11:48:34 -06:00
API: Fix swagger specification (#50034)
* API: Fix swagger specification * Validate specification after generation
This commit is contained in:
parent
1a50b0dbb7
commit
6112bd0c63
4
Makefile
4
Makefile
@ -50,7 +50,7 @@ $(SPEC_TARGET): $(API_DEFINITION_FILES) ## Generate API spec
|
||||
-x "github.com/prometheus/alertmanager" \
|
||||
-i /grafana/pkg/api/docs/tags.json
|
||||
|
||||
swagger-api-spec: gen-go $(SPEC_TARGET) $(MERGED_SPEC_TARGET)
|
||||
swagger-api-spec: gen-go $(SPEC_TARGET) $(MERGED_SPEC_TARGET) validate-api-spec
|
||||
|
||||
$(NGALERT_SPEC_TARGET):
|
||||
+$(MAKE) -C pkg/services/ngalert/api/tooling api.json
|
||||
@ -67,7 +67,7 @@ ensure_go-swagger_mac:
|
||||
-x "github.com/prometheus/alertmanager" \
|
||||
-i pkg/api/docs/tags.json
|
||||
|
||||
swagger-api-spec-mac: gen-go --swagger-api-spec-mac $(MERGED_SPEC_TARGET)
|
||||
swagger-api-spec-mac: gen-go --swagger-api-spec-mac $(MERGED_SPEC_TARGET) validate-api-spec
|
||||
|
||||
validate-api-spec: $(MERGED_SPEC_TARGET) ## Validate API spec
|
||||
docker run --rm -it \
|
||||
|
@ -113,7 +113,7 @@ import (
|
||||
// 401: unauthorisedError
|
||||
// 500: internalServerError
|
||||
|
||||
// swagger:parameters updateAnnotation patchAnnotation deleteAnnotation
|
||||
// swagger:parameters getAnnotation updateAnnotation patchAnnotation deleteAnnotation
|
||||
type AnnotationIDParam struct {
|
||||
// in:path
|
||||
// required:true
|
||||
|
@ -334,7 +334,6 @@ import (
|
||||
// 500: internalServerError
|
||||
|
||||
// swagger:parameters updateDatasourceByID deleteDatasourceByID getDatasourceByID datasourceProxyGETcalls datasourceProxyPOSTcalls datasourceProxyDELETEcalls
|
||||
// swagger:parameters enablePermissions disablePermissions getPermissions deletePermissions
|
||||
// swagger:parameters checkDatasourceHealthByID fetchDatasourceResourcesByID
|
||||
type DatasourceID struct {
|
||||
// in:path
|
||||
|
@ -2258,6 +2258,15 @@
|
||||
"tags": ["annotations"],
|
||||
"summary": "Get Annotation by Id.",
|
||||
"operationId": "getAnnotation",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"x-go-name": "AnnotationID",
|
||||
"name": "annotation_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/getAnnotationResponse"
|
||||
@ -3809,7 +3818,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/datasources/{datasource_id}/disable-permissions": {
|
||||
"/datasources/{datasourceId}/disable-permissions": {
|
||||
"post": {
|
||||
"description": "Disables permissions for the data source with the given id. All existing permissions will be removed and anyone will be able to query the data source.\n\nYou need to have a permission with action `datasources.permissions:toggle` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).",
|
||||
"tags": ["datasource_permissions", "enterprise"],
|
||||
@ -3819,7 +3828,7 @@
|
||||
{
|
||||
"type": "string",
|
||||
"x-go-name": "DatasourceID",
|
||||
"name": "id",
|
||||
"name": "datasourceId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -3846,7 +3855,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/datasources/{datasource_id}/enable-permissions": {
|
||||
"/datasources/{datasourceId}/enable-permissions": {
|
||||
"post": {
|
||||
"description": "Enables permissions for the data source with the given id.\nNo one except Org Admins will be able to query the data source until permissions have been added\nwhich permit certain users or teams to query the data source.\n\nYou need to have a permission with action `datasources.permissions:toggle` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).",
|
||||
"tags": ["datasource_permissions", "enterprise"],
|
||||
@ -3856,7 +3865,7 @@
|
||||
{
|
||||
"type": "string",
|
||||
"x-go-name": "DatasourceID",
|
||||
"name": "id",
|
||||
"name": "datasourceId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -3883,7 +3892,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/datasources/{datasource_id}/permissions": {
|
||||
"/datasources/{datasourceId}/permissions": {
|
||||
"get": {
|
||||
"description": "Gets all existing permissions for the data source with the given id.\n\nYou need to have a permission with action `datasources.permissions:read` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).",
|
||||
"tags": ["datasource_permissions", "enterprise"],
|
||||
@ -3893,7 +3902,7 @@
|
||||
{
|
||||
"type": "string",
|
||||
"x-go-name": "DatasourceID",
|
||||
"name": "id",
|
||||
"name": "datasourceId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -3917,7 +3926,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/datasources/{datasource_id}/permissions/{permissionId}": {
|
||||
"/datasources/{datasourceId}/permissions/{permissionId}": {
|
||||
"delete": {
|
||||
"description": "Removes the permission with the given permissionId for the data source with the given id.\n\nYou need to have a permission with action `datasources.permissions:delete` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).",
|
||||
"tags": ["datasource_permissions", "enterprise"],
|
||||
@ -3926,15 +3935,15 @@
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"x-go-name": "PermissionID",
|
||||
"name": "permissionId",
|
||||
"x-go-name": "DatasourceID",
|
||||
"name": "datasourceId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"x-go-name": "DatasourceID",
|
||||
"name": "id",
|
||||
"x-go-name": "PermissionID",
|
||||
"name": "permissionId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
|
@ -2258,6 +2258,15 @@
|
||||
"tags": ["annotations"],
|
||||
"summary": "Get Annotation by Id.",
|
||||
"operationId": "getAnnotation",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"x-go-name": "AnnotationID",
|
||||
"name": "annotation_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/getAnnotationResponse"
|
||||
@ -3809,7 +3818,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/datasources/{datasource_id}/disable-permissions": {
|
||||
"/datasources/{datasourceId}/disable-permissions": {
|
||||
"post": {
|
||||
"description": "Disables permissions for the data source with the given id. All existing permissions will be removed and anyone will be able to query the data source.\n\nYou need to have a permission with action `datasources.permissions:toggle` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).",
|
||||
"tags": ["datasource_permissions", "enterprise"],
|
||||
@ -3819,7 +3828,7 @@
|
||||
{
|
||||
"type": "string",
|
||||
"x-go-name": "DatasourceID",
|
||||
"name": "id",
|
||||
"name": "datasourceId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -3846,7 +3855,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/datasources/{datasource_id}/enable-permissions": {
|
||||
"/datasources/{datasourceId}/enable-permissions": {
|
||||
"post": {
|
||||
"description": "Enables permissions for the data source with the given id.\nNo one except Org Admins will be able to query the data source until permissions have been added\nwhich permit certain users or teams to query the data source.\n\nYou need to have a permission with action `datasources.permissions:toggle` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).",
|
||||
"tags": ["datasource_permissions", "enterprise"],
|
||||
@ -3856,7 +3865,7 @@
|
||||
{
|
||||
"type": "string",
|
||||
"x-go-name": "DatasourceID",
|
||||
"name": "id",
|
||||
"name": "datasourceId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -3883,7 +3892,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/datasources/{datasource_id}/permissions": {
|
||||
"/datasources/{datasourceId}/permissions": {
|
||||
"get": {
|
||||
"description": "Gets all existing permissions for the data source with the given id.\n\nYou need to have a permission with action `datasources.permissions:read` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).",
|
||||
"tags": ["datasource_permissions", "enterprise"],
|
||||
@ -3893,7 +3902,7 @@
|
||||
{
|
||||
"type": "string",
|
||||
"x-go-name": "DatasourceID",
|
||||
"name": "id",
|
||||
"name": "datasourceId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
@ -3917,7 +3926,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/datasources/{datasource_id}/permissions/{permissionId}": {
|
||||
"/datasources/{datasourceId}/permissions/{permissionId}": {
|
||||
"delete": {
|
||||
"description": "Removes the permission with the given permissionId for the data source with the given id.\n\nYou need to have a permission with action `datasources.permissions:delete` and scopes `datasources:*`, `datasources:id:*`, `datasources:id:1` (single data source).",
|
||||
"tags": ["datasource_permissions", "enterprise"],
|
||||
@ -3926,15 +3935,15 @@
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"x-go-name": "PermissionID",
|
||||
"name": "permissionId",
|
||||
"x-go-name": "DatasourceID",
|
||||
"name": "datasourceId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"x-go-name": "DatasourceID",
|
||||
"name": "id",
|
||||
"x-go-name": "PermissionID",
|
||||
"name": "permissionId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user