typestack / class-validator

Decorator-based property validation for classes.
MIT License
11k stars 795 forks source link

documentation: Validating nested arrays after creation with class-transformer #868

Open Sauermann opened 3 years ago

Sauermann commented 3 years ago

Description

In the README.md section about validating arrays containing nested objects, the requirements for validating objects created with class-transformer are not made clear. This issue regards the following section of the documentation: https://github.com/typestack/class-validator/blob/9f0c3e9eb6174ca5b5d00363adf108427ab3ef41/README.md#L332-L342

The problem is, that after creating a nested array with class-transformer with the above code as template, the objects within the array do not contain the class information.

Proposed solution

I suggest to include the following additional information:

When validating nested objects created with class-transformer, it is required to specify the type of the nested objects as described in the class-transformer documentation.

vlapo commented 3 years ago

I agree we can add small note about this information.

gilsoncav commented 3 years ago

I also agree. Stumbled here with the same misleading assumption. It worths a note.