Reputation: 4010
Does the NestJS OpenAPI/Swagger implementation support reuse of common parameters?
This would save me from having to litter my endpoint with identical @ApiImplicitQuery
decorators.
Upvotes: 0
Views: 452
Reputation: 60357
You could just create your own reusable decorator:
const ApiRoleQuery = ApiImplicitQuery({
name: 'role',
enum: ['Admin', 'Moderator', 'User'],
});
and then use it in your controller:
@ApiRoleQuery
@Get()
async filterByRole(@Query('role') role) {
// ...
}
Upvotes: 2