Skip to content

ValidationPipe not run for Custom Decorators #2010

@kleingeist

Description

@kleingeist

I'm submitting a...


[ ] Regression 
[ ] Bug report
[ ] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

The doc says at https://docs.nestjs.com/custom-decorators#working-with-pipes that custom validators may be used with pipes. The example shows the ValidationPipe. But the the ValidationPipe skips on metadata.type == 'custom' https://github.com/nestjs/nest/blob/master/packages/common/pipes/validation.pipe.ts#L78

Expected behavior

Either the docs should be updated or the validation pipe allowed to run on custom decorators.
Personally i would prefer the latter.

What is the motivation / use case for changing the behavior?

It would be useful to use the validation pipe for custom types instead of duplicating the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions