File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -62,11 +62,13 @@ export const swagger = async <Path extends string = '/swagger'>(
62
62
63
63
const relativePath = path . startsWith ( '/' ) ? path . slice ( 1 ) : path
64
64
65
+ const openAPISpecUrl = relativePath === '' ? `/json` : `/${ relativePath } /json`
66
+
65
67
const app = new Elysia ( { name : '@elysiajs/swagger' } )
66
68
67
69
app . get ( path , function documentation ( ) {
68
70
const combinedSwaggerOptions = {
69
- url : `/ ${ relativePath } /json` ,
71
+ url : openAPISpecUrl ,
70
72
dom_id : '#swagger-ui' ,
71
73
...swaggerOptions
72
74
}
@@ -83,7 +85,7 @@ export const swagger = async <Path extends string = '/swagger'>(
83
85
const scalarConfiguration : ReferenceConfiguration = {
84
86
spec : {
85
87
...scalarConfig . spec ,
86
- url : `/ ${ relativePath } /json`
88
+ url : openAPISpecUrl
87
89
} ,
88
90
...scalarConfig
89
91
}
You can’t perform that action at this time.
0 commit comments