Cody2333 / koa-swagger-decorator

using decorator to automatically generate swagger doc for koa-router
348 stars 81 forks source link

No swagger doc shows when using export instead of export default #144

Closed MarekZhang closed 2 years ago

MarekZhang commented 2 years ago

Hi, Thanks for this convenient tool you provided. I'm wondering if this is a potential bug when using export instead of export default.

e.g. Here's the tree of my project.

src
├── app.ts
├── controller
│   ├── index.ts
│   ├── localAuthority.ts
├── model
│   ├── LocalAuthority.ts
│   └── index.ts
├── routes
│   ├── localAuthority.router.ts

If I use export {LocalAuthorityController} replacing export default class LocalAuthorityController to export the class in localAuthority.ts, there would be no generated doc for this LocalAuthority module.

I used localAuthorityRouter.mapDir(path.resolve(__dirname, '../controller'))in localAuthority.router.ts to map the dir, I'm not sure if that's the problem, but I tested with localAuthorityRouter.mapDir(path.resolve(__dirname)) and no doc showed.

Cody2333 commented 2 years ago

only export default class XXX can be loaded by mapDir()