# MaxProperties Decorator
Module | import { MaxProperties } from "@tsed/common" |
---|---|
Source | /packages/common/src/jsonschema/decorators/maxProperties.ts |
# Overview
function MaxProperties(maxProperties: number): (...parameters: any[]) => any;
# Description
An object instance is valid against maxProperties
if its number of properties is less than, or equal to, the value of this keyword.
!> The value of this keyword MUST be a non-negative integer.
# Example
class Model {
@Any()
@MaxProperties(10)
property: any;
}
1
2
3
4
5
2
3
4
5
Will produce:
{
"type": "object",
"properties": {
"property": {
"type": "any",
"maxProperties": 10
}
}
}
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9