typestack / class-transformer

Decorator-based transformation, serialization, and deserialization between objects and classes.
MIT License
6.64k stars 485 forks source link

Validation object's target property contains excluded properties #327

Open creaux opened 4 years ago

creaux commented 4 years ago

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
}
MaksSlesarenko commented 1 month ago

any news here?