elysiajs / elysia-swagger

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

Swagger does not generate documentation if path is set to the home directory. #115

Closed akainocode closed 5 months ago

akainocode commented 5 months ago

Swagger doesn't appear to generate documentation if the path is set to '/', an example here:

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

const app = new Elysia()
  .use(swagger({
    path: '/',
    documentation : {
      tags : [
        { name: 'tag1', description: 'desc1'},
      ]
    }
  }))
  .get('/test', () => "Test", {
    detail : {
      tags: ['tag1']
    } 
  })
  .listen(3000)

The above only generates the background page for the swagger documentation, while if you adjust the path parameter to anything else or even remove it, it appears to work.

I can write a workaround to achieve the intended effect, but it does appear to be a bug.

marclave commented 5 months ago

got a PR open :)

https://github.com/elysiajs/elysia-swagger/pull/118

akainocode commented 5 months ago

Thank you! I'll close this issue once it gets merged.