@tsed/common
Version:
A TypeScript Framework on top of Express
76 lines • 1.36 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Email = void 0;
const schema_1 = require("@tsed/schema");
/**
* 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.
*/
function Email() {
return schema_1.Email();
}
exports.Email = Email;
//# sourceMappingURL=email.js.map