Closed YouNone closed 4 years ago
items
is an object, not an array.
Change:
@Type(() => ChangeGroupStateDto)
@ValidateNested({ each: true })
public items: ChangeGroupStateDto;
to:
@Type(() => ChangeGroupStateDto)
@ValidateNested()
public items: ChangeGroupStateDto;
Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.
Thanks, works for me!
Front-end form data
{name: "group name", code: "2222", items: {…}, id: 2} name: "group name" code: "2222" id: 2 items: { added: [1, 2, 3] deleted: Array(0) }
Bug Report
When I'm trying to add array of id's in Group.items.added, the @ValidateNested doesn't show nested fields
Current behavior
HTTP/1.1 500 Internal Server Error
{ "statusCode": 500, "message": "Internal server error" }
Input Code
Expected behavior
I'm trying to get this output { "id": 2, "name": "group name", "code": "2222", "items": { "added": [1, 2, 3], "deleted": [] } }
Environment