Cody2333 / koa-swagger-decorator

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

SwaggerRouter generics are not being passed to koa's Router #138

Closed Caprisone closed 2 years ago

Caprisone commented 2 years ago

I'm adding a middleware in my project which extends a koa's context. In order for router to know that, I should pass an extended type on router creation like this:

const router = new SwaggerRouter<MyState, MyContext>();

The following code fails because of a type mismatch:

router.get('/entity/:id', (ctx:MyContext) => controller(ctx));

The issue is, generics specified on SwaggerRouter creation are not being passed to koa's Router. The fix is pretty straight forward and I'm opening a PR.