From 4113fec550b555b2c7da21caffd48dba422d684f Mon Sep 17 00:00:00 2001 From: Jonas Date: Wed, 6 Nov 2024 23:19:54 +0100 Subject: [PATCH] updates to new scalar-ui and adds securitySchemes to `open-api.json` (closes #56) --- src/v1/index.ts | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/v1/index.ts b/src/v1/index.ts index cfe7e4c..7b9554a 100644 --- a/src/v1/index.ts +++ b/src/v1/index.ts @@ -25,12 +25,18 @@ export const v1 = new Elysia({ prefix: `/${V1_PATH}` }) .use(GITHUB_GENERAL) .use(GITHUB_ORGS) .use(GITHUB_USERS), + + // Set default in endpoints: + /* { + detail: { security: [{ BearerAuth: [] }] } + } */ ) .group("/jira", (app) => app.use(JIRA_AUTHENTICATION).use(JIRA_GENERAL)) .use( swagger({ - /* 1.25.25 */ - scalarVersion: "1.17.16", + /* Stable: 1.17.16 */ + /* Modern UI: 1.25.25 */ + scalarVersion: "1.25.58", path: SWAGGER_PATH, exclude: [ ...ROOT_PATHS, @@ -43,7 +49,7 @@ export const v1 = new Elysia({ prefix: `/${V1_PATH}` }) title: "Propromo RestAPI Documentation", description: "A RestAPI for the scopes of the Github GraphqlAPI, that Propromo needs (latest).", - version: "1.0.11", + version: "1.0.12", }, tags: [ { @@ -60,6 +66,15 @@ export const v1 = new Elysia({ prefix: `/${V1_PATH}` }) "Authenticate here first, to send requests to protected endpoints.", }, ], + components: { + securitySchemes: { + BearerAuth: { + type: 'http', + scheme: 'bearer', + bearerFormat: 'JWT', + }, + }, + }, }, scalarConfig: { metaData: { @@ -72,17 +87,9 @@ export const v1 = new Elysia({ prefix: `/${V1_PATH}` }) alt: "favicon", }, }, - /* components: { - securitySchemes: { - BearerAuth: { - type: "http", - scheme: "bearer" - }, - }, - }, authentication: { - preferredSecurityScheme: "BearerAuth", - } */ + preferredSecurityScheme: 'BearerAuth', + }, }, }), );