@tsed/common
Version:
A TypeScript Framework on top of Express
57 lines • 1.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MinProperties = void 0;
const schema_1 = require("@tsed/schema");
/**
* An object instance is valid against `minProperties` if its number of properties is less than, or equal to, the value of this keyword.
*
* ::: warning
* The value of this keyword MUST be a non-negative integer.
* :::
*
* ::: tip
* Omitting this keyword has the same behavior as a value of 0.
* :::
*
* ::: warning
* This decorator will be removed in v7.
* For v6 user, use @@MinProperties@@ from @tsed/schema instead of @tsed/common.
* :::
*
* ## Example
* ### On prop
* ```typescript
* class Model {
* @Any()
* @MinProperties(10)
* property: any;
* }
* ```
*
* Will produce:
*
* ```json
* {
* "type": "object",
* "properties": {
* "property": {
* "type": "any",
* "minProperties": 10
* }
* }
* }
* ```
*
* @param {number} minProperties The minimum properties allowed on the object.
* @validation
* @swagger
* @schema
* @collections
* @ignore
* @deprecated Since v6. Use @MinProperties decorator from @tsed/schema instead of.
*/
function MinProperties(minProperties) {
return schema_1.MinProperties(minProperties);
}
exports.MinProperties = MinProperties;
//# sourceMappingURL=minProperties.js.map