> For the complete documentation index, see [llms.txt](https://kinesis-school-of-programming.gitbook.io/nestjs-unleashed/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinesis-school-of-programming.gitbook.io/nestjs-unleashed/core-module-backend-development-with-nestjs/validation/more-specific-validation.md).

# More specific validation

We can think of better validation to the user's fields.

Well, the fields are being validated, but the validation is too lenient. It can be much more robust and focused. We can think of the following rules:

* <mark style="color:blue;">`name`</mark> - Between two and fifty characters. We can achieve this with <mark style="color:blue;">`@Length(2, 50)`</mark>.
* <mark style="color:blue;">`email`</mark> - Must be a valid email. We can use <mark style="color:blue;">`@IsEmail()`</mark>.
* <mark style="color:blue;">`phone`</mark> - Must be a valid phone number. We can use <mark style="color:blue;">`@IsPhoneNumber()`</mark>, and even define a <mark style="color:blue;">`region`</mark>, like US.
* <mark style="color:blue;">`password`</mark> - In a future moment, we'll validate it using <mark style="color:blue;">`@Matches()`</mark> and a **regex** for interesting, custom validation. For now, let's leave it as it is.

> It can be a great idea to check on the [available validators](https://github.com/typestack/class-validator#validation-decorators), you may find something interesting.
