Skip to content

Commit

Permalink
Merge pull request #146 from chrisllontop/fix/relative-specs-path
Browse files Browse the repository at this point in the history
Fix nested path issue in Swagger and Scalar config
  • Loading branch information
marclave authored Sep 25, 2024
2 parents 2a74d3b + bfce798 commit 337926c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const swagger = async <Path extends string = '/swagger'>(

app.get(path, function documentation() {
const combinedSwaggerOptions = {
url: `${relativePath}/json`,
url: `/${relativePath}/json`,
dom_id: '#swagger-ui',
...swaggerOptions
}
Expand All @@ -83,7 +83,7 @@ export const swagger = async <Path extends string = '/swagger'>(
const scalarConfiguration: ReferenceConfiguration = {
spec: {
...scalarConfig.spec,
url: `${relativePath}/json`
url: `/${relativePath}/json`
},
...scalarConfig
}
Expand Down Expand Up @@ -111,7 +111,7 @@ export const swagger = async <Path extends string = '/swagger'>(
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
Expand Down

0 comments on commit 337926c

Please sign in to comment.