File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 1
1
/* eslint-disable @typescript-eslint/ban-ts-comment */
2
2
import { Elysia , type InternalRoute } from 'elysia'
3
+ import { resolve } from 'node:path' ;
3
4
4
5
import { SwaggerUIRender } from './swagger'
5
6
import { ScalarRender } from './scalar'
@@ -64,9 +65,9 @@ export const swagger = async <Path extends string = '/swagger'>(
64
65
65
66
const app = new Elysia ( { name : '@elysiajs/swagger' } )
66
67
67
- app . get ( path , function documentation ( ) {
68
+ app . get ( path , function documentation ( { path : reqPath } ) {
68
69
const combinedSwaggerOptions = {
69
- url : `/ ${ relativePath } / json` ,
70
+ url : resolve ( reqPath , '/ json' ) ,
70
71
dom_id : '#swagger-ui' ,
71
72
...swaggerOptions
72
73
}
@@ -83,7 +84,7 @@ export const swagger = async <Path extends string = '/swagger'>(
83
84
const scalarConfiguration : ReferenceConfiguration = {
84
85
spec : {
85
86
...scalarConfig . spec ,
86
- url : `/ ${ relativePath } / json`
87
+ url : resolve ( reqPath , '/ json' )
87
88
} ,
88
89
...scalarConfig ,
89
90
// so we can showcase the elysia theme
You can’t perform that action at this time.
0 commit comments