# Email Decorator validation property

Module
import { Email } from "@tsed/common"
Source/packages/common/src/jsonschema/decorators/email.ts

# Overview

function Email(): (...parameters: any[]) => any;

# Description

Apply an email validation on property.

WARNING

This decorator will be removed in v7. For v6 user, use from @tsed/schema instead of @tsed/common.

# Example

# With primitive type

class Model {
   @Email()
   property: string;
}
1
2
3
4

Will produce:

{
  "type": "object",
  "properties": {
    "property": {
      "type": "string",
      "format": "email"
    }
  }
}
1
2
3
4
5
6
7
8
9

# With array type

class Model {
   @Email()
   @CollectionOf(String)
   property: string[];
}
1
2
3
4
5

Will produce:

{
  "type": "object",
  "properties": {
    "property": {
      "type": "array",
      "items": {
         "type": "string",
         "format": "email"
      }
    }
  }
}
1
2
3
4
5
6
7
8
9
10
11
12

See Format decorator.