UNPKG

@tsed/common

Version:
79 lines 1.75 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ExclusiveMinimum = void 0; const schema_1 = require("@tsed/schema"); /** * The value of `exclusiveMinimum` MUST be number, representing an exclusive upper limit for a numeric instance. * * If the instance is a number, then the instance is valid only if it has a value strictly greater than (not equal to) `exclusiveMinimum`. * * ::: warning * This decorator will be removed in v7. * For v6 user, use @@ExclusiveMinimum@@ from @tsed/schema instead of @tsed/common. * ::: * * ## Example * ### With primitive type * * ```typescript * class Model { * @ExclusiveMinimum(10) * property: number; * } * ``` * * Will produce: * * ```json * { * "type": "object", * "properties": { * "property": { * "type": "number", * "exclusiveMinimum": 10 * } * } * } * ``` * * ### With array type * * ```typescript * class Model { * @ExclusiveMinimum(10) * @CollectionOf(Number) * property: number[]; * } * ``` * * Will produce: * * ```json * { * "type": "object", * "properties": { * "property": { * "type": "array", * "items": { * "type": "number", * "exclusiveMinimum": 10 * } * } * } * } * ``` * * @param minimum * @param {boolean} exclusiveMinimum * @returns {Function} * @decorator * @validation * @property * @ignore * @deprecated Since v6. Use @ExclusiveMinimum decorator from @tsed/schema instead of. */ function ExclusiveMinimum(minimum, exclusiveMinimum = true) { return schema_1.ExclusiveMinimum(minimum, exclusiveMinimum); } exports.ExclusiveMinimum = ExclusiveMinimum; //# sourceMappingURL=exclusiveMinimum.js.map