From 4d4823599d3288b170f112b711dc812635729033 Mon Sep 17 00:00:00 2001 From: Saurabh Bhalerao Date: Fri, 31 Jan 2025 00:28:06 +0530 Subject: [PATCH 1/2] Fix path issue in Swagger and Scalar config --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 4ca0a51..437729d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -66,7 +66,7 @@ export const swagger = async ( const app = new Elysia({ name: '@elysiajs/swagger' }) - app.get(path, function documentation() { + app.get(path, function documentation({request}) { const combinedSwaggerOptions = { url: openAPISpecUrl, dom_id: '#swagger-ui', @@ -85,7 +85,7 @@ export const swagger = async ( const scalarConfiguration: ReferenceConfiguration = { spec: { ...scalarConfig.spec, - url: openAPISpecUrl + url: `${request.url}/json` }, ...scalarConfig, // so we can showcase the elysia theme From a4229eb6ac1c93f3ecb9686d03fee08f93789a39 Mon Sep 17 00:00:00 2001 From: Saurabh Bhalerao Date: Fri, 21 Feb 2025 16:34:51 +0530 Subject: [PATCH 2/2] Update src/index.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jozef Mikuláš --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 437729d..fbf4d26 100644 --- a/src/index.ts +++ b/src/index.ts @@ -85,7 +85,7 @@ export const swagger = async ( const scalarConfiguration: ReferenceConfiguration = { spec: { ...scalarConfig.spec, - url: `${request.url}/json` + url: `${new URL(request.url).pathname.replace(/\/$/, "")}/json` }, ...scalarConfig, // so we can showcase the elysia theme