@tsed/common
Version:
A TypeScript Framework on top of Express
72 lines (71 loc) • 1.42 kB
TypeScript
/**
* The value of `minimum` 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 greater than or exactly equal to `minimum`.
*
* ::: warning
* This decorator will be removed in v7.
* For v6 user, use @@Minimum@@ from @tsed/schema instead of @tsed/common.
* :::
*
* ## Example
* ### With primitive type
*
* ```typescript
* class Model {
* @Minimum(10)
* property: number;
* }
* ```
*
* Will produce:
*
* ```json
* {
* "type": "object",
* "properties": {
* "property": {
* "type": "number",
* "minimum": 10
* }
* }
* }
* ```
*
* ### With array type
*
* ```typescript
* class Model {
* @Minimum(10)
* @CollectionOf(Number)
* property: number[];
* }
* ```
*
* Will produce:
*
* ```json
* {
* "type": "object",
* "properties": {
* "property": {
* "type": "array",
* "items": {
* "type": "number",
* "minimum": 10
* }
* }
* }
* }
* ```
*
* @param {number} minimum The minimum value allowed
* @param {boolean} exclusive
* @decorator
* @validation
* @swagger
* @schema
* @ignore
* @deprecated Since v6. Use @Minimum decorator from @tsed/schema instead of.
*/
export declare function Minimum(minimum: number, exclusive?: boolean): (...args: any[]) => any;