related to #4954
When importing ValidationPipe from @nestjs/common the console throws this message on runtime:
The "class-transformer" package is missing. Please, make sure to install this library ($ npm install class-transformer) to take advantage of ValidationPipe.
and
The "class-validator" package is missing. Please, make sure to install this library ($ npm install class-validator) to take advantage of ValidationPipe.
Since _ValidationPipe_ is being imported from a "common" module, shouldn't it be built into it? If not, why?
Also, there's no hint in the documentation that relates the class-validator and class-transformer dependencies with _ValidationPipe_ (as they are required for ValidationPipe to work)
These libraries should be included natively since _ValidationPipe_ belongs to @nestjs/common
Nest version: 7.5.1
For Tooling issues:
- Node version: v12.16.1
- Platform: macOS
No documentation the pipe uses them:
Because this pipe uses the class-validator and class-transformer libraries, there are many options available. You configure these settings via a configuration object passed to the pipe. Following are the built-in options
The pipe usage is optional, and to keep the @nestjs/common package smaller, these classes are not directly installed. The same goes for @nestjs/microservices, @nestjs/websockets, @nestjs/platform-fastify, and @nestjs/platform-express (though the last one is installed by default from the CLI).
These are all optional dependencies depending on your server's set up, so they should not be included with the package.
There _could_ be an added note in the docs however about installing the libraries manually, as it is necessary, but other than that, the libraries should not be added, in an attempt to keep the @nestjs/common package smaller.
Hmm. Now I understand the philosophy and you're right. I generated the issue because the previous answers wasn't clear. Anyway thanks for the explanation.
Most helpful comment
No documentation the pipe uses them:
Found here in the docs
The pipe usage is optional, and to keep the
@nestjs/commonpackage smaller, these classes are not directly installed. The same goes for@nestjs/microservices,@nestjs/websockets,@nestjs/platform-fastify, and@nestjs/platform-express(though the last one is installed by default from the CLI).These are all optional dependencies depending on your server's set up, so they should not be included with the package.
There _could_ be an added note in the docs however about installing the libraries manually, as it is necessary, but other than that, the libraries should not be added, in an attempt to keep the
@nestjs/commonpackage smaller.