I'm trying to create a DTO that has another DTO as array, but when sending the body, nestjs/swagger not detecting the body content. My DTOs are:
export class CreatePageDto {
@ApiHideProperty()
createAt: Date;
@ApiHideProperty()
updateAt: Date;
@ApiProperty({
type: CreatePageTranslateDto,
isArray: true,
})
translations: CreatePageTranslateDto[];
}
export class CreatePageTranslateDto {
@ApiProperty()
slug: string;
@ApiProperty()
title: string;
@ApiProperty({
enum: AvailableLanguages,
})
lang: AvailableLanguages;
}
When a post a body like this:
curl --location --request POST 'http://localhost:3000/pages' \
--header 'Content-Type: application/json' \
--data-raw '{
"translations": [
{
"slug": "nombre-de-ejemplo",
"title": "Nombre de ejemplo",
"lang": "es"
}
]
}'
I get an empty body.