FoalTS / foal

Full-featured Node.js framework, with no complexity. 🚀 Simple and easy to use, TypeScript-based and well-documented.
https://foalts.org/
MIT License
1.89k stars 140 forks source link

Can ValidateBody be made "Generic" from @foal/typestack? #752

Closed AleksandrSl closed 4 years ago

AleksandrSl commented 4 years ago

We have generic entity controller to reduce amount of code and decorators in other controllers and it's very handy to get values for decorators from child controller, e.g. @ValidateBody((controller: EntityController<any>) => controller.paginatedListSchema). But for ValidateBody @foal/typestack we can't. Maybe there is a way to add similar lambda based parameter to get class from controller?

LoicPoullain commented 4 years ago

Do you want to submit a PR on this? We could probably add some lines in @foal/typestack similar to these ones:

AleksandrSl commented 4 years ago

Thanks, will try to make changes!

LoicPoullain commented 4 years ago

Feature added in v1.10.0