From c3962acf9837bc5d659375422acd27db9f2463a6 Mon Sep 17 00:00:00 2001 From: Julien Duchesne Date: Fri, 3 Nov 2023 18:32:06 -0400 Subject: [PATCH] Swagger: Rename annotations model (#77605) Currently, in the schema, it's a global definition called `ItemDTO`. It's hard to figure out what that is Renaming it to `Annotation` should be more helpful --- pkg/services/annotations/models.go | 1 + public/api-enterprise-spec.json | 186 +++++++++++++---------------- public/api-merged.json | 180 ++++++++++++---------------- public/openapi3.json | 184 ++++++++++++---------------- 4 files changed, 234 insertions(+), 317 deletions(-) diff --git a/pkg/services/annotations/models.go b/pkg/services/annotations/models.go index e1cef2fbe6e..1e24a75f40e 100644 --- a/pkg/services/annotations/models.go +++ b/pkg/services/annotations/models.go @@ -87,6 +87,7 @@ func (i Item) TableName() string { return "annotation" } +// swagger:model Annotation type ItemDTO struct { ID int64 `json:"id" xorm:"id"` AlertID int64 `json:"alertId" xorm:"alert_id"` diff --git a/public/api-enterprise-spec.json b/public/api-enterprise-spec.json index a1335f43f03..cdf6ab57f58 100644 --- a/public/api-enterprise-spec.json +++ b/public/api-enterprise-spec.json @@ -2621,6 +2621,80 @@ } } }, + "Annotation": { + "type": "object", + "properties": { + "alertId": { + "type": "integer", + "format": "int64" + }, + "alertName": { + "type": "string" + }, + "avatarUrl": { + "type": "string" + }, + "created": { + "type": "integer", + "format": "int64" + }, + "dashboardId": { + "type": "integer", + "format": "int64" + }, + "dashboardUID": { + "type": "string" + }, + "data": { + "$ref": "#/definitions/Json" + }, + "email": { + "type": "string" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "login": { + "type": "string" + }, + "newState": { + "type": "string" + }, + "panelId": { + "type": "integer", + "format": "int64" + }, + "prevState": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "text": { + "type": "string" + }, + "time": { + "type": "integer", + "format": "int64" + }, + "timeEnd": { + "type": "integer", + "format": "int64" + }, + "updated": { + "type": "integer", + "format": "int64" + }, + "userId": { + "type": "integer", + "format": "int64" + } + } + }, "AnnotationActions": { "type": "object", "properties": { @@ -3460,7 +3534,7 @@ "type": "object", "properties": { "folderId": { - "description": "ID of the folder where the library element is stored.", + "description": "ID of the folder where the library element is stored.\n\nDeprecated: use FolderUID instead", "type": "integer", "format": "int64" }, @@ -5034,80 +5108,6 @@ } } }, - "ItemDTO": { - "type": "object", - "properties": { - "alertId": { - "type": "integer", - "format": "int64" - }, - "alertName": { - "type": "string" - }, - "avatarUrl": { - "type": "string" - }, - "created": { - "type": "integer", - "format": "int64" - }, - "dashboardId": { - "type": "integer", - "format": "int64" - }, - "dashboardUID": { - "type": "string" - }, - "data": { - "$ref": "#/definitions/Json" - }, - "email": { - "type": "string" - }, - "id": { - "type": "integer", - "format": "int64" - }, - "login": { - "type": "string" - }, - "newState": { - "type": "string" - }, - "panelId": { - "type": "integer", - "format": "int64" - }, - "prevState": { - "type": "string" - }, - "tags": { - "type": "array", - "items": { - "type": "string" - } - }, - "text": { - "type": "string" - }, - "time": { - "type": "integer", - "format": "int64" - }, - "timeEnd": { - "type": "integer", - "format": "int64" - }, - "updated": { - "type": "integer", - "format": "int64" - }, - "userId": { - "type": "integer", - "format": "int64" - } - } - }, "JSONWebKey": { "type": "object", "title": "JSONWebKey represents a public or private key in JWK format.", @@ -7480,28 +7480,6 @@ "$ref": "#/definitions/Transformation" } }, - "TrimDashboardCommand": { - "type": "object", - "properties": { - "dashboard": { - "$ref": "#/definitions/Json" - }, - "meta": { - "$ref": "#/definitions/Json" - } - } - }, - "TrimDashboardFullWithMeta": { - "type": "object", - "properties": { - "dashboard": { - "$ref": "#/definitions/Json" - }, - "meta": { - "$ref": "#/definitions/Json" - } - } - }, "Type": { "type": "string" }, @@ -8686,7 +8664,7 @@ "getAnnotationByIDResponse": { "description": "", "schema": { - "$ref": "#/definitions/ItemDTO" + "$ref": "#/definitions/Annotation" } }, "getAnnotationTagsResponse": { @@ -8700,7 +8678,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/ItemDTO" + "$ref": "#/definitions/Annotation" } } }, @@ -9316,6 +9294,10 @@ "url" ], "properties": { + "folderUid": { + "description": "FolderUID The unique identifier (uid) of the folder the dashboard belongs to.", + "type": "string" + }, "id": { "description": "ID The unique identifier (id) of the created/updated dashboard.", "type": "integer", @@ -9483,12 +9465,6 @@ "$ref": "#/definitions/AlertTestResult" } }, - "trimDashboardResponse": { - "description": "", - "schema": { - "$ref": "#/definitions/TrimDashboardFullWithMeta" - } - }, "unauthorisedError": { "description": "UnauthorizedError is returned when the request is not authenticated.", "schema": { diff --git a/public/api-merged.json b/public/api-merged.json index ee7333b2152..66dddbdf3c3 100644 --- a/public/api-merged.json +++ b/public/api-merged.json @@ -12027,6 +12027,80 @@ } } }, + "Annotation": { + "type": "object", + "properties": { + "alertId": { + "type": "integer", + "format": "int64" + }, + "alertName": { + "type": "string" + }, + "avatarUrl": { + "type": "string" + }, + "created": { + "type": "integer", + "format": "int64" + }, + "dashboardId": { + "type": "integer", + "format": "int64" + }, + "dashboardUID": { + "type": "string" + }, + "data": { + "$ref": "#/definitions/Json" + }, + "email": { + "type": "string" + }, + "id": { + "type": "integer", + "format": "int64" + }, + "login": { + "type": "string" + }, + "newState": { + "type": "string" + }, + "panelId": { + "type": "integer", + "format": "int64" + }, + "prevState": { + "type": "string" + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "text": { + "type": "string" + }, + "time": { + "type": "integer", + "format": "int64" + }, + "timeEnd": { + "type": "integer", + "format": "int64" + }, + "updated": { + "type": "integer", + "format": "int64" + }, + "userId": { + "type": "integer", + "format": "int64" + } + } + }, "AnnotationActions": { "type": "object", "properties": { @@ -15478,80 +15552,6 @@ } } }, - "ItemDTO": { - "type": "object", - "properties": { - "alertId": { - "type": "integer", - "format": "int64" - }, - "alertName": { - "type": "string" - }, - "avatarUrl": { - "type": "string" - }, - "created": { - "type": "integer", - "format": "int64" - }, - "dashboardId": { - "type": "integer", - "format": "int64" - }, - "dashboardUID": { - "type": "string" - }, - "data": { - "$ref": "#/definitions/Json" - }, - "email": { - "type": "string" - }, - "id": { - "type": "integer", - "format": "int64" - }, - "login": { - "type": "string" - }, - "newState": { - "type": "string" - }, - "panelId": { - "type": "integer", - "format": "int64" - }, - "prevState": { - "type": "string" - }, - "tags": { - "type": "array", - "items": { - "type": "string" - } - }, - "text": { - "type": "string" - }, - "time": { - "type": "integer", - "format": "int64" - }, - "timeEnd": { - "type": "integer", - "format": "int64" - }, - "updated": { - "type": "integer", - "format": "int64" - }, - "userId": { - "type": "integer", - "format": "int64" - } - } - }, "JSONWebKey": { "type": "object", "title": "JSONWebKey represents a public or private key in JWK format.", @@ -19843,28 +19843,6 @@ "$ref": "#/definitions/Transformation" } }, - "TrimDashboardCommand": { - "type": "object", - "properties": { - "dashboard": { - "$ref": "#/definitions/Json" - }, - "meta": { - "$ref": "#/definitions/Json" - } - } - }, - "TrimDashboardFullWithMeta": { - "type": "object", - "properties": { - "dashboard": { - "$ref": "#/definitions/Json" - }, - "meta": { - "$ref": "#/definitions/Json" - } - } - }, "Type": { "type": "string" }, @@ -21796,7 +21774,7 @@ "getAnnotationByIDResponse": { "description": "(empty)", "schema": { - "$ref": "#/definitions/ItemDTO" + "$ref": "#/definitions/Annotation" } }, "getAnnotationTagsResponse": { @@ -21810,7 +21788,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/definitions/ItemDTO" + "$ref": "#/definitions/Annotation" } } }, @@ -22606,12 +22584,6 @@ "$ref": "#/definitions/AlertTestResult" } }, - "trimDashboardResponse": { - "description": "(empty)", - "schema": { - "$ref": "#/definitions/TrimDashboardFullWithMeta" - } - }, "unauthorisedError": { "description": "UnauthorizedError is returned when the request is not authenticated.", "schema": { diff --git a/public/openapi3.json b/public/openapi3.json index e77ed17cddb..64768646ea0 100644 --- a/public/openapi3.json +++ b/public/openapi3.json @@ -674,7 +674,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/ItemDTO" + "$ref": "#/components/schemas/Annotation" } } }, @@ -695,7 +695,7 @@ "application/json": { "schema": { "items": { - "$ref": "#/components/schemas/ItemDTO" + "$ref": "#/components/schemas/Annotation" }, "type": "array" } @@ -1855,16 +1855,6 @@ }, "description": "(empty)" }, - "trimDashboardResponse": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/TrimDashboardFullWithMeta" - } - } - }, - "description": "(empty)" - }, "unauthorisedError": { "content": { "application/json": { @@ -2951,6 +2941,80 @@ }, "type": "object" }, + "Annotation": { + "properties": { + "alertId": { + "format": "int64", + "type": "integer" + }, + "alertName": { + "type": "string" + }, + "avatarUrl": { + "type": "string" + }, + "created": { + "format": "int64", + "type": "integer" + }, + "dashboardId": { + "format": "int64", + "type": "integer" + }, + "dashboardUID": { + "type": "string" + }, + "data": { + "$ref": "#/components/schemas/Json" + }, + "email": { + "type": "string" + }, + "id": { + "format": "int64", + "type": "integer" + }, + "login": { + "type": "string" + }, + "newState": { + "type": "string" + }, + "panelId": { + "format": "int64", + "type": "integer" + }, + "prevState": { + "type": "string" + }, + "tags": { + "items": { + "type": "string" + }, + "type": "array" + }, + "text": { + "type": "string" + }, + "time": { + "format": "int64", + "type": "integer" + }, + "timeEnd": { + "format": "int64", + "type": "integer" + }, + "updated": { + "format": "int64", + "type": "integer" + }, + "userId": { + "format": "int64", + "type": "integer" + } + }, + "type": "object" + }, "AnnotationActions": { "properties": { "canAdd": { @@ -6402,80 +6466,6 @@ }, "type": "object" }, - "ItemDTO": { - "properties": { - "alertId": { - "format": "int64", - "type": "integer" - }, - "alertName": { - "type": "string" - }, - "avatarUrl": { - "type": "string" - }, - "created": { - "format": "int64", - "type": "integer" - }, - "dashboardId": { - "format": "int64", - "type": "integer" - }, - "dashboardUID": { - "type": "string" - }, - "data": { - "$ref": "#/components/schemas/Json" - }, - "email": { - "type": "string" - }, - "id": { - "format": "int64", - "type": "integer" - }, - "login": { - "type": "string" - }, - "newState": { - "type": "string" - }, - "panelId": { - "format": "int64", - "type": "integer" - }, - "prevState": { - "type": "string" - }, - "tags": { - "items": { - "type": "string" - }, - "type": "array" - }, - "text": { - "type": "string" - }, - "time": { - "format": "int64", - "type": "integer" - }, - "timeEnd": { - "format": "int64", - "type": "integer" - }, - "updated": { - "format": "int64", - "type": "integer" - }, - "userId": { - "format": "int64", - "type": "integer" - } - }, - "type": "object" - }, "JSONWebKey": { "properties": { "Algorithm": { @@ -10765,28 +10755,6 @@ }, "type": "array" }, - "TrimDashboardCommand": { - "properties": { - "dashboard": { - "$ref": "#/components/schemas/Json" - }, - "meta": { - "$ref": "#/components/schemas/Json" - } - }, - "type": "object" - }, - "TrimDashboardFullWithMeta": { - "properties": { - "dashboard": { - "$ref": "#/components/schemas/Json" - }, - "meta": { - "$ref": "#/components/schemas/Json" - } - }, - "type": "object" - }, "Type": { "type": "string" },