class-transformer icon indicating copy to clipboard operation
class-transformer copied to clipboard

Validation object's target property contains excluded properties

Open creaux opened this issue 5 years ago • 1 comments

When I'm validating against excluded property of class target is getting populated by empty object with key name of excluded property.

Call of plainToClass is following:

const result = plainToClass(metatype, value, {
      excludeExtraneousValues: true,
      excludePrefixes: ['_'],
});
const errors = await validate(result);

Anyway target contains excluded value _map. Trying to figure out whether this is a bug or just missing something.

{
  "error": "Request validation failed",
  "message": [
    {
      "children": [],
      "constraints": {
             ...
      },
      "property": "products",
      "target": {
        "_map": {},
        ...
      }
    }
  ],
  "statusCode": 400
}

creaux avatar Jan 29 '20 20:01 creaux

any news here?

MaksSlesarenko avatar May 21 '24 17:05 MaksSlesarenko