mirror of
https://github.com/zoriya/elysia-swagger.git
synced 2025-12-06 00:36:10 +00:00
Fix nested path issue in Swagger and Scalar config
This commit is contained in:
@@ -66,7 +66,7 @@ export const swagger = async <Path extends string = '/swagger'>(
|
|||||||
|
|
||||||
app.get(path, function documentation() {
|
app.get(path, function documentation() {
|
||||||
const combinedSwaggerOptions = {
|
const combinedSwaggerOptions = {
|
||||||
url: `${relativePath}/json`,
|
url: `/${relativePath}/json`,
|
||||||
dom_id: '#swagger-ui',
|
dom_id: '#swagger-ui',
|
||||||
...swaggerOptions
|
...swaggerOptions
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ export const swagger = async <Path extends string = '/swagger'>(
|
|||||||
const scalarConfiguration: ReferenceConfiguration = {
|
const scalarConfiguration: ReferenceConfiguration = {
|
||||||
spec: {
|
spec: {
|
||||||
...scalarConfig.spec,
|
...scalarConfig.spec,
|
||||||
url: `${relativePath}/json`
|
url: `/${relativePath}/json`
|
||||||
},
|
},
|
||||||
...scalarConfig
|
...scalarConfig
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,7 @@ export const swagger = async <Path extends string = '/swagger'>(
|
|||||||
if (routes.length !== totalRoutes) {
|
if (routes.length !== totalRoutes) {
|
||||||
const ALLOWED_METHODS = ['GET', 'PUT', 'POST', 'DELETE', 'OPTIONS', 'HEAD', 'PATCH', 'TRACE']
|
const ALLOWED_METHODS = ['GET', 'PUT', 'POST', 'DELETE', 'OPTIONS', 'HEAD', 'PATCH', 'TRACE']
|
||||||
totalRoutes = routes.length
|
totalRoutes = routes.length
|
||||||
|
|
||||||
routes.forEach((route: InternalRoute) => {
|
routes.forEach((route: InternalRoute) => {
|
||||||
if (route.hooks?.detail?.hide === true) return
|
if (route.hooks?.detail?.hide === true) return
|
||||||
// TODO: route.hooks?.detail?.hide !== false add ability to hide: false to prevent excluding
|
// TODO: route.hooks?.detail?.hide !== false add ability to hide: false to prevent excluding
|
||||||
|
|||||||
Reference in New Issue
Block a user