From bfce798a56ed858cbd96f83e75767508f0b2b649 Mon Sep 17 00:00:00 2001 From: Christian Llontop Date: Tue, 3 Sep 2024 15:53:42 -0500 Subject: [PATCH] Fix nested path issue in Swagger and Scalar config --- src/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 7fdb2c9..bfbd905 100644 --- a/src/index.ts +++ b/src/index.ts @@ -66,7 +66,7 @@ export const swagger = async ( app.get(path, function documentation() { const combinedSwaggerOptions = { - url: `${relativePath}/json`, + url: `/${relativePath}/json`, dom_id: '#swagger-ui', ...swaggerOptions } @@ -83,7 +83,7 @@ export const swagger = async ( const scalarConfiguration: ReferenceConfiguration = { spec: { ...scalarConfig.spec, - url: `${relativePath}/json` + url: `/${relativePath}/json` }, ...scalarConfig } @@ -111,7 +111,7 @@ export const swagger = async ( if (routes.length !== totalRoutes) { const ALLOWED_METHODS = ['GET', 'PUT', 'POST', 'DELETE', 'OPTIONS', 'HEAD', 'PATCH', 'TRACE'] totalRoutes = routes.length - + routes.forEach((route: InternalRoute) => { if (route.hooks?.detail?.hide === true) return // TODO: route.hooks?.detail?.hide !== false add ability to hide: false to prevent excluding