elysiajs / elysia-swagger

A plugin for Elysia to auto-generate Swagger page
MIT License
90 stars 46 forks source link

Nested paths as `path` config doesn't work #135

Open bogeychan opened 4 months ago

bogeychan commented 4 months ago

Versions

elysia@1.1.3
@elysiajs/swagger@1.1.0

Code

import { Elysia } from 'elysia'
import { swagger } from "@elysiajs/swagger";

new Elysia()
    .use(
        swagger({
            path: '/v1/swagger'
        })
    )
    .get('/', () => '')
    .listen(8080)

Problem

The path passed to the frontend is wrong: Instead of v1/swagger/json it has to be /v1/swagger/json for both scalar and swagger-ui https://github.com/elysiajs/elysia-swagger/blob/ca5bdfac020cf8bb1e53355e7a2a3f9535f4fe04/src/index.ts#L69 https://github.com/elysiajs/elysia-swagger/blob/ca5bdfac020cf8bb1e53355e7a2a3f9535f4fe04/src/index.ts#L86

reported on discord