From ccde891aa22c2adf585d10f8926efebd89308891 Mon Sep 17 00:00:00 2001
From: Mr Simon C <iamontheinternet@yahoo.com>
Date: Tue, 29 Oct 2024 23:50:19 +0000
Subject: [PATCH] Feature/update api example outputs (#2547)

* /v1/workspace/{slug} actually returns an array - update example output

* update swagger example to show array output
---
 server/endpoints/api/workspace/index.js | 26 +++++++++++++------------
 server/swagger/openapi.json             | 26 +++++++++++++------------
 2 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/server/endpoints/api/workspace/index.js b/server/endpoints/api/workspace/index.js
index dca21e49f..090d5c7af 100644
--- a/server/endpoints/api/workspace/index.js
+++ b/server/endpoints/api/workspace/index.js
@@ -150,18 +150,20 @@ function apiWorkspaceEndpoints(app) {
           schema: {
             type: 'object',
             example: {
-              workspace: {
-                "id": 79,
-                "name": "My workspace",
-                "slug": "my-workspace-123",
-                "createdAt": "2023-08-17 00:45:03",
-                "openAiTemp": null,
-                "lastUpdatedAt": "2023-08-17 00:45:03",
-                "openAiHistory": 20,
-                "openAiPrompt": null,
-                "documents": [],
-                "threads": []
-              }
+              workspace: [
+                {
+                  "id": 79,
+                  "name": "My workspace",
+                  "slug": "my-workspace-123",
+                  "createdAt": "2023-08-17 00:45:03",
+                  "openAiTemp": null,
+                  "lastUpdatedAt": "2023-08-17 00:45:03",
+                  "openAiHistory": 20,
+                  "openAiPrompt": null,
+                  "documents": [],
+                  "threads": []
+                }
+              ]
             }
           }
         }
diff --git a/server/swagger/openapi.json b/server/swagger/openapi.json
index 1222b78b2..d478e1b26 100644
--- a/server/swagger/openapi.json
+++ b/server/swagger/openapi.json
@@ -1473,18 +1473,20 @@
                 "schema": {
                   "type": "object",
                   "example": {
-                    "workspace": {
-                      "id": 79,
-                      "name": "My workspace",
-                      "slug": "my-workspace-123",
-                      "createdAt": "2023-08-17 00:45:03",
-                      "openAiTemp": null,
-                      "lastUpdatedAt": "2023-08-17 00:45:03",
-                      "openAiHistory": 20,
-                      "openAiPrompt": null,
-                      "documents": [],
-                      "threads": []
-                    }
+                    "workspace": [
+                      {
+                        "id": 79,
+                        "name": "My workspace",
+                        "slug": "my-workspace-123",
+                        "createdAt": "2023-08-17 00:45:03",
+                        "openAiTemp": null,
+                        "lastUpdatedAt": "2023-08-17 00:45:03",
+                        "openAiHistory": 20,
+                        "openAiPrompt": null,
+                        "documents": [],
+                        "threads": []
+                      }
+                    ]
                   }
                 }
               }
-- 
GitLab