From 497a20fdd4999e2899e039d90867d6f01e52547c Mon Sep 17 00:00:00 2001 From: recanman <29310982+recanman@users.noreply.github.com> Date: Fri, 21 Jun 2024 10:37:03 -0700 Subject: [PATCH] fix: use absolute path --- src/index.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/index.ts b/src/index.ts index ea13308..7a30e53 100644 --- a/src/index.ts +++ b/src/index.ts @@ -62,13 +62,11 @@ export const swagger = ...documentation.info } - const relativePath = path.startsWith('/') ? path.slice(1) : path - app.get( path, () => { const combinedSwaggerOptions = { - url: `${relativePath}/json`, + url: `${path}/json`, dom_id: '#swagger-ui', ...swaggerOptions } @@ -85,7 +83,7 @@ export const swagger = const scalarConfiguration: ReferenceConfiguration = { spec: { ...scalarConfig.spec, - url: `${relativePath}/json`, + url: `${path}/json`, }, ...scalarConfig } @@ -146,7 +144,7 @@ export const swagger = ...documentation.info } }, - paths: {...filterPaths(schema, relativePath, { + paths: {...filterPaths(schema, path, { excludeStaticFile, exclude: Array.isArray(exclude) ? exclude : [exclude] }),