If I declare DepartmentDto
type that recursively references itself:
export class DepartmentDto {
@IsNotEmpty()
@IsString()
@ApiProperty()
id: string;
@IsNotEmpty()
@IsString()
@ApiProperty()
name: string;
@ApiProperty()
parentDepartment: DepartmentDto;
@Type(() => DepartmentDto)
@ApiProperty({ type: DepartmentDto, isArray: true })
subDepartments: DepartmentDto[];
}
I get this inside swagger docs:
[
{
"id": "string",
"name": "string",
"parentDepartment": "string",
"subDepartments": [
"string"
]
}
]
Is there a way to showcase recursivity in the docs using @nestjs/swagger
?