New decorator @TypedException()
has been newly added.
For reference, this decorator function does not affect to the method's behavior, but only affects to the swagger documents generation. Also, it does not affect to the SDK library generation yet, but will be used in the future.
Declaration
export function TypedException<T extends object>(
status: number | "2XX" | "3XX" | "4XX" | "5XX",
description?: string | undefined,
): MethodDecorator;
Use Case
import {
TypedBody,
TypedException,
TypedParam,
TypedRoute,
} from "@nestia/core";
import { Controller } from "@nestjs/common";
import typia, { TypeGuardError } from "typia";
import { IBbsArticle } from "@api/lib/structures/IBbsArticle";
import { IInternalServerError } from "@api/lib/structures/IInternalServerError";
import { INotFound } from "@api/lib/structures/INotFound";
import { IUnprocessibleEntity } from "@api/lib/structures/IUnprocessibleEntity";
@Controller("bbs/articles")
export class BbsArticlesController {
@TypedRoute.Post(":section")
@TypedException<TypeGuardError>(400, "invalid request")
@TypedException<INotFound>(404, "unable to find the matched section")
@TypedException<IUnprocessibleEntity>(428)
@TypedException<IInternalServerError>("5XX", "internal server error")
public async store(
@TypedParam("section") section: string,
@TypedBody() input: IBbsArticle.IStore,
): Promise<IBbsArticle>;
}
What's Changed
@TypedException()
decorator for swagger documents by @samchon in #548- Update typia requirement from ^4.2.1 to ^4.2.3 in /test by @dependabot in #543
- Update typia requirement from ^4.2.1 to ^4.2.3 in /packages/e2e by @dependabot in #546
- Fix website typo by @homekeeper89 in #547
- Complement #540 -
ISwaggerRoute.IResponseBody.description
is required. by @samchon in #549
New Contributors
- @homekeeper89 made their first contribution in #547
Full Changelog: v1.6.3...v1.6.5