@tsed/common
Version:
A TypeScript Framework on top of Express
69 lines (68 loc) • 1.17 kB
TypeScript
/**
* Apply an email validation on property.
*
* ::: warning
* This decorator will be removed in v7.
* For v6 user, use @@Format@@ from @tsed/schema instead of @tsed/common.
* :::
*
* ## Example
* ### With primitive type
*
* ```typescript
* class Model {
* @Email()
* property: string;
* }
* ```
*
* Will produce:
*
* ```json
* {
* "type": "object",
* "properties": {
* "property": {
* "type": "string",
* "format": "email"
* }
* }
* }
* ```
*
* ### With array type
*
* ```typescript
* class Model {
* @Email()
* @CollectionOf(String)
* property: string[];
* }
* ```
*
* Will produce:
*
* ```json
* {
* "type": "object",
* "properties": {
* "property": {
* "type": "array",
* "items": {
* "type": "string",
* "format": "email"
* }
* }
* }
* }
* ```
*
* > See [Format](api/common/jsonschema/schema) decorator.
* @returns {Function}
* @decorator
* @validation
* @property
* @ignore
* @deprecated Since v6. Use @Email decorator from @tsed/schema instead of.
*/
export declare function Email(): (...args: any[]) => any;