UNPKG

@tsed/common

Version:
78 lines 1.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MultipleOf = void 0; const schema_1 = require("@tsed/schema"); /** * A numeric instance is valid only if division by this keyword's value results in an integer. * * ::: warning * The value of `multipleOf` MUST be a number, strictly greater than 0. * ::: * * ::: warning * This decorator will be removed in v7. * For v6 user, use @@MultipleOf@@ from @tsed/schema instead of @tsed/common. * ::: * * ## Example * ### With primitive type * * ```typescript * class Model { * @MultipleOf(2) * property: Number; * } * ``` * * ```json * { * "type": "object", * "properties": { * "property": { * "type": "number", * "multipleOf": 2 * } * } * } * ``` * * ### With array type * * ```typescript * class Model { * @CollectionOf(number) * @MultipleOf(2) * property: number[]; * } * ``` * * Will produce: * * ```json * { * "type": "object", * "properties": { * "property": { * "type": "array", * "items": { * "type": "number", * "multipleOf": 2 * } * } * } * } * ``` * * @param {number} multipleOf The multiple value allowed * @decorator * @validation * @swagger * @schema * @ignore * @deprecated Since v6. Use @MultipleOf decorator from @tsed/schema instead of. */ function MultipleOf(multipleOf) { return schema_1.MultipleOf(multipleOf); } exports.MultipleOf = MultipleOf; //# sourceMappingURL=multipleOf.js.map