-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
141 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* | ||
* A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword. | ||
* | ||
* 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). | ||
* | ||
* ::: warning | ||
* The value of maxLength MUST be a non-negative integer. | ||
* ::: | ||
* | ||
* ::: tip | ||
* Omitting this keyword has the same behavior as a value of 0. | ||
* ::: | ||
* | ||
* ## Example | ||
* ### With primitive type | ||
* | ||
* ```typescript | ||
* class Model { | ||
* @MaxLength(10) | ||
* property: number; | ||
* } | ||
* ``` | ||
* | ||
* Will produce: | ||
* | ||
* ```json | ||
* { | ||
* "type": "object", | ||
* "properties": { | ||
* "property": { | ||
* "type": "string", | ||
* "maxLength": 10 | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
* | ||
* ### With array type | ||
* | ||
* ```typescript | ||
* class Model { | ||
* @MaxLength(10) | ||
* @CollectionOf(String) | ||
* property: string[]; | ||
* } | ||
* ``` | ||
* | ||
* Will produce: | ||
* | ||
* ```json | ||
* { | ||
* "type": "object", | ||
* "properties": { | ||
* "property": { | ||
* "type": "array", | ||
* "items": { | ||
* "type": "string", | ||
* "maxLength": 10 | ||
* } | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
* | ||
* @param {number} maxLength The maximum length allowed | ||
* @decorator | ||
* @ajv | ||
* @jsonMapper | ||
* @swagger | ||
* @schema | ||
* @propertyDecorator | ||
* @paramDecorator | ||
* @model | ||
*/ | ||
export declare function MaxLength(maxLength: number): (...args: any[]) => any; |