@tsed/common
Version:
A TypeScript Framework on top of Express
79 lines • 1.67 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Maximum = void 0;
const schema_1 = require("@tsed/schema");
/**
* The value of `maximum` MUST be a number, representing an inclusive upper limit for a numeric instance.
*
* If the instance is a number, then this keyword validates only if the instance is less than or exactly equal to `maximum`.
*
* ::: warning
* This decorator will be removed in v7.
* For v6 user, use @@Maximum@@ from @tsed/schema instead of @tsed/common.
* :::
*
* ## Example
* ### With primitive type
*
* ```typescript
* class Model {
* @Maximum(10)
* property: number;
* }
* ```
*
* Will produce:
*
* ```json
* {
* "type": "object",
* "properties": {
* "property": {
* "type": "number",
* "maximum": 10
* }
* }
* }
* ```
*
* ### With array type
*
* ```typescript
* class Model {
* @Maximum(10)
* @CollectionOf(Number)
* property: number[];
* }
* ```
*
* Will produce:
*
* ```json
* {
* "type": "object",
* "properties": {
* "property": {
* "type": "array",
* "items": {
* "type": "number",
* "maximum": 10
* }
* }
* }
* }
* ```
*
* @param {number} maximum The maximum value allowed
* @param {boolean} exclusive Same effect as ExclusiveMaximum decorator.
* @decorator
* @validation
* @swagger
* @schema
* @ignore
* @deprecated Since v6. Use @Maximum decorator from @tsed/schema instead of.
*/
function Maximum(maximum, exclusive = false) {
return schema_1.Maximum(maximum, exclusive);
}
exports.Maximum = Maximum;
//# sourceMappingURL=maximum.js.map