mirror of
https://github.com/zoriya/elysia-swagger.git
synced 2025-12-06 00:36:10 +00:00
Merge pull request #185 from bhaleraosaurabh/Scalar-path-config-issue
Fix path issue in Scalar config
This commit is contained in:
@@ -66,7 +66,7 @@ export const swagger = async <Path extends string = '/swagger'>(
|
|||||||
|
|
||||||
const app = new Elysia({ name: '@elysiajs/swagger' })
|
const app = new Elysia({ name: '@elysiajs/swagger' })
|
||||||
|
|
||||||
app.get(path, function documentation() {
|
app.get(path, function documentation({request}) {
|
||||||
const combinedSwaggerOptions = {
|
const combinedSwaggerOptions = {
|
||||||
url: openAPISpecUrl,
|
url: openAPISpecUrl,
|
||||||
dom_id: '#swagger-ui',
|
dom_id: '#swagger-ui',
|
||||||
@@ -85,7 +85,7 @@ export const swagger = async <Path extends string = '/swagger'>(
|
|||||||
const scalarConfiguration: ReferenceConfiguration = {
|
const scalarConfiguration: ReferenceConfiguration = {
|
||||||
spec: {
|
spec: {
|
||||||
...scalarConfig.spec,
|
...scalarConfig.spec,
|
||||||
url: openAPISpecUrl
|
url: `${new URL(request.url).pathname.replace(/\/$/, "")}/json`
|
||||||
},
|
},
|
||||||
...scalarConfig,
|
...scalarConfig,
|
||||||
// so we can showcase the elysia theme
|
// so we can showcase the elysia theme
|
||||||
|
|||||||
Reference in New Issue
Block a user