#Generic controller with documentation in swagger

6 messages · Page 1 of 1 (latest)

ebon sentinel
#

Hi,

good afternoon

when will nestjs support generic controller with documentation in swagger?

cobalt niche
#

When typescript supports reflecting metadata from generics (so, probably, not anytime soon)

ebon sentinel
#

nice, thank you so much

snow matrix
#

I just recently dipped into a not so old Java project with 4 levels of inheritance just for controllers. The lowest one defined all crud methods with swagger annotations. If you wanted to disable for example "delete", you had to override it in child controller and throw and error instead. I'll take non-generic explicit controller over inheritance hell any time 😅

ebon sentinel
#

I understand, but my project has a lot of controller files! I need to create all the methods to represent my CRUD, so it gets complicated!
I prefer to keep it like this and override the controller to disable the method, for example!
Thanks for sharing this situation with me!

snow matrix
#

If you insist on that approach, there is a way to do it using a class mixin approacch