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'>(
6262
6363 const relativePath = path . startsWith ( '/' ) ? path . slice ( 1 ) : path
6464
65+ const openAPISpecUrl = relativePath === '' ? `/json` : `/${ relativePath } /json`
66+
6567 const app = new Elysia ( { name : '@elysiajs/swagger' } )
6668
6769 app . get ( path , function documentation ( ) {
6870 const combinedSwaggerOptions = {
69- url : `/ ${ relativePath } /json` ,
71+ url : openAPISpecUrl ,
7072 dom_id : '#swagger-ui' ,
7173 ...swaggerOptions
7274 }
@@ -83,7 +85,7 @@ export const swagger = async <Path extends string = '/swagger'>(
8385 const scalarConfiguration : ReferenceConfiguration = {
8486 spec : {
8587 ...scalarConfig . spec ,
86- url : `/ ${ relativePath } /json`
88+ url : openAPISpecUrl
8789 } ,
8890 ...scalarConfig ,
8991 // so we can showcase the elysia theme
You can’t perform that action at this time.
0 commit comments