UNPKG

@tsed/schema

Version:
45 lines (44 loc) 722 B
import { JsonEntityFn } from "./jsonEntityFn.js"; /** * Add title metadata on the decorated element. * * ::: warning * For v6 user, use @@Title@@ from @tsed/schema instead of @tsed/platform-http. * ::: * * ## Example * * ```typescript * class Model { * @Title("title") * id: string; * } * ``` * * Will produce: * * ```json * { * "type": "object", * "properties": { * "id": { * "type": "string", * "title": "title" * } * } * } * ``` * * @param {string} title * @decorator * @validation * @swagger * @schema * @classDecorator * @input */ export function Title(title) { return JsonEntityFn((entity) => { entity.schema.title(title); }); }