Open xxmichas opened 3 weeks ago
As @TypedParam()
decorated parameter has only one atomic type, I just used assert
function only.
If you want the IValidation
typed error message format, it is not hard thing, but have to connsider about when configured the validation function to be is()
case. How it would be? Also, as it is a break change on the API level, if accept your suggestion, it would adapted in the next major version.
Thanks for quick response.
When is()
is used, both TypedQuery
and TypedBody
return:
interface _ {
message: string;
error: "Bad Request";
statusCode: 400;
}
I think TypedParam
should follow that interface too.
Summary
TypedParam
error to follow the same interface asTypedQuery
andTypedBody
.TypedParam
uses assert regardless of value in tsconfigtsconfig:
Code:
TypedParam error (bug):
TypedParam error (expected):
This change would unify their interfaces and make it easier to consume apis created with nestia.
Related code: TypedParam: https://github.com/samchon/nestia/blob/master/packages/core/src/decorators/TypedParam.ts#L50 TypedQuery: https://github.com/samchon/nestia/blob/master/packages/core/src/decorators/TypedQuery.ts#L49 TypedBody: https://github.com/samchon/nestia/blob/master/packages/core/src/decorators/TypedBody.ts#L30