209 похожих чатов

Всем привет Ситуация: 1)Есть generic: export class RestResponse<T> { @ApiProperty()

@IsOptional()
code: number;
@ApiProperty()
@IsOptional()
message: string;
@ApiProperty()
@IsOptional()
success: boolean;
@ApiProperty()
@IsOptional()
object?: T;
static ok<T>(object?: T): RestResponse<T> {
const response = new RestResponse<T>();
response.code = 200;
response.success = true;
response.message = 'success';
response.object = object;
return response;
}
}
2)Есть модель, который возвращает service:
export class SearchResponseDto {
@ApiProperty({
isArray: true,
type: CustomerInfoDto,
})
customer: CustomerInfoDto[];
}
3)Есть контроллер, в котором заворачиваю response model во враппер:
@Get('/customer/by')
@ApiOkResponse({ type: RestResponse<SearchResponseDto> })
@ApiNotFoundResponse({ type: ErrorResponse })
@ApiInternalServerErrorResponse({ type: ErrorResponse })
@ApiQuery({
name: 'fullName',
type: 'string',
required: true,
description: 'Full name of customer',
example: 'Surname Name Patronymic',
})le: 'dd-MM-YYYY',
})
searchCustomerByFullNameAndBirthdate(
@Query('fullName') fullName: string,
): Promise<SearchResponseDto> {
return this.searchService.searchCustomerByFullNameAndBirthdate(fullName,...);
}
Проблема: как видно из фотографии в swagger-е моделька не показывается ни в списке моделей ни в response model endpoint-а
Вопрос: как сделать так чтобы моделька которую я завернул показывалась ?

1 ответов

6 просмотров

Это так работать не будет

Похожие вопросы

Карта сайта