You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there an existing issue that is already proposing this?
I have searched the existing issues
Is your feature request related to a problem? Please describe it
Take the following example:
@ApiCreatedResponse({description: 'successful user registration'})
@ApiConflictResponse({description: 'user already exists'})
@ApiBadRequestResponse({description: 'email is invalid'})
@ApiBadRequestResponse({description: 'password is too short'})
@ApiBadRequestResponse({description: 'dto is invalid'})
@Post('sign-up')signUp(@Body()signUpDto: SignUpDto){returnthis.authService.signUp(signUpDto);}
Under ideal circumstances, I'd love to be able to use the above code to describe different scenarios that ultimately all lead to the same http error response code.
Instead we have to do something like this for example:
@ApiCreatedResponse({description: 'successful user registration'})
@ApiConflictResponse({description: 'user already exists'})
@ApiBadRequestResponse({description: ['dto is invalid','password is too short','email is invalid',].join(' or '),})
@Post('sign-up')signUp(@Body()signUpDto: SignUpDto){returnthis.authService.signUp(signUpDto);}
or implement our own decorator wrapper (which IMHO helps bloat the project with misc utilities).
Describe the solution you'd like
As mentioned above, I'd love to see reuse of decorators being supported.
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
Take the following example:
Under ideal circumstances, I'd love to be able to use the above code to describe different scenarios that ultimately all lead to the same http error response code.
Instead we have to do something like this for example:
or implement our own decorator wrapper (which IMHO helps bloat the project with misc utilities).
Describe the solution you'd like
As mentioned above, I'd love to see reuse of decorators being supported.
Teachability, documentation, adoption, migration strategy
I believe this to be a rather trivial feature to implement, and IMHO it improves the quality of the code and makes it a tad bit more readable.
What is the motivation / use case for changing the behavior?
Basically, just code readability. Let me know if this is something others might also appreciate, and I'd be glad to make a PR with my take on it :)
The text was updated successfully, but these errors were encountered: