Skip to content

skipNullProperties in ValidationPipes not doing anything? #14831

@dunklesToast

Description

@dunklesToast

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

As shown in the docs or explained in the source, the skipNullProperties options should be used to skip the validation for nullable values. I assume the value was added by accident to the Validator Options Interface? It does not exist for class-validator and seems to be only available in nestjs' mapped-types

Minimum reproduction code

https://codesandbox.io/p/devbox/5jyyll

Steps to reproduce

Run the "start" script in the code sandbox. It should print the following:

Image

Expected behavior

I'd expected the skipNullProperties setting to be a global switch to set the value for all PartialTypes to the globally set value.

Package

  • I don't know. Or some 3rd-party package
  • @nestjs/common
  • @nestjs/core
  • @nestjs/microservices
  • @nestjs/platform-express
  • @nestjs/platform-fastify
  • @nestjs/platform-socket.io
  • @nestjs/platform-ws
  • @nestjs/testing
  • @nestjs/websockets
  • Other (see below)

Other package

@nestjs/mapped-types

NestJS version

11.0.12

Packages versions

mappedTypes => 2.0.1
common => 11.0.12

Node.js version

v20.11.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue has not been looked into

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions