fix: openapi decorator

This now correctly returns the dto if it is provided. Previously it would return () => undefined, when the dto was not defined, which crashed some internal logic in nestjs.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2022-02-21 10:09:02 +01:00 committed by David Mehren
parent bb2c248147
commit cf5c398933

View file

@ -106,7 +106,7 @@ export const OpenApi = (
ApiOkResponse({
description: description ?? okDescription,
isArray: isArray,
type: () => dto,
type: dto ? (): BaseDto => dto as BaseDto : undefined,
}),
);
break;
@ -115,7 +115,7 @@ export const OpenApi = (
ApiCreatedResponse({
description: description ?? createdDescription,
isArray: isArray,
type: () => dto,
type: dto ? (): BaseDto => dto as BaseDto : undefined,
}),
HttpCode(201),
);