github samchon/nestia v1.6.5

latest releases: v3.18.0, v3.17.0, v3.16.0...
15 months ago

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

New Contributors

Full Changelog: v1.6.3...v1.6.5

Don't miss a new nestia release

NewReleases is sending notifications on new releases.