Skip to content

Commit 337926c

Browse files
authored
Merge pull request #146 from chrisllontop/fix/relative-specs-path
Fix nested path issue in Swagger and Scalar config
2 parents 2a74d3b + bfce798 commit 337926c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const swagger = async <Path extends string = '/swagger'>(
6666

6767
app.get(path, function documentation() {
6868
const combinedSwaggerOptions = {
69-
url: `${relativePath}/json`,
69+
url: `/${relativePath}/json`,
7070
dom_id: '#swagger-ui',
7171
...swaggerOptions
7272
}
@@ -83,7 +83,7 @@ export const swagger = async <Path extends string = '/swagger'>(
8383
const scalarConfiguration: ReferenceConfiguration = {
8484
spec: {
8585
...scalarConfig.spec,
86-
url: `${relativePath}/json`
86+
url: `/${relativePath}/json`
8787
},
8888
...scalarConfig
8989
}
@@ -111,7 +111,7 @@ export const swagger = async <Path extends string = '/swagger'>(
111111
if (routes.length !== totalRoutes) {
112112
const ALLOWED_METHODS = ['GET', 'PUT', 'POST', 'DELETE', 'OPTIONS', 'HEAD', 'PATCH', 'TRACE']
113113
totalRoutes = routes.length
114-
114+
115115
routes.forEach((route: InternalRoute) => {
116116
if (route.hooks?.detail?.hide === true) return
117117
// TODO: route.hooks?.detail?.hide !== false add ability to hide: false to prevent excluding

0 commit comments

Comments
 (0)