You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.
4
+
*
5
+
* The length of a string instance is defined as the number of its characters as defined by [RFC 7159](http://json-schema.org/latest/json-schema-validation.html#RFC7159).
6
+
*
7
+
* ::: warning
8
+
* The value of maxLength MUST be a non-negative integer.
9
+
* :::
10
+
*
11
+
* ::: tip
12
+
* Omitting this keyword has the same behavior as a value of 0.
13
+
* :::
14
+
*
15
+
* ## Example
16
+
* ### With primitive type
17
+
*
18
+
* ```typescript
19
+
* class Model {
20
+
* @MaxLength(10)
21
+
* property: number;
22
+
* }
23
+
* ```
24
+
*
25
+
* Will produce:
26
+
*
27
+
* ```json
28
+
* {
29
+
* "type": "object",
30
+
* "properties": {
31
+
* "property": {
32
+
* "type": "string",
33
+
* "maxLength": 10
34
+
* }
35
+
* }
36
+
* }
37
+
* ```
38
+
*
39
+
* ### With array type
40
+
*
41
+
* ```typescript
42
+
* class Model {
43
+
* @MaxLength(10)
44
+
* @CollectionOf(String)
45
+
* property: string[];
46
+
* }
47
+
* ```
48
+
*
49
+
* Will produce:
50
+
*
51
+
* ```json
52
+
* {
53
+
* "type": "object",
54
+
* "properties": {
55
+
* "property": {
56
+
* "type": "array",
57
+
* "items": {
58
+
* "type": "string",
59
+
* "maxLength": 10
60
+
* }
61
+
* }
62
+
* }
63
+
* }
64
+
* ```
65
+
*
66
+
* @param {number} maxLength The maximum length allowed
67
+
* @decorator
68
+
* @ajv
69
+
* @jsonMapper
70
+
* @swagger
71
+
* @schema
72
+
* @propertyDecorator
73
+
* @paramDecorator
74
+
* @model
75
+
*/
76
+
export declare function MaxLength(maxLength: number): (...args: any[]) => any;
0 commit comments