From e0dd56e4c7b4c70a61ae45e6edcf321119cc7f29 Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Thu, 31 Jul 2025 14:08:42 -0400 Subject: [PATCH] fix(swagger): Fix swagger/OpenAPI defs for /api/anonymous/* endpoints (#108999) Signed-off-by: Dave Henderson --- pkg/services/anonymous/anonimpl/api/api.go | 4 +- public/api-enterprise-spec.json | 2 +- public/api-merged.json | 114 +++++++++++---------- public/openapi3.json | 102 +++++++++--------- 4 files changed, 113 insertions(+), 109 deletions(-) diff --git a/pkg/services/anonymous/anonimpl/api/api.go b/pkg/services/anonymous/anonimpl/api/api.go index 95774e1682b..b7e4e091ed2 100644 --- a/pkg/services/anonymous/anonimpl/api/api.go +++ b/pkg/services/anonymous/anonimpl/api/api.go @@ -55,7 +55,7 @@ func (api *AnonDeviceServiceAPI) RegisterAPIEndpoints() { }) } -// swagger:route GET /stats devices listDevices +// swagger:route GET /anonymous/devices devices listDevices // // # Lists all devices within the last 30 days // @@ -91,7 +91,7 @@ func (api *AnonDeviceServiceAPI) ListDevices(c *contextmodel.ReqContext) respons return response.JSON(http.StatusOK, resDevices) } -// swagger:route POST /search devices SearchDevices +// swagger:route GET /anonymous/search devices SearchDevices // // # Lists all devices within the last 30 days // diff --git a/public/api-enterprise-spec.json b/public/api-enterprise-spec.json index 6d5885e3bdd..699a3535e54 100644 --- a/public/api-enterprise-spec.json +++ b/public/api-enterprise-spec.json @@ -8321,7 +8321,7 @@ "type": "object", "properties": { "Object": { - "description": "Object is a JSON compatible map with string, float, int, bool, []interface{},\nor map[string]interface{} children.", + "description": "Object is a JSON compatible map with string, float, int, bool, []any,\nor map[string]any children.", "type": "object", "additionalProperties": {} } diff --git a/public/api-merged.json b/public/api-merged.json index 07e2a9726be..53f61f1eff1 100644 --- a/public/api-merged.json +++ b/public/api-merged.json @@ -2188,6 +2188,64 @@ } } }, + "/anonymous/devices": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "devices" + ], + "summary": "Lists all devices within the last 30 days", + "operationId": "listDevices", + "responses": { + "200": { + "$ref": "#/responses/devicesResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, + "/anonymous/search": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "devices" + ], + "summary": "Lists all devices within the last 30 days", + "operationId": "SearchDevices", + "responses": { + "200": { + "$ref": "#/responses/devicesSearchResponse" + }, + "401": { + "$ref": "#/responses/unauthorisedError" + }, + "403": { + "$ref": "#/responses/forbiddenError" + }, + "404": { + "$ref": "#/responses/notFoundError" + }, + "500": { + "$ref": "#/responses/internalServerError" + } + } + } + }, "/cloudmigration/migration": { "get": { "tags": [ @@ -9252,33 +9310,6 @@ "$ref": "#/responses/internalServerError" } } - }, - "post": { - "produces": [ - "application/json" - ], - "tags": [ - "devices" - ], - "summary": "Lists all devices within the last 30 days", - "operationId": "SearchDevices", - "responses": { - "200": { - "$ref": "#/responses/devicesSearchResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } } }, "/search/sorting": { @@ -9803,35 +9834,6 @@ } } }, - "/stats": { - "get": { - "produces": [ - "application/json" - ], - "tags": [ - "devices" - ], - "summary": "Lists all devices within the last 30 days", - "operationId": "listDevices", - "responses": { - "200": { - "$ref": "#/responses/devicesResponse" - }, - "401": { - "$ref": "#/responses/unauthorisedError" - }, - "403": { - "$ref": "#/responses/forbiddenError" - }, - "404": { - "$ref": "#/responses/notFoundError" - }, - "500": { - "$ref": "#/responses/internalServerError" - } - } - } - }, "/teams": { "post": { "tags": [ diff --git a/public/openapi3.json b/public/openapi3.json index 8928ac0429f..e1b97e3d0df 100644 --- a/public/openapi3.json +++ b/public/openapi3.json @@ -16065,6 +16065,58 @@ ] } }, + "/anonymous/devices": { + "get": { + "operationId": "listDevices", + "responses": { + "200": { + "$ref": "#/components/responses/devicesResponse" + }, + "401": { + "$ref": "#/components/responses/unauthorisedError" + }, + "403": { + "$ref": "#/components/responses/forbiddenError" + }, + "404": { + "$ref": "#/components/responses/notFoundError" + }, + "500": { + "$ref": "#/components/responses/internalServerError" + } + }, + "summary": "Lists all devices within the last 30 days", + "tags": [ + "devices" + ] + } + }, + "/anonymous/search": { + "get": { + "operationId": "SearchDevices", + "responses": { + "200": { + "$ref": "#/components/responses/devicesSearchResponse" + }, + "401": { + "$ref": "#/components/responses/unauthorisedError" + }, + "403": { + "$ref": "#/components/responses/forbiddenError" + }, + "404": { + "$ref": "#/components/responses/notFoundError" + }, + "500": { + "$ref": "#/components/responses/internalServerError" + } + }, + "summary": "Lists all devices within the last 30 days", + "tags": [ + "devices" + ] + } + }, "/cloudmigration/migration": { "get": { "operationId": "getSessionList", @@ -23774,30 +23826,6 @@ "tags": [ "search" ] - }, - "post": { - "operationId": "SearchDevices", - "responses": { - "200": { - "$ref": "#/components/responses/devicesSearchResponse" - }, - "401": { - "$ref": "#/components/responses/unauthorisedError" - }, - "403": { - "$ref": "#/components/responses/forbiddenError" - }, - "404": { - "$ref": "#/components/responses/notFoundError" - }, - "500": { - "$ref": "#/components/responses/internalServerError" - } - }, - "summary": "Lists all devices within the last 30 days", - "tags": [ - "devices" - ] } }, "/search/sorting": { @@ -24360,32 +24388,6 @@ ] } }, - "/stats": { - "get": { - "operationId": "listDevices", - "responses": { - "200": { - "$ref": "#/components/responses/devicesResponse" - }, - "401": { - "$ref": "#/components/responses/unauthorisedError" - }, - "403": { - "$ref": "#/components/responses/forbiddenError" - }, - "404": { - "$ref": "#/components/responses/notFoundError" - }, - "500": { - "$ref": "#/components/responses/internalServerError" - } - }, - "summary": "Lists all devices within the last 30 days", - "tags": [ - "devices" - ] - } - }, "/teams": { "post": { "operationId": "createTeam",