-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
Describe the bug
To fix this @ValidateNested({ each: true }) will needed to be added to any DTOs with @IsArray().
NOTE: this may cause some parts of the frontend/backend to BREAK since parts of our frontend might be calling the backend with bad data and for some reason the backend may be working with said bad data.
Also, it would be really good to add some tests for this.
Also, probably update the documentation (NEWDEVS) to talk about DTOs, why we should use them (to validate our data that's sent to the backend automatically so we don't have people calling our backend with bad data), and to note the importance of this case with @IsArray.
To Reproduce
- find an endpoint that uses a DTO (i.e. a class from inside index.ts) that has a
@IsArray() - Modify the frontend so that the array is filled with bad data (if the array is an array of objects, add extra parameters to said array. If it's just an array of numbers or strings, try making it an array of booleans or something)
- Print the resulting body params inside the endpoint you called with console.log, and see that all the array items are still filled with bad data
Screenshots
Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers