From 9120b37c1fc89a47bdd725ac5dc006eafa899ec2 Mon Sep 17 00:00:00 2001 From: Lhcfl Date: Wed, 22 May 2024 17:18:50 +0800 Subject: [PATCH 1/3] Use elements as API Document --- packages/backend/assets/redoc.html | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/packages/backend/assets/redoc.html b/packages/backend/assets/redoc.html index 403af4bbfa..3af7dec4d4 100644 --- a/packages/backend/assets/redoc.html +++ b/packages/backend/assets/redoc.html @@ -1,23 +1,19 @@ + + Firefish API - - - - - - + + + - - + From b1ba863a0ba3eeb3458bde457f6938b369116c0d Mon Sep 17 00:00:00 2001 From: Lhcfl Date: Wed, 22 May 2024 17:41:38 +0800 Subject: [PATCH 2/3] add crossorigin="anonymous" --- packages/backend/assets/redoc.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend/assets/redoc.html b/packages/backend/assets/redoc.html index 3af7dec4d4..834f645607 100644 --- a/packages/backend/assets/redoc.html +++ b/packages/backend/assets/redoc.html @@ -5,7 +5,7 @@ Firefish API - + From 37998e8bc36f0837dcdc5e3fb75cddd511be808a Mon Sep 17 00:00:00 2001 From: Lhcfl Date: Sun, 2 Jun 2024 23:54:50 +0800 Subject: [PATCH 3/3] Ensure unique operationId --- packages/backend/src/server/api/openapi/gen-spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/server/api/openapi/gen-spec.ts b/packages/backend/src/server/api/openapi/gen-spec.ts index 79dc48a8bb..84991156e2 100644 --- a/packages/backend/src/server/api/openapi/gen-spec.ts +++ b/packages/backend/src/server/api/openapi/gen-spec.ts @@ -101,7 +101,7 @@ export function genOpenapiSpec() { } const info = { - operationId: endpoint.name, + operationId: `POST-${endpoint.name}`, summary: endpoint.name, description: desc, externalDocs: { @@ -208,11 +208,11 @@ export function genOpenapiSpec() { }, }; - const path = { + const path: Record = { post: info, }; if (endpoint.meta.allowGet) { - path.get = { ...info }; + path.get = { ...info, operationId: `GET-${endpoint.name}` }; // API Key authentication is not permitted for GET requests path.get.security = path.get.security.filter( (elem) => !Object.prototype.hasOwnProperty.call(elem, "ApiKeyAuth"),