I have one common Dto for Pagination. But while some of the apis need more parameters and pagination too. e.g. search, filter etc. So my method would become like below :
getAllCelebrities(
@AuthUser('_id') userId: string,
@Body() paginationnewDto: PaginationnewDto,
@Body() getCelebritiesDto: GetCelebritiesDto,
)
Having 2 body params generates 2 blocks in swagger. Like below:
Also when I console both params, it returns same object.
getCelebritiesDto
? And I can be DRY.Answering my own Question as I didn't find any other alternative. As per my thought and @MorKadosh's suggestion here is a simple solution. I've extended PaginationnewDto
in GetCelebritiesDto
export class GetCelebritiesDto extends PaginationnewDto {}