@@ -62,7 +62,8 @@ export const swagger = async <Path extends string = '/swagger'>(
6262 }
6363
6464 const app = new Elysia ( { name : '@elysiajs/swagger' } )
65- const prefixedPath = join ( app . config . prefix ?? "/" , path )
65+ const appPrefix = app . config . prefix ?? "/"
66+ const prefixedPath = join ( appPrefix , path )
6667
6768 app . get ( path , function documentation ( request ) {
6869 // External Prefix, if the app is behind a reverse proxy
@@ -134,7 +135,7 @@ export const swagger = async <Path extends string = '/swagger'>(
134135 schema,
135136 hook : route . hooks ,
136137 method,
137- path : join ( extPrefix , prefixedPath , route . path ) ,
138+ path : join ( extPrefix , appPrefix , route . path ) ,
138139 // @ts -ignore
139140 models : app . definitions ?. type ,
140141 contentType : route . hooks . type
@@ -147,7 +148,7 @@ export const swagger = async <Path extends string = '/swagger'>(
147148 schema,
148149 hook : route . hooks ,
149150 method : route . method ,
150- path : join ( extPrefix , prefixedPath , route . path ) ,
151+ path : join ( extPrefix , appPrefix , route . path ) ,
151152 // @ts -ignore
152153 models : app . definitions ?. type ,
153154 contentType : route . hooks . type
0 commit comments